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
Executive
for 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 Executive
createExecutive(ExecutiveSourceContext context)
Creates theExecutive
.java.util.concurrent.Executor
createExecutor(ProcessIdentifier processIdentifier)
Creates anExecutor
that MUST execute theRunnable
in a differentThread
to the caller.ProcessIdentifier
createProcessIdentifier(ExecutiveOfficeContext officeContext)
Creates a newProcessIdentifier
.Team
createTeam(ExecutiveContext context)
Creates theTeam
.java.lang.Thread
createThread(java.lang.String threadName, java.lang.ThreadGroup threadGroup, java.lang.Runnable runnable)
Creates aThread
.ExecutionStrategy[]
getExcutionStrategies()
Obtains theExecutionStrategy
strategies.java.lang.String
getExecutionStrategyName()
Obtains the name of theExecutionStrategy
.OfficeManager
getOfficeManager(ProcessIdentifier processIdentifier, OfficeManager defaultOfficeManager)
Obtains theOfficeManager
for theProcessState
.TeamOversight
getTeamOversight()
Obtains theTeamOversight
.java.util.concurrent.ThreadFactory[]
getThreadFactories()
protected void
loadSpecification(AbstractExecutiveSource.SpecificationContext context)
Overridden to load specification.void
processComplete(ProcessIdentifier processIdentifier)
Invokes to notify theProcessState
identified by theProcessIdentifier
is complete.void
schedule(ProcessIdentifier processIdentifier, long delay, java.lang.Runnable runnable)
Schedules theRunnable
to execute so many milliseconds in the future.void
startManaging(ExecutiveStartContext context)
Starts managing theOfficeFloor
.void
stopManaging()
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:AbstractExecutiveSource
Overridden to load specification.- Specified by:
loadSpecification
in classAbstractExecutiveSource
- Parameters:
context
-AbstractExecutiveSource.SpecificationContext
.
-
createExecutive
public Executive createExecutive(ExecutiveSourceContext context) throws java.lang.Exception
Description copied from interface:ExecutiveSource
Creates theExecutive
.- Specified by:
createExecutive
in 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:Executive
Creates aThread
.- Specified by:
createThread
in interfaceExecutive
- Returns:
- New
Thread
.
-
getExcutionStrategies
public ExecutionStrategy[] getExcutionStrategies()
Description copied from interface:Executive
Obtains theExecutionStrategy
strategies.- Specified by:
getExcutionStrategies
in interfaceExecutive
- Returns:
ExecutionStrategy
instances.
-
getTeamOversight
public TeamOversight getTeamOversight()
Description copied from interface:Executive
Obtains theTeamOversight
.- Specified by:
getTeamOversight
in interfaceExecutive
- Returns:
TeamOversight
.
-
startManaging
public void startManaging(ExecutiveStartContext context) throws java.lang.Exception
Description copied from interface:Executive
Starts managing theOfficeFloor
.- Specified by:
startManaging
in interfaceExecutive
- Parameters:
context
-ExecutiveStartContext
.- Throws:
java.lang.Exception
- If fails to start managing.
-
createProcessIdentifier
public ProcessIdentifier createProcessIdentifier(ExecutiveOfficeContext officeContext)
Description copied from interface:Executive
Creates a newProcessIdentifier
.- Specified by:
createProcessIdentifier
in interfaceExecutive
- Parameters:
officeContext
-ExecutiveOfficeContext
.- Returns:
- New
ProcessIdentifier
.
-
getOfficeManager
public OfficeManager getOfficeManager(ProcessIdentifier processIdentifier, OfficeManager defaultOfficeManager)
Description copied from interface:Executive
Obtains theOfficeManager
for theProcessState
.- Specified by:
getOfficeManager
in interfaceExecutive
- Parameters:
processIdentifier
-ProcessIdentifier
created by thisExecutive
for theProcessState
.defaultOfficeManager
- DefaultOfficeManager
.- Returns:
OfficeManager
for theProcessState
.
-
createExecutor
public java.util.concurrent.Executor createExecutor(ProcessIdentifier processIdentifier)
Description copied from interface:Executive
Creates an
Executor
that MUST execute theRunnable
in a differentThread
to the caller.This is used in various places within
OfficeFloor
:- By
ManagedFunction
in executingRunnable
in anotherThread
- To avoid stack over flow issues, the stack call chain is broken by
invoking further
FunctionState
delegation in anotherThread
. This allows further depth to a thread stack than offered by a singleThread
.
- Specified by:
createExecutor
in interfaceExecutive
- Parameters:
processIdentifier
-ProcessIdentifier
ofProcessState
requiring theExecutor
.- Returns:
Executor
that will executeRunnable
instances in a differentThread
to caller.
- By
-
schedule
public void schedule(ProcessIdentifier processIdentifier, long delay, java.lang.Runnable runnable)
Description copied from interface:Executive
Schedules the
Runnable
to execute so many milliseconds in the future.Note that the
Executive
may determine theProcessState
complete and not execute theRunnable
.- Specified by:
schedule
in interfaceExecutive
- Parameters:
processIdentifier
-ProcessIdentifier
of theProcessState
requiring the scheduled execution.delay
- Delay in milliseconds to execute theRunnable
.runnable
-Runnable
to execute.
-
processComplete
public void processComplete(ProcessIdentifier processIdentifier)
Description copied from interface:Executive
Invokes to notify theProcessState
identified by theProcessIdentifier
is complete.- Specified by:
processComplete
in interfaceExecutive
- Parameters:
processIdentifier
-ProcessIdentifier
of the completeProcessState
.
-
stopManaging
public void stopManaging() throws java.lang.Exception
Description copied from interface:Executive
Stops managing theOfficeFloor
.- Specified by:
stopManaging
in interfaceExecutive
- Throws:
java.lang.Exception
- If fails to stop managing.
-
getExecutionStrategyName
public java.lang.String getExecutionStrategyName()
Description copied from interface:ExecutionStrategy
Obtains the name of theExecutionStrategy
.- Specified by:
getExecutionStrategyName
in interfaceExecutionStrategy
- Returns:
- Name of the
ExecutionStrategy
.
-
getThreadFactories
public java.util.concurrent.ThreadFactory[] getThreadFactories()
Description copied from interface:ExecutionStrategy
- Specified by:
getThreadFactories
in interfaceExecutionStrategy
- Returns:
ThreadFactory
instances.
-
createTeam
public Team createTeam(ExecutiveContext context) throws java.lang.Exception
Description copied from interface:TeamOversight
Creates the
Team
.This is expected to delegate to the
TeamSource
to create theTeam
. However, theExecutive
may decide to wrap theTeam
or provide multipleTeam
instances with assigning algorithm (such as taking advantage ofThread
affinity). The choice is, however, ultimately left to theExecutive
to manage theTeam
instances.- Specified by:
createTeam
in interfaceTeamOversight
- Parameters:
context
-ExecutiveContext
.- Returns:
Team
.- Throws:
java.lang.Exception
- If fails to configure theTeamSource
.
-
-