Interface Executive
- All Known Implementing Classes:
DefaultExecutive,WebThreadAffinityExecutive
public interface Executive
Executive.
- Author:
- Daniel Sagenschneider
-
Method Summary
Modifier and TypeMethodDescriptioncreateExecutor(ProcessIdentifier processIdentifier) default ProcessIdentifiercreateProcessIdentifier(ExecutiveOfficeContext officeContext) Creates a newProcessIdentifier.default ThreadcreateThread(String threadName, ThreadGroup threadGroup, Runnable runnable) Creates aThread.Obtains theExecutionStrategystrategies.default OfficeManagergetOfficeManager(ProcessIdentifier processIdentifier, OfficeManager defaultOfficeManager) Obtains theOfficeManagerfor theProcessState.default TeamOversightObtains theTeamOversight.default <T extends Throwable>
ProcessManagermanageExecution(Execution<T> execution) Manages theExecution.default voidprocessComplete(ProcessIdentifier processIdentifier) Invokes to notify theProcessStateidentified by theProcessIdentifieris complete.voidschedule(ProcessIdentifier processIdentifier, long delay, Runnable runnable) Schedules theRunnableto execute so many milliseconds in the future.voidstartManaging(ExecutiveStartContext context) Starts managing theOfficeFloor.voidStops managing theOfficeFloor.
-
Method Details
-
createThread
Creates aThread. -
getExcutionStrategies
ExecutionStrategy[] getExcutionStrategies()Obtains theExecutionStrategystrategies.- Returns:
ExecutionStrategyinstances.
-
getTeamOversight
Obtains theTeamOversight.- Returns:
TeamOversight.
-
startManaging
Starts managing theOfficeFloor.- Parameters:
context-ExecutiveStartContext.- Throws:
Exception- If fails to start managing.
-
manageExecution
Manages the
Execution.The
Thread.currentThread()will provide the inboundThread.- Type Parameters:
T- Type ofThrowablethrown.- Parameters:
execution-Executionto be undertaken.- Returns:
ProcessManagerfor theProcessState.- Throws:
T- Propagation of failure fromExecution.
-
createProcessIdentifier
Creates a newProcessIdentifier.- Parameters:
officeContext-ExecutiveOfficeContext.- Returns:
- New
ProcessIdentifier.
-
getOfficeManager
default OfficeManager getOfficeManager(ProcessIdentifier processIdentifier, OfficeManager defaultOfficeManager) Obtains theOfficeManagerfor theProcessState.- Parameters:
processIdentifier-ProcessIdentifiercreated by thisExecutivefor theProcessState.defaultOfficeManager- DefaultOfficeManager.- Returns:
OfficeManagerfor theProcessState.
-
createExecutor
Creates an
ExecutorthatMUSTexecute theRunnablein a differentThreadto the caller.This is used in various places within
OfficeFloor:- By
ManagedFunctionin executingRunnablein anotherThread - To avoid stack over flow issues, the stack call chain is broken by
invoking further
FunctionStatedelegation in anotherThread. This allows further depth to a thread stack than offered by a singleThread.
- Parameters:
processIdentifier-ProcessIdentifierofProcessStaterequiring theExecutor.- Returns:
Executorthat will executeRunnableinstances in a differentThreadto caller.
- By
-
schedule
Schedules the
Runnableto execute so many milliseconds in the future.Note that the
Executivemay determine theProcessStatecomplete and not execute theRunnable.- Parameters:
processIdentifier-ProcessIdentifierof theProcessStaterequiring the scheduled execution.delay- Delay in milliseconds to execute theRunnable.runnable-Runnableto execute.
-
processComplete
Invokes to notify theProcessStateidentified by theProcessIdentifieris complete.- Parameters:
processIdentifier-ProcessIdentifierof the completeProcessState.
-
stopManaging
Stops managing theOfficeFloor.- Throws:
Exception- If fails to stop managing.
-