Interface InstanceStateNotification
-
- All Known Implementing Classes:
InstanceStateNotificationWrapper
public interface InstanceStateNotification
This interface is used as a callback for the events when a top-level instance has changed its state. This may be due to a normal termination (instance has finished), suspension, resume or failure. The execution manager informs the implementing class about the corresponding events. The implementation has to register when the corresponding instance is started (InstanceControl.startInstance(de.aristaflow.adept2.base.sessionmanagement.SessionToken, UUID, URI[])
,InstanceControl.startInstance(de.aristaflow.adept2.base.sessionmanagement.SessionToken, UUID, de.aristaflow.adept2.model.execution.ExecutionContext, URI[], URI[])
).
Since this interface is a callback-interface, no session tokens are used.- See Also:
InstanceControl
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
autoStartPending(EBPInstanceReference activity, long terminationTime, QualifiedAgent agent, URI[] runtimeManager, boolean rtmResolved)
Notifies that the designated activity may be autostarted.void
instanceFailed(UUID instanceID, DataContainer dataContainer, String errorMessage, String state, long errorCode)
Notifies that the designated top-level instance has failed and provides the necessary failure information.void
instanceFinished(UUID instanceID, DataContainer dataContainer)
Notifies that the designated top-level instance has finished normally and provides the output parameters of the instance.void
instanceResumed(UUID instId, URI[] newListener)
Notifies that the designated top-level instance has been resumed.void
instanceSuspended(UUID instanceID)
Notifies that the designated top-level instance has been suspended.
-
-
-
Method Detail
-
instanceFinished
void instanceFinished(UUID instanceID, DataContainer dataContainer)
Notifies that the designated top-level instance has finished normally and provides the output parameters of the instance. In case the instance does not have parameters, null is provided as data container. If the instance has input and/or output parameters, an instance data container will be provided.- Parameters:
instanceID
- The ID of the top-level instance that has finished normally.dataContainer
- The corresponding data container that contains the values of the output parameters of the top-level instance or null in case the instance does not have a data container.
If the instance has been a top-level instance and it has been provided anInstanceDataContainer
in its execution context whenstarted
, this data container will also be anInstanceDataContainer
.
The caller is responsible for closing. That means, implementors may need toDataContainer.clone()
if required longer than or outside of this method.
-
instanceSuspended
void instanceSuspended(UUID instanceID)
Notifies that the designated top-level instance has been suspended. No data container is provided since unlike applications no data needs to be stored intermediately outside of the system in case of a top-level instance.- Parameters:
instanceID
- The ID of the top-level instance that has been suspended.
-
instanceResumed
void instanceResumed(UUID instId, URI[] newListener)
Notifies that the designated top-level instance has been resumed. No data container is provided since unlike applications no data needs to be stored intermediately outside of the system in case of a top-level instance.- Parameters:
instId
- The ID of the top-level instance that has been resumed.newListener
- The URIs of the listener that has been registered when resuming ornull
in case no listener has been registered when resuming (that is, the old listener remains). If a new listener has been registered, this listener will not be notified any more.
-
instanceFailed
void instanceFailed(UUID instanceID, DataContainer dataContainer, String errorMessage, String state, long errorCode)
Notifies that the designated top-level instance has failed and provides the necessary failure information.- Parameters:
instanceID
- The ID of the top-level instance that failed or was aborted.dataContainer
- The corresponding data container that contains the values of the output parameters of the top-level instance which have been produced until the failure occurred or null in case the instance does not have a data container. Please note that many output parameters may be Null due to the failure.
If the instance has been a top-level instance and it has been provided anInstanceDataContainer
in its execution context whenstarted
, this data container will also be anInstanceDataContainer
.
The caller is responsible for closing. That means, implementors may need toDataContainer.clone()
if required longer than or outside of this method.errorMessage
- The error message to be interpreted by a user or by a failure handling routine.state
- Arbitrary state information specific to the instance, comparable to the vendor code inSQLException
errorCode
- The error code specifying the type of error.
-
autoStartPending
void autoStartPending(EBPInstanceReference activity, long terminationTime, QualifiedAgent agent, URI[] runtimeManager, boolean rtmResolved)
Notifies that the designated activity may be autostarted. The previous node has been terminated at the previous time (System.currentTimeMillis()
). The auto start should take place on the designated runtime manager.- Parameters:
activity
- The activity which may be autostarted.terminationTime
- The termination time of the preceeding node of the designated activity (asSystem.currentTimeMillis()
). This allows to decide whether autostarting is still feasible, e. g. autostart should not take place if too much time has elapsed since the termination of the previous node.agent
- The agent for whom to autostart including the corresponding user session ID if available.
Note that QualifiedAgent.equals(Object) does not consider the user session ID.runtimeManager
- The URI of the runtime manager in which the activity should be autostarted. If this isnull
, no specific runtime manager has been set. Otherwise the URIs do not refer to a runtime manager or the corresponding runtime manager prefers to be notified instead of a pushed autostart. Refer tortmResolved
to distinguish both cases.rtmResolved
- Whether the runtime manager has been successfully resolved, that is, the URIs specify a runtime manager but this wants a notification instead of a pushed autostart.
-
-