use of com.haulmont.cuba.gui.executors.impl.TaskHandlerImpl in project cuba by cuba-platform.
the class WebBackgroundWorker method handle.
@Override
public <T, V> BackgroundTaskHandler<V> handle(final BackgroundTask<T, V> task) {
checkNotNull(task);
checkUIAccess();
App appInstance;
try {
appInstance = App.getInstance();
} catch (IllegalStateException ex) {
log.error("Couldn't handle task", ex);
throw ex;
}
// create task executor
final WebTaskExecutor<T, V> taskExecutor = new WebTaskExecutor<>(appInstance.getAppUI(), task);
// add thread to taskSet
appInstance.addBackgroundTask(taskExecutor.getFuture());
// create task handler
TaskHandlerImpl<T, V> taskHandler = new TaskHandlerImpl<>(getUIAccessor(), taskExecutor, watchDog);
taskExecutor.setTaskHandler(taskHandler);
return taskHandler;
}
Aggregations