code: private void executeTasklet(final ExecutorService commandExecutor,
                                final ConcurrentMap<Integer, Future> futures,
                                final MasterToWorkerRequest masterToWorkerRequest) {
      final CountDownLatch latch = new CountDownLatch(1);
      final TaskletExecutionRequest taskletExecutionRequest = (TaskletExecutionRequest) masterToWorkerRequest;
  
      // Scheduler Thread: Pass the command to the worker thread pool to be executed
      // Record future to support cancellation.
      futures.put(
          taskletExecutionRequest.getTaskletId(),
          commandExecutor.submit(new Runnable() {
            @Override
            public void run() {
              final WorkerToMasterReports reports;
              final List<WorkerToMasterReport> holder = new ArrayList<>();
  
              try {
                // Command Executor: Execute the command
                final WorkerToMasterReport workerToMasterReport =
                    new TaskletResultReport(taskletExecutionRequest.getTaskletId(), taskletExecutionRequest.execute());
                holder.add(workerToMasterReport);
              } catch (final InterruptedException ex) {
                // Assumes that user's thread follows convention that cancelled Futures
                // should throw InterruptedException.
                final WorkerToMasterReport workerToMasterReport =
                    new TaskletCancelledReport(taskletExecutionRequest.getTaskletId());
                LOG.log(Level.WARNING, "Tasklet with ID {0} has been cancelled", taskletExecutionRequest.getTaskletId());
                holder.add(workerToMasterReport);
              } catch (Exception e) {
                // Command Executor: Tasklet throws an exception
                final WorkerToMasterReport workerToMasterReport =
                    new TaskletFailureReport(taskletExecutionRequest.getTaskletId(), e);
                holder.add(workerToMasterReport);
              }
  
              reports = new WorkerToMasterReports(holder);
              workerReports.addLast(kryoUtils.serialize(reports));
              try {
                latch.await();
              } catch (final InterruptedException e) {
                LOG.log(Level.SEVERE, "Cannot wait for Future to be put.");
                throw new RuntimeException(e);
              }
              futures.remove(taskletExecutionRequest.getTaskletId());
              heartBeatTriggerManager.triggerHeartBeat();
            }
          }));
  
      // Signal that future is put.
      latch.countDown();
    }
docs: Executes an tasklet request from the {@link org.apache.reef.vortex.driver.VortexDriver}.