public class ProcessContextTeam extends Object implements Team, ProcessContextListener
Team
to re-use the invoking Thread
of the
ProcessState
. Typically this will be the Thread
invoking the
Work
via the WorkManager
.
To enable the invoking Thread
to be available for executing
Task
instances of the ProcessState
, the Work
by the
WorkManager
needs to be invoked with the
doWork(WorkManager, Object)
method.
As the typical focus of this Team
is to integration with Application
Servers (using correct Thread
for JNDI lookups), assigned Job
instances without a ProcessState
context Thread
will be
executed passively (i.e. by the caller - Thread
of previous
Job
).
Constructor and Description |
---|
ProcessContextTeam(TeamIdentifier teamIdentifier)
Initiate.
|
Modifier and Type | Method and Description |
---|---|
void |
assignJob(Job job,
TeamIdentifier assignerTeam)
|
static void |
doProcess(ManagedObjectExecuteContext<?> executeContext,
int flowIndex,
Object parameter,
ManagedObject managedObject,
EscalationHandler escalationHandler)
Wrap invoking
ProcessState on the
ManagedObjectExecuteContext to allow the Thread to be
available to execute the Task instances of the
ProcessState . |
static <F extends Enum<F>> |
doProcess(ManagedObjectExecuteContext<F> executeContext,
F flowKey,
Object parameter,
ManagedObject managedObject,
EscalationHandler escalationHandler)
Wrap invoking
ProcessState on the
ManagedObjectExecuteContext to allow the Thread to be
available to execute the Task instances of the
ProcessState . |
static void |
doTask(TaskManager taskManager,
Object parameter)
Wrap invoking
Task on the TaskManager to allow the
Thread to be available to execute the Task instances of
the ProcessState . |
static void |
doWork(WorkManager workManager,
Object parameter)
Wrap invoking
Work on the WorkManager to allow the
Thread to be available to execute the Task instances of
the ProcessState . |
void |
processCompleted(Object processIdentifier)
Notifies that the
ProcessState is completed. |
void |
processCreated(Object processIdentifier)
Notifies that a
ProcessState is created. |
void |
startWorking()
Indicates for the
Team to start working. |
void |
stopWorking()
Indicates for the
Team to stop working. |
public ProcessContextTeam(TeamIdentifier teamIdentifier)
teamIdentifier
- TeamIdentifier
of this Team
.public static void doWork(WorkManager workManager, Object parameter) throws NoInitialTaskException, InvalidParameterTypeException, InterruptedException
Wrap invoking Work
on the WorkManager
to allow the
Thread
to be available to execute the Task
instances of
the ProcessState
.
This method blocks until the invoked ProcessState
of the invoked
Work
is complete.
workManager
- WorkManager
managing the Work
to invoked.parameter
- Parameter for the initial Task
of the Work
.NoInitialTaskException
- If Work
of the WorkManager
has no initial
Task
.InvalidParameterTypeException
- Should the parameter type be invalid for the Task
.InterruptedException
- Should this blocking call be interrupted.public static void doTask(TaskManager taskManager, Object parameter) throws InvalidParameterTypeException, InterruptedException
Wrap invoking Task
on the TaskManager
to allow the
Thread
to be available to execute the Task
instances of
the ProcessState
.
This method blocks until the invoked ProcessState
of the invoked
Task
is complete.
taskManager
- TaskManager
managing the Task
to invoked.parameter
- Parameter for the Task
.InvalidParameterTypeException
- Should the parameter type be invalid for the Task
.InterruptedException
- Should this blocking call be interrupted.public static <F extends Enum<F>> void doProcess(ManagedObjectExecuteContext<F> executeContext, F flowKey, Object parameter, ManagedObject managedObject, EscalationHandler escalationHandler) throws InterruptedException
Wrap invoking ProcessState
on the
ManagedObjectExecuteContext
to allow the Thread
to be
available to execute the Task
instances of the
ProcessState
.
This method blocks until the invoked ProcessState
is complete.
F
- Flow key type.executeContext
- ManagedObjectExecuteContext
.flowKey
- JobSequence
key.parameter
- Parameter for the initial Task
.managedObject
- ManagedObject
.escalationHandler
- EscalationHandler
. May be null
.InterruptedException
- Should this blocking call be interrupted.public static void doProcess(ManagedObjectExecuteContext<?> executeContext, int flowIndex, Object parameter, ManagedObject managedObject, EscalationHandler escalationHandler) throws InterruptedException
Wrap invoking ProcessState
on the
ManagedObjectExecuteContext
to allow the Thread
to be
available to execute the Task
instances of the
ProcessState
.
This method blocks until the invoked ProcessState
is complete.
executeContext
- ManagedObjectExecuteContext
.flowIndex
- JobSequence
index.parameter
- Parameter for the initial Task
.managedObject
- ManagedObject
.escalationHandler
- EscalationHandler
. May be null
.InterruptedException
- Should this blocking call be interrupted.public void startWorking()
Team
Team
to start working.startWorking
in interface Team
public void assignJob(Job job, TeamIdentifier assignerTeam)
Team
public void stopWorking()
Team
Indicates for the Team
to stop working.
This method should block and only return control when the Team
has stopped working and is no longer assigned Job
instances to
complete.
stopWorking
in interface Team
public void processCreated(Object processIdentifier)
ProcessContextListener
Notifies that a ProcessState
is created.
This will be invoked by the same Thread
creating the
ProcessState
.
processCreated
in interface ProcessContextListener
processIdentifier
- ProcessState
identifier.public void processCompleted(Object processIdentifier)
ProcessContextListener
ProcessState
is completed.processCompleted
in interface ProcessContextListener
processIdentifier
- ProcessState
identifier.Copyright © 2005–2016. All rights reserved.