Class PausableFutureStepWork

  • All Implemented Interfaces:
    java.util.function.Consumer<StepController>

    public class PausableFutureStepWork
    extends java.lang.Object
    implements java.util.function.Consumer<StepController>
    A helper class to be used with StepContext.execute, takes a CompletableFuture, and will block step progression until the future has completed. However, the work can also be "paused", in which case the step is allowed to exit. This is commonly used for step pause, and then the same object is re-submitted to the StepContext upon resume.

    Additionally, a runnable can be passed in that will be called each time the work exits (on completion, and on pause).

    • Constructor Summary

      Constructors 
      Constructor Description
      PausableFutureStepWork​(java.util.concurrent.CompletableFuture<?> chartFuture)  
      PausableFutureStepWork​(java.util.concurrent.CompletableFuture<?> chartFuture, java.lang.Runnable exitTask)
      Blocks until the provided future is complete, unless paused.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void accept​(StepController controller)  
      void finish()  
      void pause()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.function.Consumer

        andThen
    • Constructor Detail

      • PausableFutureStepWork

        public PausableFutureStepWork​(java.util.concurrent.CompletableFuture<?> chartFuture)
      • PausableFutureStepWork

        public PausableFutureStepWork​(java.util.concurrent.CompletableFuture<?> chartFuture,
                                      java.lang.Runnable exitTask)
        Blocks until the provided future is complete, unless paused. If exitTask is not null, each time the work exits (pause or completion), the function will be called.
    • Method Detail

      • finish

        public void finish()
      • pause

        public void pause()
      • accept

        public void accept​(StepController controller)
        Specified by:
        accept in interface java.util.function.Consumer<StepController>