class ReconcileService extends AbstractScheduledService {

    public void explicitReconcile() {
        lock.lock();
        try {
            Set<TaskContext> runningTask = new HashSet<>();
            for (Set<TaskContext> each : facadeService.getAllRunningTasks().values()) {
                runningTask.addAll(each);
            }
            if (runningTask.isEmpty()) {
                return;
            }
            log.info("Requesting {} tasks reconciliation with the Mesos master", runningTask.size());
            schedulerDriver.reconcileTasks(Collections2.transform(runningTask, new Function<TaskContext, Protos.TaskStatus>() {
                @Override
                public Protos.TaskStatus apply(final TaskContext input) {
                    return Protos.TaskStatus.newBuilder()
                            .setTaskId(Protos.TaskID.newBuilder().setValue(input.getId()).build())
                            .setSlaveId(Protos.SlaveID.newBuilder().setValue(input.getSlaveId()).build())
                            .setState(Protos.TaskState.TASK_RUNNING).build();
                }
            }));
        } finally {
            lock.unlock();
        }
    }

}