Class AbstractRunnable

java.lang.Object
org.opensearch.common.util.concurrent.AbstractRunnable
All Implemented Interfaces:
Runnable
Direct Known Subclasses:
AbstractLifecycleRunnable, ActionRunnable, Scheduler.ReschedulingRunnable, TaskAwareRunnable

public abstract class AbstractRunnable extends Object implements Runnable
An extension to runnable.
Opensearch.internal:
  • Constructor Details

    • AbstractRunnable

      public AbstractRunnable()
  • Method Details

    • isForceExecution

      public boolean isForceExecution()
      Should the runnable force its execution in case it gets rejected?
    • run

      public final void run()
      Specified by:
      run in interface Runnable
    • onAfter

      public void onAfter()
      This method is called in a finally block after successful execution or on a rejection.
    • onFailure

      public abstract void onFailure(Exception e)
      This method is invoked for all exception thrown by doRun()
    • onRejection

      public void onRejection(Exception e)
      This should be executed if the thread-pool executing this action rejected the execution. The default implementation forwards to onFailure(Exception)
    • doRun

      protected abstract void doRun() throws Exception
      This method has the same semantics as Runnable.run()
      Throws:
      InterruptedException - if the run method throws an InterruptedException
      Exception