Package net.officefloor.web.executive
Class WebThreadAffinityExecutive
- java.lang.Object
-
- net.officefloor.web.executive.WebThreadAffinityExecutive
-
- All Implemented Interfaces:
ExecutionStrategy
,Executive
,TeamOversight
public class WebThreadAffinityExecutive extends java.lang.Object implements Executive, ExecutionStrategy, TeamOversight
WebThread
affinityExecutive
.- Author:
- Daniel Sagenschneider
-
-
Constructor Summary
Constructors Constructor Description WebThreadAffinityExecutive(CpuCore[] cpuCores, ExecutiveSourceContext context)
Instantiate.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
createProcessIdentifier()
Creates a newProcessState
identifier.Team
createTeam(ExecutiveContext context)
Creates theTeam
.ExecutionStrategy[]
getExcutionStrategies()
Obtains theExecutionStrategy
strategies.java.lang.String
getExecutionStrategyName()
Obtains the name of theExecutionStrategy
.java.lang.String
getTeamOversightName()
Obtains the name of theTeamOversight
.TeamOversight[]
getTeamOversights()
Obtains theTeamOversight
instances.java.util.concurrent.ThreadFactory[]
getThreadFactories()
<T extends java.lang.Throwable>
ProcessManagermanageExecution(Execution<T> execution)
Manages theExecution
.
-
-
-
Constructor Detail
-
WebThreadAffinityExecutive
public WebThreadAffinityExecutive(CpuCore[] cpuCores, ExecutiveSourceContext context)
Instantiate.- Parameters:
cpuCores
-CpuCore
instances.context
-ExecutiveSourceContext
.
-
-
Method Detail
-
createProcessIdentifier
public java.lang.Object createProcessIdentifier()
Description copied from interface:Executive
Creates a newProcessState
identifier.- Specified by:
createProcessIdentifier
in interfaceExecutive
- Returns:
- New
ProcessState
identifier.
-
manageExecution
public <T extends java.lang.Throwable> ProcessManager manageExecution(Execution<T> execution) throws T extends java.lang.Throwable
Description copied from interface:Executive
Manages the
Execution
.The
Thread.currentThread()
will provide the inboundThread
.- Specified by:
manageExecution
in interfaceExecutive
- Type Parameters:
T
- Type ofThrowable
thrown.- Parameters:
execution
-Execution
to be undertaken.- Returns:
ProcessManager
for theProcessState
.- Throws:
T
- Propagation of failure fromExecution
.T extends java.lang.Throwable
-
getExcutionStrategies
public ExecutionStrategy[] getExcutionStrategies()
Description copied from interface:Executive
Obtains theExecutionStrategy
strategies.- Specified by:
getExcutionStrategies
in interfaceExecutive
- Returns:
ExecutionStrategy
instances.
-
getTeamOversights
public TeamOversight[] getTeamOversights()
Description copied from interface:Executive
Obtains theTeamOversight
instances.- Specified by:
getTeamOversights
in interfaceExecutive
- Returns:
TeamOversight
instances.
-
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.
-
getTeamOversightName
public java.lang.String getTeamOversightName()
Description copied from interface:TeamOversight
Obtains the name of theTeamOversight
.- Specified by:
getTeamOversightName
in interfaceTeamOversight
- Returns:
- Name of the
TeamOversight
.
-
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
.
-
-