Class ManagedFunctionContainerImpl<M extends ManagedFunctionLogicMetaData>
- java.lang.Object
-
- net.officefloor.frame.impl.execute.linkedlistset.AbstractLinkedListSetEntry<FunctionState,Flow>
-
- net.officefloor.frame.impl.execute.function.ManagedFunctionContainerImpl<M>
-
- All Implemented Interfaces:
BlockState
,FunctionState
,LinkedListSetEntry<FunctionState,Flow>
,ManagedFunctionContainer
public class ManagedFunctionContainerImpl<M extends ManagedFunctionLogicMetaData> extends AbstractLinkedListSetEntry<FunctionState,Flow> implements ManagedFunctionContainer
FunctionState
to execute aManagedFunctionLogic
.- Author:
- Daniel Sagenschneider
-
-
Constructor Summary
Constructors Constructor Description ManagedFunctionContainerImpl(FunctionState setupFunction, ManagedFunctionLogic managedFunctionLogic, ManagedFunctionBoundManagedObjects boundManagedObjects, ManagedObjectIndex[] requiredManagedObjects, boolean[] requiredGovernance, boolean isEnforceGovernance, M functionLogicMetaData, BlockState parallelOwner, Flow flow, boolean isUnloadManagedObjects)
Initiate.
-
Method Summary
-
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.BlockState
getNextBlockToExecute, getParallelBlockToExecute, loadParallelBlock, loadSequentialBlock
-
Methods inherited from interface net.officefloor.frame.internal.structure.LinkedListSetEntry
getNext, getPrev, setNext, setPrev
-
-
-
-
Constructor Detail
-
ManagedFunctionContainerImpl
public ManagedFunctionContainerImpl(FunctionState setupFunction, ManagedFunctionLogic managedFunctionLogic, ManagedFunctionBoundManagedObjects boundManagedObjects, ManagedObjectIndex[] requiredManagedObjects, boolean[] requiredGovernance, boolean isEnforceGovernance, M functionLogicMetaData, BlockState parallelOwner, Flow flow, boolean isUnloadManagedObjects)
Initiate.- Parameters:
setupFunction
- OptionalFunctionState
to be executed to setup thisManagedObjectContainer
. May benull
.managedFunctionLogic
-ManagedFunctionLogic
to be executed by thisManagedFunctionContainer
.boundManagedObjects
-ManagedFunctionBoundManagedObjects
containing theManagedObjectContainer
instances for theManagedObject
instances bound to theManagedFunction
.requiredManagedObjects
-ManagedObjectIndex
instances to theManagedObject
instances that must be loaded before theManagedFunction
may be executed.requiredGovernance
- Identifies the required activation state of theGovernance
for thisManagedFunction
.isEnforceGovernance
-true
to enforceGovernance
on deactivation.false
to disregardGovernance
on deactivation.functionLogicMetaData
-ManagedFunctionLogicMetaData
for this node.parallelOwner
- Parallel owner of thisManagedFunctionContainer
. May benull
if no owner.flow
-Flow
containing thisManagedFunctionContainer
.isUnloadManagedObjects
- Indicates whether thisManagedObjectContainer
is responsible for unloading theManagedObject
instances.
-
-
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
-
setParallelOwner
public void setParallelOwner(BlockState parallelOwner)
Description copied from interface:BlockState
Specifies the parallel owningBlockState
.- Specified by:
setParallelOwner
in interfaceBlockState
- Parameters:
parallelOwner
- Parallel owningBlockState
.
-
getParallelOwner
public BlockState getParallelOwner()
Description copied from interface:BlockState
Obtains the parallel ownerBlockState
.- Specified by:
getParallelOwner
in interfaceBlockState
- Returns:
- Parallel owner
BlockState
.
-
setParallelBlock
public void setParallelBlock(BlockState parallelBlock)
Description copied from interface:BlockState
Specifies the parallelBlockState
.- Specified by:
setParallelBlock
in interfaceBlockState
- Parameters:
parallelBlock
- ParallelBlockState
.
-
getParallelBlock
public BlockState getParallelBlock()
Description copied from interface:BlockState
Obtains the parallelBlockState
.- Specified by:
getParallelBlock
in interfaceBlockState
- Returns:
- Parallel
BlockState
.
-
setSequentialBlock
public void setSequentialBlock(BlockState sequentialBlock)
Description copied from interface:BlockState
Specifies the sequentialBlockState
.- Specified by:
setSequentialBlock
in interfaceBlockState
- Parameters:
sequentialBlock
- SequentialBlockState
.
-
getSequentialBlock
public BlockState getSequentialBlock()
Description copied from interface:BlockState
Obtains the sequentialBlockState
.- Specified by:
getSequentialBlock
in interfaceBlockState
- Returns:
- Sequential
BlockState
.
-
getFlow
public Flow getFlow()
Description copied from interface:ManagedFunctionContainer
Obtains theFlow
containing thisManagedObjectContainer
.- Specified by:
getFlow
in interfaceManagedFunctionContainer
- Returns:
Flow
containing thisManagedObjectContainer
.
-
getManagedObjectContainer
public ManagedObjectContainer getManagedObjectContainer(int index)
Description copied from interface:ManagedFunctionContainer
Obtains theManagedObjectContainer
bound to thisManagedFunctionContainer
.- Specified by:
getManagedObjectContainer
in interfaceManagedFunctionContainer
- Parameters:
index
- Index of theManagedObjectContainer
.- Returns:
ManagedObjectContainer
bound to thisManagedFunctionContainer
.
-
createInterest
public ManagedFunctionInterest createInterest()
Description copied from interface:ManagedFunctionContainer
Creates a
ManagedFunctionInterest
in thisManagedFunctionContainer
.The
ManagedFunctionContainer
will not unload itsManagedFunction
boundManagedObject
instances until all registeredManagedFunctionInterest
instances have been unregistered.- Specified by:
createInterest
in interfaceManagedFunctionContainer
- Returns:
- New
ManagedFunctionInterest
in thisManagedFunctionContainer
.
-
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.
-
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
.
-
cancel
public FunctionState cancel()
Description copied from interface:FunctionState
- Specified by:
cancel
in interfaceFunctionState
- Returns:
- Optional clean up
FunctionState
. May benull
.
-
-