public abstract class AbstractUIThreadManager extends Object implements UIThreadManager
Modifier and Type | Field and Description |
---|---|
protected static String |
ERROR_CALLABLE_NULL |
protected static String |
ERROR_RUNNABLE_NULL |
Constructor and Description |
---|
AbstractUIThreadManager() |
Modifier and Type | Method and Description |
---|---|
protected ExceptionHandler |
getExceptionHandler() |
protected ExecutorService |
getExecutorService() |
protected ExecutorServiceManager |
getExecutorServiceManager() |
<R> Future<R> |
runFuture(Callable<R> callable)
Executes a code block as a Future on an ExecutorService.
|
<R> Future<R> |
runFuture(ExecutorService executorService,
Callable<R> callable)
Executes a code block as a Future on an ExecutorService.
|
<R> R |
runInsideUISync(Callable<R> callable)
Executes a code block synchronously on the UI thread.
|
void |
runOutsideUI(Runnable runnable)
Executes a code block outside of the UI thread.
|
void |
runOutsideUIAsync(Runnable runnable)
Executes a code block on a background thread, always.
|
void |
setExecutorServiceManager(ExecutorServiceManager executorServiceManager) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isUIThread, runInsideUIAsync, runInsideUISync
protected static final String ERROR_RUNNABLE_NULL
protected static final String ERROR_CALLABLE_NULL
@Inject public void setExecutorServiceManager(@Nonnull ExecutorServiceManager executorServiceManager)
@Nonnull public <R> Future<R> runFuture(@Nonnull Callable<R> callable)
runFuture
in interface ThreadingHandler
callable
- a code block to be executed@Nonnull public <R> Future<R> runFuture(@Nonnull ExecutorService executorService, @Nonnull Callable<R> callable)
runFuture
in interface ThreadingHandler
executorService
- the ExecutorService to use. Will use the default ExecutorService if null.callable
- a code block to be executedpublic void runOutsideUI(@Nonnull Runnable runnable)
ThreadingHandler
runOutsideUI
in interface ThreadingHandler
public void runOutsideUIAsync(@Nonnull Runnable runnable)
ThreadingHandler
runOutsideUIAsync
in interface ThreadingHandler
@Nullable public <R> R runInsideUISync(@Nonnull Callable<R> callable)
ThreadingHandler
runInsideUISync
in interface ThreadingHandler
@Nonnull protected ExecutorServiceManager getExecutorServiceManager()
@Nonnull protected ExecutorService getExecutorService()
@Nonnull protected ExceptionHandler getExceptionHandler()