Package net.officefloor.frame.test
Class BackPressureTeamSource
- java.lang.Object
-
- net.officefloor.frame.api.team.source.impl.AbstractTeamSource
-
- net.officefloor.frame.test.BackPressureTeamSource
-
- All Implemented Interfaces:
TeamSource
,Team
public class BackPressureTeamSource extends AbstractTeamSource implements Team
TeamSource
that causes back pressure to be applied.- Author:
- Daniel Sagenschneider
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class net.officefloor.frame.api.team.source.impl.AbstractTeamSource
AbstractTeamSource.SpecificationContext
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.concurrent.RejectedExecutionException
BACK_PRESSURE_EXCEPTION
RejectedExecutionException
thrown to indicate back pressure.
-
Constructor Summary
Constructors Constructor Description BackPressureTeamSource()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
assignJob(Job job)
Team
createTeam(TeamSourceContext context)
Creates theTeam
.static int
getBackPressureEscalationCount()
Obtains the number of back pressureEscalation
instances that have occurred.protected void
loadSpecification(AbstractTeamSource.SpecificationContext context)
Overridden to load specification.static void
resetBackPressureEscalationCount(int count)
Resets the back pressureEscalation
count.void
startWorking()
Indicates for theTeam
to start working.void
stopWorking()
Indicates for theTeam
to stop working.-
Methods inherited from class net.officefloor.frame.api.team.source.impl.AbstractTeamSource
getSpecification
-
-
-
-
Method Detail
-
getBackPressureEscalationCount
public static int getBackPressureEscalationCount()
Obtains the number of back pressureEscalation
instances that have occurred.- Returns:
- Number of back pressure
Escalation
instances that have occurred.
-
resetBackPressureEscalationCount
public static void resetBackPressureEscalationCount(int count)
Resets the back pressureEscalation
count.- Parameters:
count
- Count to reset theEscalation
count.
-
loadSpecification
protected void loadSpecification(AbstractTeamSource.SpecificationContext context)
Description copied from class:AbstractTeamSource
Overridden to load specification.- Specified by:
loadSpecification
in classAbstractTeamSource
- Parameters:
context
-AbstractTeamSource.SpecificationContext
.
-
createTeam
public Team createTeam(TeamSourceContext context) throws java.lang.Exception
Description copied from interface:TeamSource
Creates theTeam
.- Specified by:
createTeam
in interfaceTeamSource
- Parameters:
context
-TeamSourceContext
.- Returns:
Team
.- Throws:
java.lang.Exception
- If fails to configure theTeamSource
.
-
startWorking
public void startWorking()
Description copied from interface:Team
Indicates for theTeam
to start working.- Specified by:
startWorking
in interfaceTeam
-
-