Interface SynchronousExecutor
- All Known Subinterfaces:
FactoryOfTheFuture
- All Known Implementing Classes:
AbstractFactoryOfTheFuture, IndifferentFactoryOfTheFuture
public interface SynchronousExecutor
Similar to
According to the concept of a main thread, an application has a main thread if it has a single thread which is responsible for the majority of work done, in terms of necessary CPU resources.
For applications without a main thread, this interface, if used at all, should behave as if scheduling computational work deemed suitable for
Executor, in that it accepts and runs Runnables. However,
instead of executing in an arbitrary thread, the Runnable must run on the
application's main thread if it has a main thread. According to the concept of a main thread, an application has a main thread if it has a single thread which is responsible for the majority of work done, in terms of necessary CPU resources.
For applications without a main thread, this interface, if used at all, should behave as if scheduling computational work deemed suitable for
ForkJoinPool.commonPool().- Author:
- A248
-
Method Summary
Modifier and TypeMethodDescriptionvoidexecuteSync(Runnable command) Runs the Runnable on the main thread, if the application has a main thread, else executes it in a thread pool suitable for computational work such asForkJoinPool.commonPool()
-
Method Details
-
executeSync
Runs the Runnable on the main thread, if the application has a main thread, else executes it in a thread pool suitable for computational work such asForkJoinPool.commonPool()- Parameters:
command- the runnable to run synchronously with the main thread- Throws:
NullPointerException- ifcommandis null
-