Interface SynchronousExecutor

All Known Subinterfaces:
FactoryOfTheFuture
All Known Implementing Classes:
AbstractFactoryOfTheFuture, IndifferentFactoryOfTheFuture

public interface SynchronousExecutor
Similar to 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 Type
    Method
    Description
    void
    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 as ForkJoinPool.commonPool()
  • Method Details

    • executeSync

      void executeSync(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 as ForkJoinPool.commonPool()
      Parameters:
      command - the runnable to run synchronously with the main thread
      Throws:
      NullPointerException - if command is null