Class GenericUpdateTaskExecutor

java.lang.Object
org.jtrim2.executor.GenericUpdateTaskExecutor
All Implemented Interfaces:
UpdateTaskExecutor

public final class GenericUpdateTaskExecutor extends Object implements UpdateTaskExecutor
An UpdateTaskExecutor implementation which forwards tasks scheduled to it to a given Executor or TaskExecutor.

Thread safety

The methods of this class are safe to use by multiple threads concurrently as required by UpdateTaskExecutor.

Synchronization transparency

The methods of this interface are not synchronization transparent.
  • Constructor Details

    • GenericUpdateTaskExecutor

      public GenericUpdateTaskExecutor(Executor taskExecutor)
      Creates a new GenericUpdateTaskExecutor which will forward its tasks to the given TaskExecutor.
      Parameters:
      taskExecutor - the executor to which tasks will be forwarded to. This argument cannot be null.
      Throws:
      NullPointerException - thrown if the specified executor is null.
  • Method Details

    • execute

      public void execute(Runnable task)
      Submits a task which is to be executed in the future. This task may cause previously submitted tasks to be discarded an never run. Therefore the currently submitted task may get discarded by a subsequent execute call.

      Implementation note: Note that this method will not forward the specified task to the underlying executor but a different one which will execute this task.

      Specified by:
      execute in interface UpdateTaskExecutor
      Parameters:
      task - the task to be executed. This argument cannot be null.
    • toString

      public String toString()
      Returns the string representation of this executor in no particular format.

      This method is intended to be used for debugging only.

      Overrides:
      toString in class Object
      Returns:
      the string representation of this object in no particular format. This method never returns null.