Interface Executive
-
- All Known Implementing Classes:
DefaultExecutive,GoogleAppEngineExecutive,WebThreadAffinityExecutive
public interface ExecutiveExecutive.- Author:
- Daniel Sagenschneider
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description java.util.concurrent.ExecutorcreateExecutor(ProcessIdentifier processIdentifier)Creates anExecutorthat MUST execute theRunnablein a differentThreadto the caller.default ProcessIdentifiercreateProcessIdentifier(ExecutiveOfficeContext officeContext)Creates a newProcessIdentifier.default java.lang.ThreadcreateThread(java.lang.String threadName, java.lang.ThreadGroup threadGroup, java.lang.Runnable runnable)Creates aThread.ExecutionStrategy[]getExcutionStrategies()Obtains theExecutionStrategystrategies.default OfficeManagergetOfficeManager(ProcessIdentifier processIdentifier, OfficeManager defaultOfficeManager)Obtains theOfficeManagerfor theProcessState.default TeamOversightgetTeamOversight()Obtains theTeamOversight.default <T extends java.lang.Throwable>
ProcessManagermanageExecution(Execution<T> execution)Manages theExecution.default voidprocessComplete(ProcessIdentifier processIdentifier)Invokes to notify theProcessStateidentified by theProcessIdentifieris complete.voidschedule(ProcessIdentifier processIdentifier, long delay, java.lang.Runnable runnable)Schedules theRunnableto execute so many milliseconds in the future.voidstartManaging(ExecutiveStartContext context)Starts managing theOfficeFloor.voidstopManaging()Stops managing theOfficeFloor.
-
-
-
Method Detail
-
createThread
default java.lang.Thread createThread(java.lang.String threadName, java.lang.ThreadGroup threadGroup, java.lang.Runnable runnable)Creates aThread.- Returns:
- New
Thread.
-
getExcutionStrategies
ExecutionStrategy[] getExcutionStrategies()
Obtains theExecutionStrategystrategies.- Returns:
ExecutionStrategyinstances.
-
getTeamOversight
default TeamOversight getTeamOversight()
Obtains theTeamOversight.- Returns:
TeamOversight.
-
startManaging
void startManaging(ExecutiveStartContext context) throws java.lang.Exception
Starts managing theOfficeFloor.- Parameters:
context-ExecutiveStartContext.- Throws:
java.lang.Exception- If fails to start managing.
-
manageExecution
default <T extends java.lang.Throwable> ProcessManager manageExecution(Execution<T> execution) throws T extends java.lang.Throwable
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.T extends java.lang.Throwable
-
createProcessIdentifier
default ProcessIdentifier createProcessIdentifier(ExecutiveOfficeContext officeContext)
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
java.util.concurrent.Executor createExecutor(ProcessIdentifier processIdentifier)
Creates an
Executorthat MUST execute 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
void schedule(ProcessIdentifier processIdentifier, long delay, java.lang.Runnable runnable)
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
default void processComplete(ProcessIdentifier processIdentifier)
Invokes to notify theProcessStateidentified by theProcessIdentifieris complete.- Parameters:
processIdentifier-ProcessIdentifierof the completeProcessState.
-
stopManaging
void stopManaging() throws java.lang.ExceptionStops managing theOfficeFloor.- Throws:
java.lang.Exception- If fails to stop managing.
-
-