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
ExecutiveContextimplementation.- Author:
- Daniel Sagenschneider
-
-
Constructor Summary
Constructors Constructor Description ExecutiveContextImpl(boolean isLoadingType, java.lang.String teamName, 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.ThreadFactorycreateThreadFactory(java.lang.String teamName)Creates aThreadFactoryfor theTeamname.java.lang.StringgetTeamName()Obtains the name of theTeamto be created from theTeamSource.intgetTeamSize()Obtains the size of theTeam.intgetTeamSize(int defaultSize)Allows obtaining the size of theTeam, without forcing it to be configured.TeamSourcegetTeamSource()Obtains theTeamSourceto create theTeam.java.util.concurrent.ThreadFactorygetThreadFactory()Obtains theThreadFactoryfor theTeam.booleanisRequireTeamSize()Indicates if requiredTeamsize.-
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, int teamSize, TeamSource teamSource, Executive executive, ThreadFactoryManufacturer threadFactoryManufacturer, SourceProperties properties, SourceContext sourceContext)Initialise.- Parameters:
isLoadingType- Indicates if loading type.teamName- Name of theTeamto be created from theTeamSource.teamSize-Teamsize. Value of 0 or below indicates noTeamsize configured.teamSource-TeamSource.executive-Executive.threadFactoryManufacturer-ThreadFactoryManufacturer.properties-SourcePropertiesto initialise theTeamSource.sourceContext-SourceContext.
-
-
Method Detail
-
isRequireTeamSize
public boolean isRequireTeamSize()
Indicates if requiredTeamsize.- Returns:
trueif theTeamsize is required.
-
getTeamName
public java.lang.String getTeamName()
Description copied from interface:TeamSourceContextObtains the name of the
Teamto be created from theTeamSource.This enables naming the
Threadinstances for theTeamto be specific to theTeam.- Specified by:
getTeamNamein interfaceTeamSourceContext- Returns:
- Name of the
Teamto be created from theTeamSource.
-
getTeamSize
public int getTeamSize()
Description copied from interface:TeamSourceContextObtains the size of the
Team.Typically this is the maximum number of
Threadinstances for theTeam. However, for someTeamimplementations it may not be used (e.g.PassiveTeamSource).It is provided to allow the
Executiveto have some control overTeamsizes.- Specified by:
getTeamSizein interfaceTeamSourceContext- Returns:
Teamsize.
-
getTeamSize
public int getTeamSize(int defaultSize)
Description copied from interface:TeamSourceContextAllows obtaining the size of theTeam, without forcing it to be configured.- Specified by:
getTeamSizein interfaceTeamSourceContext- Parameters:
defaultSize- Default size of theTeam, if no size configured.- Returns:
Teamsize.
-
getThreadFactory
public java.util.concurrent.ThreadFactory getThreadFactory()
Description copied from interface:TeamSourceContextObtains the
ThreadFactoryfor theTeam.It is encouraged for
Teamimplementations to use this in creatingThreadinstances. This is to enable performance improvements byOfficeFloor, such asThreadLocalManagedObjectPoolsolutions to reduce pool locking overheads.- Specified by:
getThreadFactoryin interfaceTeamSourceContext- Returns:
ThreadFactoryfor theTeam.
-
getTeamSource
public TeamSource getTeamSource()
Description copied from interface:ExecutiveContextObtains theTeamSourceto create theTeam.- Specified by:
getTeamSourcein interfaceExecutiveContext- Returns:
TeamSourceto create theTeam.
-
createThreadFactory
public java.util.concurrent.ThreadFactory createThreadFactory(java.lang.String teamName)
Description copied from interface:ExecutiveContextCreates a
ThreadFactoryfor theTeamname.The
Executivemay decide to create multipleTeaminstances for the actualTeam. This allows identifying whichThreadwill belong to eachTeam.- Specified by:
createThreadFactoryin interfaceExecutiveContext- Parameters:
teamName- Name of theTeam.- Returns:
ThreadFactory.
-
-