code: public synchronized void afterPreviousWorkersFinished(ActorRef<WorkerListener> onFinished) {
          if (this.onFinished != null) {
              throw new IllegalStateException("a callback already exists; wait for the workers to finish before setting a new callback");
          }
          this.onFinished = onFinished;
          if (activeWorkers.get() == 0) {
              fireAllWorkersFinished();
          }
      }
docs: Calls {@link WorkerListener#onAllWorkersFinished()} on the specified callback after all commands previously
  submitted to {@link #execute(Runnable)}, and recursively all commands which they submitted to {@link
  #execute(Runnable)}, have finished executing.