Package org.apache.wayang.core.util
Class OneTimeExecutable
java.lang.Object
org.apache.wayang.core.util.OneTimeExecutable
- Direct Known Subclasses:
Job,LoopEnumerator,LoopIsolator,PushExecutorTemplate.StageExecution,StageAssignmentTraversal
Method wrapper that ensures that it is called only once.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidPerforms the actual work of this instance.protected voidexecute()InvokedoExecute().protected booleanInvokedoExecute()unless it has been executed already.
-
Constructor Details
-
OneTimeExecutable
public OneTimeExecutable()
-
-
Method Details
-
tryExecute
protected boolean tryExecute()InvokedoExecute()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
InvokedoExecute(). Also, ensure that it will not be invoked a second time.- Throws:
IllegalStateException- ifdoExecute()has been already invoked
-
doExecute
protected abstract void doExecute()Performs the actual work of this instance. Should only be invoked viaexecute()andtryExecute().
-