@SuppressWarnings("unchecked")
@Override
public void withFuture(QSTaskModel task, final Future<Pair<QSTaskModel, Object>> future) {
// I don't know if this is useful or not.
QSWorker worker = workers.get(task.handler);
if (worker == null) {
throw new RuntimeException("No worker available for worker identifier: " + task.handler);
}
final TaskKitFactory factory = new TaskKitFactory(task, worker, logService, workerIdService);
worker.withFuture(factory, new Future<Pair<TaskKitFactory, Object>>() {
@Override
public boolean cancel(boolean mayInterruptIfRunning) {
return future.cancel(mayInterruptIfRunning);
}