Interface ExecutionControlManager
-
- All Known Subinterfaces:
RemoteExecutionControlManager
public interface ExecutionControlManager
This interface allows external clients to control the execution of an activity. These methods are usually not called by the execution manager like the methods of the runtime manager interface but by the client directly, for instance via interactions on the worklist.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
abortActivity(SessionToken session, EBPInstanceReference activity, long timeToRespond, boolean propagate)
Instructs the runtime client to abort the specified activity and propagate the abortion if appropriate, e. g. to subprocess instances.void
finishActivity(SessionToken session, EBPInstanceReference activity)
Instructs the execution control manager to stop the specified activity.Map<EBPInstanceReference,ActivityState>
getActivities(SessionToken session, ActivityState.State[] states)
Gets all activities of the agent identified by the designated session token and their corresponding state.RemoteIterator<List<SerialisablePair<EBPInstanceReference,ActivityState>>>
getActivitiesIterator(SessionToken session, ActivityState.State[] states)
The same asgetActivities(SessionToken, ActivityState.State[])
but with partial retrieval of the activities and their state.ActivityState
getActivityState(SessionToken session, EBPInstanceReference activity)
Gets the current state of the designated activity ornull
in case the activity is not yet known or not known any more.Map<EBPInstanceReference,ActivityState>
getAllActivities(SessionToken session, ActivityState.State[] states)
Gets all activities and their corresponding state.RemoteIterator<List<SerialisablePair<EBPInstanceReference,ActivityState>>>
getAllActivitiesIterator(SessionToken session, ActivityState.State[] states)
The same asgetAllActivities(SessionToken, ActivityState.State[])
but with partial retrieval of the activities and their state.ExecutionControlProperties
getExecutionControlProperties(SessionToken session, EBPInstanceReference activity)
Gets theExecutionControlProperties
for the designated activity.void
resetActivity(SessionToken session, EBPInstanceReference activity)
Instructs the execution control manager to reset the specified activity.void
sendSignalToActivity(SessionToken session, EBPInstanceReference activity, int signal)
Instructs the runtime manager to signal the specified event to the specified activity.void
suspendActivity(SessionToken session, EBPInstanceReference activity, boolean propagate)
Instructs the execution control manager to suspend the specified activity and propagate the suspension if appropriate, e. g. to subprocess instances.ActivityState
waitForTermination(SessionToken session, EBPInstanceReference activity, long timeToRespond)
Waits for the designated time for the designated activity to terminate and returns the last state when leaving this method.
-
-
-
Method Detail
-
getExecutionControlProperties
ExecutionControlProperties getExecutionControlProperties(SessionToken session, EBPInstanceReference activity)
Gets theExecutionControlProperties
for the designated activity. These specify which interactions controlling the execution of a component are supported, for instance suspending or resetting.- Parameters:
session
- The session which is used to check for access rights on this method.activity
- The activity to get the execution control properties of.- Returns:
- The
ExecutionControlProperties
of the activity ornull
in case the activity is not known by the runtime manager yet or any more.
-
suspendActivity
void suspendActivity(SessionToken session, EBPInstanceReference activity, boolean propagate)
Instructs the execution control manager to suspend the specified activity and propagate the suspension if appropriate, e. g. to subprocess instances.- Parameters:
session
- The session which is used to check for access rights on this method.activity
- The identification of the activity to be suspended.propagate
- Whether to propagate the suspension if appropriate, e. g. to subprocess instances.- Throws:
IllegalArgumentException
- If the activity is not suspensible (seeExecutionControlProperties.isSuspensible()
) or not running (any more), anIllegalArgumentException
will be thrown.
-
finishActivity
void finishActivity(SessionToken session, EBPInstanceReference activity)
Instructs the execution control manager to stop the specified activity.- Parameters:
session
- The session which is used to check for access rights on this method.activity
- The identification of the activity to be finished.- Throws:
IllegalArgumentException
- If the activity is not closable (seeExecutionControlProperties.isClosable()
) or not running (any more), anIllegalArgumentException
will be thrown.
-
resetActivity
void resetActivity(SessionToken session, EBPInstanceReference activity)
Instructs the execution control manager to reset the specified activity. If the activity does not respond or does not want to be reset, no further actions will take place.- Parameters:
session
- The session which is used to check for access rights on this method.activity
- The identification of the activity to be reset.- Throws:
IllegalArgumentException
- If the activity is not resettable (seeExecutionControlProperties.isResettable()
) or not running (any more), anIllegalArgumentException
will be thrown.
-
abortActivity
boolean abortActivity(SessionToken session, EBPInstanceReference activity, long timeToRespond, boolean propagate)
Instructs the runtime client to abort the specified activity and propagate the abortion if appropriate, e. g. to subprocess instances. If the activity does not respond after the designated time (in milliseconds), it will be killed (the thread will be stopped). If the timeout is less than 0, the activity is just notified to abort but it will not be killed. A timeout 0 just kills the activity.- Parameters:
session
- The session which is used to check for access rights on this method.activity
- The identification of the activity to be aborted.timeToRespond
- The time in milliseconds to wait for the activity to terminate/abort. If the activity has not terminated after this time, it will be killed (the thread will be stopped). 0 as timeout kills instantly, a timeout less than 0 just sends the abort notification.propagate
- Whether to propagate the abortion if appropriate, e. g. to subprocess instances.- Returns:
- Whether the component executing the activity terminated in time. If the timeout has
elapsed before it terminated,
false
will be returned. - Throws:
IllegalArgumentException
- If the activity is not running (any more) in the corresponding runtime manager, anIllegalArgumentException
will be thrown.
-
sendSignalToActivity
void sendSignalToActivity(SessionToken session, EBPInstanceReference activity, int signal)
Instructs the runtime manager to signal the specified event to the specified activity.- Parameters:
session
- The session which is used to check for access rights on this method.activity
- The identification of the activity to send a signal to.signal
- The control signal that should be forwarded to the affected activity.
-
getActivityState
ActivityState getActivityState(SessionToken session, EBPInstanceReference activity)
Gets the current state of the designated activity ornull
in case the activity is not yet known or not known any more.- Parameters:
session
- The session which is used to check for access rights on this method.activity
- The identification of the activity to get the state of.- Returns:
- The current state of the designated activity (no termination state)
or
null
in case the activity is not yet known or not known any more.
-
getActivities
Map<EBPInstanceReference,ActivityState> getActivities(SessionToken session, ActivityState.State[] states)
Gets all activities of the agent identified by the designated session token and their corresponding state. Only activities being in one of designated states will be considered.- Parameters:
session
- The session which is used to check for access rights on this method and to identify the agent of whom to return the running activities.states
- The states to filter all activities of the agent identified by the designated session token. This must not benull
but may be an empty array (which will return an empty map).- Returns:
- The activities of the agent identified by the session token currently active (having a defined state) in the activity manager of this execution control manager and their corresponding states (no termination states).
- Throws:
ServiceAccessControlException
- If the designated session token has no integrity, aServiceAccessControlException
will be thrown.
-
getActivitiesIterator
RemoteIterator<List<SerialisablePair<EBPInstanceReference,ActivityState>>> getActivitiesIterator(SessionToken session, ActivityState.State[] states)
The same asgetActivities(SessionToken, ActivityState.State[])
but with partial retrieval of the activities and their state.- Parameters:
session
- The session which is used to check for access rights on this method and to identify the agent of whom to return the running activities.states
- The states to filter all activities of the agent identified by the designated session token. This must not benull
but may be an empty array (which will return an empty map).- Returns:
- The activities of the agent identified by the session token currently active (having a
defined state) in the activity manager of this execution control manager and their
corresponding states as iterator (no termination states).
The caller is responsible for closing. - Throws:
ServiceAccessControlException
- If the designated session token has no integrity, aServiceAccessControlException
will be thrown.
-
getAllActivities
Map<EBPInstanceReference,ActivityState> getAllActivities(SessionToken session, ActivityState.State[] states)
Gets all activities and their corresponding state. Only activities being in one of designated states will be considered. The designated session token has to stem from the supervisor role.- Parameters:
session
- The session which is used to check for access rights, requiring the supervisor role.states
- The states to filter all activities. This must not benull
but may be an empty array (which will return an empty map).- Returns:
- All activities currently active (having a defined state) in the activity manager of this execution control manager and their corresponding states. This also includes activities that have been terminated but the termination is pending due to using a persisting activity termination.
- Throws:
ServiceAccessControlException
- If the designated session token has no integrity or not the supervisor role, aServiceAccessControlException
will be thrown.
-
getAllActivitiesIterator
RemoteIterator<List<SerialisablePair<EBPInstanceReference,ActivityState>>> getAllActivitiesIterator(SessionToken session, ActivityState.State[] states)
The same asgetAllActivities(SessionToken, ActivityState.State[])
but with partial retrieval of the activities and their state.- Parameters:
session
- The session which is used to check for access rights, requiring the supervisor role.states
- The states to filter all activities. This must not benull
but may be an empty array (which will return an empty map).- Returns:
- All activities currently active (having a defined state) in the activity manager of
this execution control manager and their corresponding states. This also includes
activities that have been terminated but the termination is pending due to using a
persisting activity termination.
The caller is responsible for closing. - Throws:
ServiceAccessControlException
- If the designated session token has no integrity or not the supervisor role, aServiceAccessControlException
will be thrown.
-
waitForTermination
ActivityState waitForTermination(SessionToken session, EBPInstanceReference activity, long timeToRespond) throws InterruptedException
Waits for the designated time for the designated activity to terminate and returns the last state when leaving this method. If the activity has successfully terminated, this will be the correspondingTerminatedActivityState
. If it has not terminated, e.g. the timeout elapsed, this will be the correspondingActivityState
. If the activity is not known (any more),null
will be returned.- Parameters:
session
- The session which is used to check for access rights on this method.activity
- The identification of the activity to wait for its termination.timeToRespond
- The time span in milliseconds to wait for the activity to terminate.- Returns:
- The last state of the activity or
null
in case it is not known (any more). - Throws:
InterruptedException
- If the current thread is interrupted while waiting for the activity (or tries to wait with the interrupt flag set), anInterruptedException
will be thrown.
-
-