Class OneTimeExecutable

java.lang.Object
org.apache.wayang.core.util.OneTimeExecutable
Direct Known Subclasses:
Job, LoopEnumerator, LoopIsolator, PushExecutorTemplate.StageExecution, StageAssignmentTraversal

public abstract class OneTimeExecutable extends Object
Method wrapper that ensures that it is called only once.
  • Constructor Details

    • OneTimeExecutable

      public OneTimeExecutable()
  • Method Details

    • tryExecute

      protected boolean tryExecute()
      Invoke doExecute() unless it has been executed already. Also, ensure that it will not be invoked a second time.
      Returns:
      whether the method invocation resulted in invoking doExecute()
    • execute

      protected void execute() throws IllegalStateException
      Invoke doExecute(). Also, ensure that it will not be invoked a second time.
      Throws:
      IllegalStateException - if doExecute() has been already invoked
    • doExecute

      protected abstract void doExecute()
      Performs the actual work of this instance. Should only be invoked via execute() and tryExecute().