- All Known Implementing Classes:
SwingDispatcher
public interface Dispatcher
Resolves the platform's UI thread, for running ProgressWorker handlers and for
determining whether a model refresh should run asynchronously.
The implementation is provided via ServiceLoader, defaulting to SYNCHRONOUS
same-thread dispatch when no implementation is available.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final DispatcherA synchronousDispatcher, running tasks on the calling thread and reporting no UI thread. -
Method Summary
Modifier and TypeMethodDescriptionexecutor()Returns anExecutorrunning tasks on the UI thread, resolved for the current context.static Dispatcherinstance()Returns theDispatcherimplementation, as provided viaServiceLoader, orSYNCHRONOUSin case no implementation is available.boolean
-
Field Details
-
SYNCHRONOUS
A synchronousDispatcher, running tasks on the calling thread and reporting no UI thread.Used when no implementation is available, and useful for testing.
-
-
Method Details
-
executor
Executor executor()Returns an
Executorrunning tasks on the UI thread, resolved for the current context.Called when a
ProgressWorkeris executed, on the UI thread, so that context sensitive implementations, such as web frameworks providing a per-session UI thread, can bind to the current context.- Returns:
- an
Executorrunning tasks on the UI thread
-
isUserInterfaceThread
boolean isUserInterfaceThread()- Returns:
- true if the calling thread is the UI thread
-
instance
Returns theDispatcherimplementation, as provided viaServiceLoader, orSYNCHRONOUSin case no implementation is available.- Returns:
- the
Dispatcherimplementation to use
-