code: @Override
      public void calculateNonce(final byte[] initialHash, final byte[] target, final Callback callback) {
          waiterPool.execute(new Runnable() {
              @Override
              public void run() {
                  long startTime = System.currentTimeMillis();
  
                  int cores = Runtime.getRuntime().availableProcessors();
                  if (cores > 255) cores = 255;
                  LOG.info("Doing POW using " + cores + " cores");
                  List<Worker> workers = new ArrayList<>(cores);
                  for (int i = 0; i < cores; i++) {
                      Worker w = new Worker((byte) cores, i, initialHash, target);
                      workers.add(w);
                  }
                  List<Future<byte[]>> futures = new ArrayList<>(cores);
                  for (Worker w : workers) {
                      // Doing this in the previous loop might cause a ConcurrentModificationException in the worker
                      // if a worker finds a nonce while new ones are still being added.
                      futures.add(workerPool.submit(w));
                  }
                  try {
                      while (!Thread.interrupted()) {
                          for (Future<byte[]> future : futures) {
                              if (future.isDone()) {
                                  callback.onNonceCalculated(initialHash, future.get());
                                  LOG.info("Nonce calculated in " + ((System.currentTimeMillis() - startTime) / 1000) + " seconds");
                                  for (Future<byte[]> f : futures) {
                                      f.cancel(true);
                                  }
                                  return;
                              }
                          }
                          Thread.sleep(100);
                      }
                      LOG.error("POW waiter thread interrupted - this should not happen!");
                  } catch (ExecutionException e) {
                      LOG.error(e.getMessage(), e);
                  } catch (InterruptedException e) {
                      LOG.error("POW waiter thread interrupted - this should not happen!", e);
                  }
              }
          });
      }
docs: This method will block until all pending nonce calculations are done, but not wait for its own calculation
  to finish.
  (This implementation becomes very inefficient if multiple nonce are calculated at the same time.)
  
  @param initialHash the SHA-512 hash of the object to send, sans nonce
  @param target      the target, representing an unsigned long
  @param callback    called with the calculated nonce as argument. The ProofOfWorkEngine implementation must make