Class AbstractDelegateFunctionState
- java.lang.Object
-
- net.officefloor.frame.impl.execute.linkedlistset.AbstractLinkedListSetEntry<FunctionState,Flow>
-
- net.officefloor.frame.impl.execute.function.AbstractDelegateFunctionState
-
- All Implemented Interfaces:
FunctionState
,LinkedListSetEntry<FunctionState,Flow>
- Direct Known Subclasses:
LinkedListSetPromise
public class AbstractDelegateFunctionState extends AbstractLinkedListSetEntry<FunctionState,Flow> implements FunctionState
AbstractFunctionState
that delegates functionality to a delegateFunctionState
.- Author:
- Daniel Sagenschneider
-
-
Field Summary
Fields Modifier and Type Field Description protected FunctionState
delegate
DelegateFunctionState
.
-
Constructor Summary
Constructors Constructor Description AbstractDelegateFunctionState(FunctionState delegate)
Instantiate.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FunctionState
cancel()
FunctionState
execute(FunctionStateContext context)
Executes theFunctionState
.Flow
getLinkedListSetOwner()
Obtains the owner of theLinkedListSet
that thisLinkedListSetEntry
may be added.TeamManagement
getResponsibleTeam()
Obtains theTeamManagement
responsible for thisFunctionState
.ThreadState
getThreadState()
Obtains theThreadState
for thisFunctionState
.FunctionState
handleEscalation(java.lang.Throwable escalation, EscalationCompletion completion)
HandlesEscalation
from theManagedFunction
.boolean
isRequireThreadStateSafety()
Indicates if theFunctionState
requiresThreadState
safety.java.lang.String
toString()
-
Methods inherited from class net.officefloor.frame.impl.execute.linkedlistset.AbstractLinkedListSetEntry
getNext, getPrev, setNext, setPrev
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.officefloor.frame.internal.structure.LinkedListSetEntry
getNext, getPrev, setNext, setPrev
-
-
-
-
Field Detail
-
delegate
protected final FunctionState delegate
DelegateFunctionState
.
-
-
Constructor Detail
-
AbstractDelegateFunctionState
public AbstractDelegateFunctionState(FunctionState delegate)
Instantiate.- Parameters:
delegate
- DelegateFunctionState
.
-
-
Method Detail
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getLinkedListSetOwner
public Flow getLinkedListSetOwner()
Description copied from interface:LinkedListSetEntry
Obtains the owner of the
LinkedListSet
that thisLinkedListSetEntry
may be added.LinkedListSetEntry
instances may only be added to theLinkedListSet
they were intended for and can not be shared betweenLinkedListSet
instances. This constraint:- ensures the integrity of the
FunctionState
,Flow
,ThreadState
,ProcessState
structure, and - improves uniqueness performance as
LinkedListSetEntry.getNext()
andLinkedListSetEntry.getPrev()
both returningnull
indicates not added
- Specified by:
getLinkedListSetOwner
in interfaceFunctionState
- Specified by:
getLinkedListSetOwner
in interfaceLinkedListSetEntry<FunctionState,Flow>
- Returns:
- Owner of the
LinkedListSet
that may contain thisLinkedListSetEntry
.
- ensures the integrity of the
-
getResponsibleTeam
public TeamManagement getResponsibleTeam()
Description copied from interface:FunctionState
Obtains the
TeamManagement
responsible for thisFunctionState
.By default,
FunctionState
may be executed by anyTeamManagement
.- Specified by:
getResponsibleTeam
in interfaceFunctionState
- Returns:
TeamManagement
responsible for thisFunctionState
. May benull
to indicate anyTeam
may execute theFunctionState
.
-
getThreadState
public ThreadState getThreadState()
Description copied from interface:FunctionState
Obtains the
ThreadState
for thisFunctionState
.This provides access to the
ThreadState
that thisFunctionState
resides within.- Specified by:
getThreadState
in interfaceFunctionState
- Returns:
ThreadState
for thisFunctionState
.
-
isRequireThreadStateSafety
public boolean isRequireThreadStateSafety()
Description copied from interface:FunctionState
Indicates if theFunctionState
requiresThreadState
safety.- Specified by:
isRequireThreadStateSafety
in interfaceFunctionState
- Returns:
true
shouldFunctionState
requireThreadState
safety.
-
execute
public FunctionState execute(FunctionStateContext context) throws java.lang.Throwable
Description copied from interface:FunctionState
Executes theFunctionState
.- Specified by:
execute
in interfaceFunctionState
- Parameters:
context
-FunctionStateContext
for executing theFunctionState
.- Returns:
- Next
FunctionState
to be executed. May benull
to indicate no furtherFunctionState
instances to execute. - Throws:
java.lang.Throwable
- Possible failure ofFunctionState
logic.
-
cancel
public FunctionState cancel()
Description copied from interface:FunctionState
- Specified by:
cancel
in interfaceFunctionState
- Returns:
- Optional clean up
FunctionState
. May benull
.
-
handleEscalation
public FunctionState handleEscalation(java.lang.Throwable escalation, EscalationCompletion completion)
Description copied from interface:FunctionState
HandlesEscalation
from theManagedFunction
.- Specified by:
handleEscalation
in interfaceFunctionState
- Parameters:
escalation
-Escalation
.completion
- OptionalEscalationCompletion
to be notified onceEscalation
has been handled.- Returns:
- Optional
FunctionState
to handle theEscalation
.
-
-