### Question:
GraphWorker implements Runnable { public void submitPreparedTask(final Task requestedTask, final TaskContext requestedTaskContext) { final int printHookCallbackId; final int progressHookCallbackId; final int taskCallbackId; if (requestedTaskContext != null) { final Callback<String> printHook = requestedTaskContext.printHook(); if (printHook != null) { printHookCallbackId = callbacksRegistry.register(printHook); } else { printHookCallbackId = -1; } final Callback<TaskProgressReport> progressHook = requestedTaskContext.progressHook(); if (progressHook != null) { progressHookCallbackId = callbacksRegistry.register(progressHook); } else { progressHookCallbackId = -1; } } else { printHookCallbackId = -1; progressHookCallbackId = -1; } Callback<Buffer> onResult = new Callback<Buffer>() { @Override public void on(Buffer buffer) { if (printHookCallbackId != -1) { } if (progressHookCallbackId != -1) { } final BaseTaskResult baseTaskResult = new BaseTaskResult(null, false); final L3GMap<List<Tuple<Object[], Integer>>> collector = new L3GMap<List<Tuple<Object[], Integer>>>(true); baseTaskResult.load(buffer, 0, workingGraphInstance, collector); workingGraphInstance.remoteNotify(baseTaskResult.notifications()); baseTaskResult.loadRefs(workingGraphInstance, collector, new Callback<Boolean>() { @Override public void on(Boolean result) { buffer.free(); requestedTaskContext.getResultCallback().on(baseTaskResult); } }); } }; taskCallbackId = callbacksRegistry.register(onResult); Buffer taskBuffer = new HeapBuffer(); taskBuffer.write(StorageMessageType.REQ_TASK); taskBuffer.write(Constants.BUFFER_SEP); taskBuffer.writeInt(mailboxId); taskBuffer.write(Constants.BUFFER_SEP); Base64.encodeIntToBuffer(taskCallbackId, taskBuffer); taskBuffer.write(Constants.BUFFER_SEP); requestedTask.saveToBuffer(taskBuffer); if (requestedTaskContext != null) { taskBuffer.write(Constants.BUFFER_SEP); if (printHookCallbackId != -1) { Base64.encodeIntToBuffer(printHookCallbackId, taskBuffer); } taskBuffer.write(Constants.BUFFER_SEP); if (progressHookCallbackId != -1) { Base64.encodeIntToBuffer(progressHookCallbackId, taskBuffer); } taskBuffer.write(Constants.BUFFER_SEP); requestedTaskContext.saveToBuffer(taskBuffer); } mailbox.submit(taskBuffer.data()); } GraphWorker(GraphBuilder workingGraphBuilder, boolean canProcessGeneralTaskQueue);  GraphWorker(GraphBuilder workingGraphBuilder, String name, boolean canProcessGeneralTaskQueue); GraphWorker withLogDirectory(String path, String maxSize); void setName(String name); String getName(); void halt(); int getId(); void setTaskWorker(); boolean submit(byte[] activity); void setOnWorkerStarted(PoolReadyCallback onWorkerStarted); Log log(); @Override void run(); void submitTask(final Task requestedTask, final Callback<TaskResult> requesterCallback); void submitPreparedTask(final Task requestedTask, final TaskContext requestedTaskContext); boolean isRunning();  }### Answer:
@Test public void _15_taskPool() { try { int nbTasks = 10; CountDownLatch latch = new CountDownLatch(nbTasks); AtomicInteger reportsCount = new AtomicInteger(); long ts0 = System.currentTimeMillis(); Task withProgress = Tasks.newTask().action(PluginForWorkersTest.PROGRESS_REPORTS); TaskContext taskContext = withProgress.prepare(null, null, result -> { long ts1 = System.currentTimeMillis(); latch.countDown(); }); taskContext.setProgressHook(result -> { reportsCount.incrementAndGet(); }); for (int i = 0; i < nbTasks; i++) { localWorker.submitPreparedTask(withProgress, taskContext, MailboxRegistry.getInstance().getDefaultMailboxId()); } latch.await(); assertEquals(10 * nbTasks, reportsCount.get()); } catch (InterruptedException e) { e.printStackTrace(); } }