Interface RuntimeManager
-
- All Superinterfaces:
ADEPT2Service
,ConfigurableService
- All Known Subinterfaces:
RuntimeService
,SubprocessManager
public interface RuntimeManager extends ConfigurableService
The runtime manager provides the means to control the execution of an activity by the execution manager, the transaction manager or by controlling the application locally via execution control manager. The starting (and resuming) of an activity are initiated by the execution manager. The transaction handling (commit, rollback) is handled by the transaction manager. Additionally this interface provides access to an execution control manager which allows to control the execution locally, comparable to the Task Manager of Microsoft Windows.
-
-
Field Summary
-
Fields inherited from interface de.aristaflow.adept2.base.service.ConfigurableService
CONF_RUNTIME_CONF_PREFIX
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
commit(SessionToken session, EBPInstanceReference ebpInstanceReference)
Instructs the runtime manager to inform the specified activity about the commit of the transaction it participated.ExecutionControlManager
getExecutionControlManager()
Gets a manager for controlling the execution of an activity, for instance, finishing, suspending,...SynchronousActivityStarting
getSynchronousActivityStarting()
Gets an interface for synchronously starting/resuming activities and returning theGUIContext
of the started/resumed activity.Map<EBPInstanceReference,ProcessConstants.NodeState>
logoffAndTerminateActivities(SessionToken session, QualifiedAgent agent, boolean forceTermination)
Logs the agent off that is identified by the designated client session factory.void
logon(SessionToken session, ClientSessionFactory clientSessionFactory)
Logs the agent on that is identified by the designated session token and stores the corresponding client session factory for communicating component signals to the execution manager.boolean
preferAutoStartNotification()
Gets whether this runtime manager prefers to be notified of pending autostart activities instead of the activities directly being pushed to be started within this runtime manager.Vote
prepareCommit(SessionToken session, EBPInstanceReference ebpInstanceReference)
Instructs the runtime manager to prepare the specified activity for committing its work done within the transaction it participated.void
resumeActivity(SessionToken session, EBPInstanceReference ebpInstanceReference, ExecutionContext executionContext)
Instructs the runtime manager to resume the specified activity.void
rollbackActivity(SessionToken session, EBPInstanceReference ebpInstanceReference)
Instructs the runtime manager to instruct the specified activity to rollback its work done within the transaction it participated.void
startActivity(SessionToken session, EBPInstanceReference ebpInstanceReference, ExecutionContext executionContext)
Instructs the runtime manager to start the Application assigned to the specified activity.void
updateClientSessionFactory(SessionToken session, ClientSessionFactory csf)
Updates the designated client session factory.-
Methods inherited from interface de.aristaflow.adept2.base.service.ADEPT2Service
getLocalUris, getRelease, getRuntimeRequiredServices, getServiceInstanceName, getStartupRequiredServices, getURIs, init, ping, preShutdown, shutdown, start
-
Methods inherited from interface de.aristaflow.adept2.base.service.ConfigurableService
getChangeableConfigurationKeys, getConfiguration, getConfigurationValue, setConfigurationValue
-
-
-
-
Method Detail
-
preferAutoStartNotification
boolean preferAutoStartNotification()
Gets whether this runtime manager prefers to be notified of pending autostart activities instead of the activities directly being pushed to be started within this runtime manager.- Returns:
- Whether this runtime manager prefers to be notified of pending autostart activities instead of the activities directly being pushed to be started within this runtime manager.
-
logon
void logon(SessionToken session, ClientSessionFactory clientSessionFactory)
Logs the agent on that is identified by the designated session token and stores the corresponding client session factory for communicating component signals to the execution manager. This agent can afterwards execute (start and resume) activities on this runtime manager.
Implementors should ensure to only allow to execute activities for the logged on agents. And only these client session factories must be used!- Parameters:
session
- The session token identifying the agent to execute activities on this runtime manager.clientSessionFactory
- A client session factory for the designated agent.- Throws:
ServiceAccessControlException
- If the designated session token or a session token of the designated client session factory has no integrity, aServiceAccessControlException
will be thrown.
-
updateClientSessionFactory
void updateClientSessionFactory(SessionToken session, ClientSessionFactory csf)
Updates the designated client session factory. This is required in case some of the details of the user changes. Only call this method for logged on agents; unknown agents/client session factories will be ignored.- Parameters:
session
- The session token identifying the agent for whom to update the client session factory.csf
- The new client session factory with which to replace the old one.- Throws:
ServiceAccessControlException
- If the designated session token or a session token of the designated client session factory has no integrity, aServiceAccessControlException
will be thrown.
-
logoffAndTerminateActivities
Map<EBPInstanceReference,ProcessConstants.NodeState> logoffAndTerminateActivities(SessionToken session, QualifiedAgent agent, boolean forceTermination)
Logs the agent off that is identified by the designated client session factory. Afterwards this agent cannot execute activities on this runtime manager any longer. Currently running activities will be suspended if they support this. Otherwise they keep on running unless the termination is forced. A forced termination will reset or abort running activities that cannot be suspended. If you do not want to logoff in case of running activities, useExecutionControlManager.getActivities(SessionToken, de.aristaflow.adept2.model.runtimeenvironment.ActivityState.State[])
beforehand.
Terminating activities is done the same way as shutting down the runtime manager.The returned map contains all activities that have been running when calling this method mapped to their state after executing this method. Their state is represented as
ProcessConstants.NodeState
as follows:- NS_SUSPENDED: The activity supports a suspend and suspending it was successful.
- NS_RUNNING: The activity was suspended and the termination was not forced. Therefore it keeps on running.
- NS_COMPLETED: The termination was forced and the activity was able to close itself.
- NS_ACTIVATED: The termination was forced and the activity was able to reset itself.
- NS_FAILED: The termination was forced and the activity was aborted.
- null: The termination failed with an exception, the node state could not be determined.
Implementations have to be synchronised correctly, since a logoff can happen concurrently to starting or resuming an activity. ensure to only allow to execute activities for the logged on agents. And only these client session factories must be used!
- Parameters:
session
- The session which is used to check for access rights on this method and for synchronising against concurrent starting/resuming.agent
- The agent to logoff from this runtime manager.forceTermination
- Whether unsuspensible activities should be reset or aborted instead of continue to run.- Returns:
- The running activities and their state (running, suspended, finished or failed) after executing this method. This allows to recheck and stop the activities that should not keep on running.
- Throws:
ServiceAccessControlException
- If the designated session token has no integrity, aServiceAccessControlException
will be thrown.
-
startActivity
void startActivity(SessionToken session, EBPInstanceReference ebpInstanceReference, ExecutionContext executionContext) throws AgentUnknownException
Instructs the runtime manager to start the Application assigned to the specified activity. All information about what has to be executed is encapsulated in the execution context.- Parameters:
session
- The session which is used to check for access rights on this method and to synchronise the instance access in the execution manager.ebpInstanceReference
- identifies the activity to be executedexecutionContext
- keeps all the information necessary to execute the specified application.- Throws:
AgentUnknownException
- If the agent identified by the designated session token is not known to this runtime manager.- See Also:
EBPInstanceReference
,ExecutionContext
-
resumeActivity
void resumeActivity(SessionToken session, EBPInstanceReference ebpInstanceReference, ExecutionContext executionContext) throws AgentUnknownException
Instructs the runtime manager to resume the specified activity. The activity will be resumed from the last savepoint provided by the data container.- Parameters:
session
- The session which is used to check for access rights on this method and to synchronise the instance access in the execution manager.ebpInstanceReference
- identifies the activity to be resumedexecutionContext
- the context that keeps all the information necessary to identify the application to be run- Throws:
AgentUnknownException
- If the agent identified by the designated session token is not known to this runtime manager
-
prepareCommit
Vote prepareCommit(SessionToken session, EBPInstanceReference ebpInstanceReference)
Instructs the runtime manager to prepare the specified activity for committing its work done within the transaction it participated.- Parameters:
session
- The session which is used to check for access rights on this method and to synchronise the instance access in the execution manager.ebpInstanceReference
- the identifier of the activity that should prepare for commit- Returns:
- the activities vote about the commitment or abortion of the transaction it participated.
-
commit
void commit(SessionToken session, EBPInstanceReference ebpInstanceReference)
Instructs the runtime manager to inform the specified activity about the commit of the transaction it participated.- Parameters:
session
- The session which is used to check for access rights on this method and to synchronise the instance access in the execution manager.ebpInstanceReference
- the identifier of the activity that should commit its work.
-
rollbackActivity
void rollbackActivity(SessionToken session, EBPInstanceReference ebpInstanceReference)
Instructs the runtime manager to instruct the specified activity to rollback its work done within the transaction it participated.
EitherprepareCommit
orabortActivity
have to be called prior to a rollback.- Parameters:
session
- The session which is used to check for access rights on this method and to synchronise the instance access in the execution manager.ebpInstanceReference
- the identifier of the activity the should rollback its work.
-
getExecutionControlManager
ExecutionControlManager getExecutionControlManager()
Gets a manager for controlling the execution of an activity, for instance, finishing, suspending,...- Returns:
- An instance for controlling the execution of activities.
-
getSynchronousActivityStarting
SynchronousActivityStarting getSynchronousActivityStarting()
Gets an interface for synchronously starting/resuming activities and returning theGUIContext
of the started/resumed activity. A runtime manager does not need to support this. In this casenull
is returned and the caller needs to use the execution manager directly.- Returns:
- An interface for synchronously starting activities or
null
in case this runtime manager does not support this.
-
-