Class GoogleAppEngineExecutive
- java.lang.Object
-
- net.officefloor.frame.api.executive.source.impl.AbstractExecutiveSource
-
- net.officefloor.server.appengine.GoogleAppEngineExecutive
-
- All Implemented Interfaces:
ExecutionStrategy,Executive,ExecutiveSource,TeamOversight
public class GoogleAppEngineExecutive extends AbstractExecutiveSource implements Executive, ExecutionStrategy, TeamOversight
Executivefor Google AppEngine.- Author:
- Daniel Sagenschneider
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class net.officefloor.frame.api.executive.source.impl.AbstractExecutiveSource
AbstractExecutiveSource.SpecificationContext
-
-
Constructor Summary
Constructors Constructor Description GoogleAppEngineExecutive()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ExecutivecreateExecutive(ExecutiveSourceContext context)Creates theExecutive.java.util.concurrent.ExecutorcreateExecutor(ProcessIdentifier processIdentifier)Creates anExecutorthat MUST execute theRunnablein a differentThreadto the caller.ProcessIdentifiercreateProcessIdentifier(ExecutiveOfficeContext officeContext)Creates a newProcessIdentifier.TeamcreateTeam(ExecutiveContext context)Creates theTeam.java.lang.ThreadcreateThread(java.lang.String threadName, java.lang.ThreadGroup threadGroup, java.lang.Runnable runnable)Creates aThread.ExecutionStrategy[]getExcutionStrategies()Obtains theExecutionStrategystrategies.java.lang.StringgetExecutionStrategyName()Obtains the name of theExecutionStrategy.OfficeManagergetOfficeManager(ProcessIdentifier processIdentifier, OfficeManager defaultOfficeManager)Obtains theOfficeManagerfor theProcessState.TeamOversightgetTeamOversight()Obtains theTeamOversight.java.util.concurrent.ThreadFactory[]getThreadFactories()protected voidloadSpecification(AbstractExecutiveSource.SpecificationContext context)Overridden to load specification.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.-
Methods inherited from class net.officefloor.frame.api.executive.source.impl.AbstractExecutiveSource
getSpecification
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.officefloor.frame.api.executive.Executive
manageExecution
-
-
-
-
Method Detail
-
loadSpecification
protected void loadSpecification(AbstractExecutiveSource.SpecificationContext context)
Description copied from class:AbstractExecutiveSourceOverridden to load specification.- Specified by:
loadSpecificationin classAbstractExecutiveSource- Parameters:
context-AbstractExecutiveSource.SpecificationContext.
-
createExecutive
public Executive createExecutive(ExecutiveSourceContext context) throws java.lang.Exception
Description copied from interface:ExecutiveSourceCreates theExecutive.- Specified by:
createExecutivein interfaceExecutiveSource- Parameters:
context-ExecutiveSourceContext.- Returns:
Executive.- Throws:
java.lang.Exception- If fails to configure theExecutiveSource.
-
createThread
public java.lang.Thread createThread(java.lang.String threadName, java.lang.ThreadGroup threadGroup, java.lang.Runnable runnable)Description copied from interface:ExecutiveCreates aThread.- Specified by:
createThreadin interfaceExecutive- Returns:
- New
Thread.
-
getExcutionStrategies
public ExecutionStrategy[] getExcutionStrategies()
Description copied from interface:ExecutiveObtains theExecutionStrategystrategies.- Specified by:
getExcutionStrategiesin interfaceExecutive- Returns:
ExecutionStrategyinstances.
-
getTeamOversight
public TeamOversight getTeamOversight()
Description copied from interface:ExecutiveObtains theTeamOversight.- Specified by:
getTeamOversightin interfaceExecutive- Returns:
TeamOversight.
-
startManaging
public void startManaging(ExecutiveStartContext context) throws java.lang.Exception
Description copied from interface:ExecutiveStarts managing theOfficeFloor.- Specified by:
startManagingin interfaceExecutive- Parameters:
context-ExecutiveStartContext.- Throws:
java.lang.Exception- If fails to start managing.
-
createProcessIdentifier
public ProcessIdentifier createProcessIdentifier(ExecutiveOfficeContext officeContext)
Description copied from interface:ExecutiveCreates a newProcessIdentifier.- Specified by:
createProcessIdentifierin interfaceExecutive- Parameters:
officeContext-ExecutiveOfficeContext.- Returns:
- New
ProcessIdentifier.
-
getOfficeManager
public OfficeManager getOfficeManager(ProcessIdentifier processIdentifier, OfficeManager defaultOfficeManager)
Description copied from interface:ExecutiveObtains theOfficeManagerfor theProcessState.- Specified by:
getOfficeManagerin interfaceExecutive- Parameters:
processIdentifier-ProcessIdentifiercreated by thisExecutivefor theProcessState.defaultOfficeManager- DefaultOfficeManager.- Returns:
OfficeManagerfor theProcessState.
-
createExecutor
public java.util.concurrent.Executor createExecutor(ProcessIdentifier processIdentifier)
Description copied from interface:ExecutiveCreates 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.
- Specified by:
createExecutorin interfaceExecutive- Parameters:
processIdentifier-ProcessIdentifierofProcessStaterequiring theExecutor.- Returns:
Executorthat will executeRunnableinstances in a differentThreadto caller.
- By
-
schedule
public void schedule(ProcessIdentifier processIdentifier, long delay, java.lang.Runnable runnable)
Description copied from interface:ExecutiveSchedules the
Runnableto execute so many milliseconds in the future.Note that the
Executivemay determine theProcessStatecomplete and not execute theRunnable.- Specified by:
schedulein interfaceExecutive- Parameters:
processIdentifier-ProcessIdentifierof theProcessStaterequiring the scheduled execution.delay- Delay in milliseconds to execute theRunnable.runnable-Runnableto execute.
-
processComplete
public void processComplete(ProcessIdentifier processIdentifier)
Description copied from interface:ExecutiveInvokes to notify theProcessStateidentified by theProcessIdentifieris complete.- Specified by:
processCompletein interfaceExecutive- Parameters:
processIdentifier-ProcessIdentifierof the completeProcessState.
-
stopManaging
public void stopManaging() throws java.lang.ExceptionDescription copied from interface:ExecutiveStops managing theOfficeFloor.- Specified by:
stopManagingin interfaceExecutive- Throws:
java.lang.Exception- If fails to stop managing.
-
getExecutionStrategyName
public java.lang.String getExecutionStrategyName()
Description copied from interface:ExecutionStrategyObtains the name of theExecutionStrategy.- Specified by:
getExecutionStrategyNamein interfaceExecutionStrategy- Returns:
- Name of the
ExecutionStrategy.
-
getThreadFactories
public java.util.concurrent.ThreadFactory[] getThreadFactories()
Description copied from interface:ExecutionStrategy- Specified by:
getThreadFactoriesin interfaceExecutionStrategy- Returns:
ThreadFactoryinstances.
-
createTeam
public Team createTeam(ExecutiveContext context) throws java.lang.Exception
Description copied from interface:TeamOversightCreates the
Team.This is expected to delegate to the
TeamSourceto create theTeam. However, theExecutivemay decide to wrap theTeamor provide multipleTeaminstances with assigning algorithm (such as taking advantage ofThreadaffinity). The choice is, however, ultimately left to theExecutiveto manage theTeaminstances.- Specified by:
createTeamin interfaceTeamOversight- Parameters:
context-ExecutiveContext.- Returns:
Team.- Throws:
java.lang.Exception- If fails to configure theTeamSource.
-
-