Class TimeoutGuardTask

java.lang.Object
org.hawaiiframework.async.HawaiiAsyncRunnable
org.hawaiiframework.async.timeout.TimeoutGuardTask
All Implemented Interfaces:
Runnable

public class TimeoutGuardTask extends HawaiiAsyncRunnable
Task that stops another scheduled task if the scheduled task's timeout has been reached.

We first try to remove the scheduled task from the executor, so it will not be executed. If this fails we will try to abort the scheduled tasks.

For this the guarded task must register it's TaskAbortStrategy in the SharedTaskContext.

Since:
2.0.0
  • Constructor Details

    • TimeoutGuardTask

      public TimeoutGuardTask(SharedTaskContext sharedTaskContext)
      Create a new TimeoutGuardTask instance with the given taskExecutor.
      Parameters:
      sharedTaskContext - The context to share, contains
  • Method Details

    • doRun

      protected void doRun()
      Description copied from class: HawaiiAsyncRunnable
      This method is executed by Runnable run. Run executes all administrative calls. Code specified in this method will be executed in between those calls.
      Specified by:
      doRun in class HawaiiAsyncRunnable