public abstract class AbstractUIThreadManager extends java.lang.Object implements UIThreadManager
Modifier and Type | Field and Description |
---|---|
protected static java.lang.String |
ERROR_CALLABLE_NULL |
protected static java.lang.String |
ERROR_RUNNABLE_NULL |
Constructor and Description |
---|
AbstractUIThreadManager() |
Modifier and Type | Method and Description |
---|---|
protected ExceptionHandler |
getExceptionHandler() |
protected java.util.concurrent.ExecutorService |
getExecutorService() |
protected ExecutorServiceManager |
getExecutorServiceManager() |
<R> java.util.concurrent.Future<R> |
runFuture(java.util.concurrent.Callable<R> callable)
Executes a code block as a Future on an ExecutorService.
|
<R> java.util.concurrent.Future<R> |
runFuture(java.util.concurrent.ExecutorService executorService,
java.util.concurrent.Callable<R> callable)
Executes a code block as a Future on an ExecutorService.
|
<R> R |
runInsideUISync(java.util.concurrent.Callable<R> callable)
Executes a code block synchronously on the UI thread.
|
void |
runOutsideUI(java.lang.Runnable runnable)
Executes a code block outside of the UI thread.
|
void |
runOutsideUIAsync(java.lang.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 java.lang.String ERROR_RUNNABLE_NULL
protected static final java.lang.String ERROR_CALLABLE_NULL
@Inject public void setExecutorServiceManager(@Nonnull ExecutorServiceManager executorServiceManager)
@Nonnull public <R> java.util.concurrent.Future<R> runFuture(@Nonnull java.util.concurrent.Callable<R> callable)
runFuture
in interface ThreadingHandler
callable
- a code block to be executed@Nonnull public <R> java.util.concurrent.Future<R> runFuture(@Nonnull java.util.concurrent.ExecutorService executorService, @Nonnull java.util.concurrent.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 java.lang.Runnable runnable)
ThreadingHandler
runOutsideUI
in interface ThreadingHandler
public void runOutsideUIAsync(@Nonnull java.lang.Runnable runnable)
ThreadingHandler
runOutsideUIAsync
in interface ThreadingHandler
@Nullable public <R> R runInsideUISync(@Nonnull java.util.concurrent.Callable<R> callable)
ThreadingHandler
runInsideUISync
in interface ThreadingHandler
@Nonnull protected ExecutorServiceManager getExecutorServiceManager()
@Nonnull protected java.util.concurrent.ExecutorService getExecutorService()
@Nonnull protected ExceptionHandler getExceptionHandler()