Class ExecutiveContextImpl
- java.lang.Object
-
- net.officefloor.frame.impl.construct.source.SourcePropertiesImpl
-
- net.officefloor.frame.impl.construct.source.SourceContextImpl
-
- net.officefloor.frame.impl.construct.team.ExecutiveContextImpl
-
- All Implemented Interfaces:
ExecutiveContext
,ServiceContext
,SourceContext
,SourceProperties
,TeamSourceContext
public class ExecutiveContextImpl extends SourceContextImpl implements ExecutiveContext
ExecutiveContext
implementation.- Author:
- Daniel Sagenschneider
-
-
Constructor Summary
Constructors Constructor Description ExecutiveContextImpl(boolean isLoadingType, java.lang.String teamName, boolean isRequestNoTeamOversight, int teamSize, TeamSource teamSource, Executive executive, ThreadFactoryManufacturer threadFactoryManufacturer, SourceProperties properties, SourceContext sourceContext)
Initialise.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.concurrent.ThreadFactory
createThreadFactory(java.lang.String teamName)
Creates aThreadFactory
for theTeam
name.java.lang.String
getTeamName()
Obtains the name of theTeam
to be created from theTeamSource
.int
getTeamSize()
Obtains the size of theTeam
.int
getTeamSize(int defaultSize)
Allows obtaining the size of theTeam
, without forcing it to be configured.TeamSource
getTeamSource()
Obtains theTeamSource
to create theTeam
.java.util.concurrent.ThreadFactory
getThreadFactory()
Obtains theThreadFactory
for theTeam
.boolean
isRequestNoTeamOversight()
Indicates if requesting noTeamOversight
.boolean
isRequireTeamSize()
Indicates if requiredTeam
size.-
Methods inherited from class net.officefloor.frame.impl.construct.source.SourceContextImpl
getClassLoader, getClock, getLogger, getName, getOptionalResource, getProfiles, getResource, isLoadingType, loadClass, loadOptionalClass, loadOptionalService, loadOptionalServices, loadService, loadService, loadServices
-
Methods inherited from class net.officefloor.frame.impl.construct.source.SourcePropertiesImpl
addProperty, getProperties, getProperty, getProperty, getPropertyNames
-
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.source.SourceContext
getClassLoader, getClock, getLogger, getName, getOptionalResource, getProfiles, getResource, isLoadingType, loadClass, loadOptionalClass, loadOptionalService, loadOptionalServices, loadService, loadService, loadServices
-
Methods inherited from interface net.officefloor.frame.api.source.SourceProperties
getProperties, getProperty, getProperty, getPropertyNames
-
-
-
-
Constructor Detail
-
ExecutiveContextImpl
public ExecutiveContextImpl(boolean isLoadingType, java.lang.String teamName, boolean isRequestNoTeamOversight, int teamSize, TeamSource teamSource, Executive executive, ThreadFactoryManufacturer threadFactoryManufacturer, SourceProperties properties, SourceContext sourceContext)
Initialise.- Parameters:
isLoadingType
- Indicates if loading type.teamName
- Name of theTeam
to be created from theTeamSource
.teamSize
-Team
size. Value of 0 or below indicates noTeam
size configured.teamSource
-TeamSource
.executive
-Executive
.threadFactoryManufacturer
-ThreadFactoryManufacturer
.properties
-SourceProperties
to initialise theTeamSource
.sourceContext
-SourceContext
.
-
-
Method Detail
-
isRequireTeamSize
public boolean isRequireTeamSize()
Indicates if requiredTeam
size.- Returns:
true
if theTeam
size is required.
-
getTeamName
public java.lang.String getTeamName()
Description copied from interface:TeamSourceContext
Obtains the name of the
Team
to be created from theTeamSource
.This enables naming the
Thread
instances for theTeam
to be specific to theTeam
.- Specified by:
getTeamName
in interfaceTeamSourceContext
- Returns:
- Name of the
Team
to be created from theTeamSource
.
-
isRequestNoTeamOversight
public boolean isRequestNoTeamOversight()
Description copied from interface:ExecutiveContext
Indicates if requesting no
TeamOversight
.The
Executive
may ignore this request.- Specified by:
isRequestNoTeamOversight
in interfaceExecutiveContext
- Returns:
true
to request noTeamOversight
.
-
getTeamSize
public int getTeamSize()
Description copied from interface:TeamSourceContext
Obtains the size of the
Team
.Typically this is the maximum number of
Thread
instances for theTeam
. However, for someTeam
implementations it may not be used (e.g.PassiveTeamSource
).It is provided to allow the
Executive
to have some control overTeam
sizes.- Specified by:
getTeamSize
in interfaceTeamSourceContext
- Returns:
Team
size.
-
getTeamSize
public int getTeamSize(int defaultSize)
Description copied from interface:TeamSourceContext
Allows obtaining the size of theTeam
, without forcing it to be configured.- Specified by:
getTeamSize
in interfaceTeamSourceContext
- Parameters:
defaultSize
- Default size of theTeam
, if no size configured.- Returns:
Team
size.
-
getThreadFactory
public java.util.concurrent.ThreadFactory getThreadFactory()
Description copied from interface:TeamSourceContext
Obtains the
ThreadFactory
for theTeam
.It is encouraged for
Team
implementations to use this in creatingThread
instances. This is to enable performance improvements byOfficeFloor
, such asThreadLocal
ManagedObjectPool
solutions to reduce pool locking overheads.- Specified by:
getThreadFactory
in interfaceTeamSourceContext
- Returns:
ThreadFactory
for theTeam
.
-
getTeamSource
public TeamSource getTeamSource()
Description copied from interface:ExecutiveContext
Obtains theTeamSource
to create theTeam
.- Specified by:
getTeamSource
in interfaceExecutiveContext
- Returns:
TeamSource
to create theTeam
.
-
createThreadFactory
public java.util.concurrent.ThreadFactory createThreadFactory(java.lang.String teamName)
Description copied from interface:ExecutiveContext
Creates a
ThreadFactory
for theTeam
name.The
Executive
may decide to create multipleTeam
instances for the actualTeam
. This allows identifying whichThread
will belong to eachTeam
.- Specified by:
createThreadFactory
in interfaceExecutiveContext
- Parameters:
teamName
- Name of theTeam
.- Returns:
ThreadFactory
.
-
-