Interface ObjectRunnable<O1,O2>

Type Parameters:
O1 - The type of objects for which runnables are registered.
O2 - The type of objects with which runnables are managed and executed within an object-specific executor service.
All Superinterfaces:
ManagedRunnable, Runnable
All Known Implementing Classes:
AbstractObjectRunnable, ObjectOneWorkRunnable, PipelineRunnable, ScheduledObjectOneWorkRunnable

public interface ObjectRunnable<O1,O2> extends ManagedRunnable
This interface represents a runnable that is identified via a specific object. This object may be mapped to an index object used within an object-specific executor service. For instance, by mapping different objects to the same index object, the amount of different objects handled by an objects-specific executor service may be restricted.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Awaits the termination of this runnable.
    Gets the object with which this runnable is managed and executed within an object-specific executor service.
    Gets the object with which this runnable has been registered at an object-specific executor service.

    Methods inherited from interface de.aristaflow.adept2.util.threading.executor.ManagedRunnable

    rejected, submitted

    Methods inherited from interface java.lang.Runnable

    run
  • Method Details

    • getRegisteredObject

      O1 getRegisteredObject()
      Gets the object with which this runnable has been registered at an object-specific executor service.
      Returns:
      The object with which this runnable has been registered at an object-specific executor service.
    • getIndexObject

      O2 getIndexObject()
      Gets the object with which this runnable is managed and executed within an object-specific executor service.
      Returns:
      The object with which this runnable is managed and executed within an object-specific executor service.
    • awaitTermination

      void awaitTermination() throws InterruptedException
      Awaits the termination of this runnable. Either the thread has been interrupted, its termination has been requested or the runnable has simply finished. If this runnable is neither being executed nor submitted for execution, this method returns immediately. An execution which has been submitted, that is, handed to a pool, but has not started yet is awaited as well: it executes the work of its object as soon as it starts, so a flush awaiting the termination runs its task only after the pending work and no work runs concurrently to this task.
      A runnable may be executed again, e. g. when restarting after a flush. This method awaits the termination of the current and the submitted executions then, a previous termination does not count.
      Throws:
      InterruptedException - If the waiting thread is interrupted while waiting for this runnable to terminate, an InterruptedException will be thrown.