Disabled Jack

I'd love to use Java 8 features, but Jack just isn't ready yet.
This commit is contained in:
2016-11-03 23:04:41 +01:00
parent 9af80f008d
commit b34e678c68
20 changed files with 499 additions and 364 deletions

View File

@ -92,23 +92,26 @@ public class ProofOfWorkService extends Service {
}
private void calculateNonce(final PowItem item) {
engine.calculateNonce(item.initialHash, item.targetValue, (initialHash, nonce) -> {
try {
item.callback.onNonceCalculated(initialHash, nonce);
} finally {
PowItem next;
synchronized (queue) {
next = queue.poll();
if (next == null) {
calculating = false;
stopForeground(true);
stopSelf();
} else {
notification.update(queue.size()).show();
engine.calculateNonce(item.initialHash, item.targetValue, new ProofOfWorkEngine.Callback() {
@Override
public void onNonceCalculated(byte[] initialHash, byte[] nonce) {
try {
item.callback.onNonceCalculated(initialHash, nonce);
} finally {
PowItem next;
synchronized (queue) {
next = queue.poll();
if (next == null) {
calculating = false;
stopForeground(true);
stopSelf();
} else {
notification.update(queue.size()).show();
}
}
if (next != null) {
calculateNonce(next);
}
}
if (next != null) {
calculateNonce(next);
}
}
});

View File

@ -110,9 +110,9 @@ public class Singleton {
return powRepo;
}
public static BitmessageAddress getIdentity(Context ctx) {
public static BitmessageAddress getIdentity(final Context ctx) {
if (identity == null) {
BitmessageContext bmc = getBitmessageContext(ctx);
final BitmessageContext bmc = getBitmessageContext(ctx);
synchronized (Singleton.class) {
if (identity == null) {
List<BitmessageAddress> identities = bmc.addresses()