Class InstanceStateNotificationWrapper
java.lang.Object
de.aristaflow.ilm.core.executionmanager.InstanceStateNotificationWrapper
- All Implemented Interfaces:
InstanceStateNotification
This class wraps an
InstanceStateCallback and forwards calls to
InstanceStateNotification appropriately.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected UUIDThe ID of the notification callback used after the current resume.protected booleanWhether this wrapper has been created when resuming.protected final InstanceStateCallbackThe object to which to forward calls to.protected final LocalInstanceStateNotifierThe instance state listener to unregister from incleanup(UUID).protected final ConcurrentMap<UUID,InstanceStateNotificationWrapper> The map to unregister from incleanup(UUID).protected final LoggerThe logger used for transforming data containers to ILM.protected URI[]The URIs with which thisInstanceStateNotificationhas been registered.protected final SessionTokenThe session token for unregistering incleanup(UUID). -
Constructor Summary
ConstructorsConstructorDescriptionInstanceStateNotificationWrapper(InstanceStateCallback isc, boolean ignoreResumed, SessionToken session, ConcurrentMap<UUID, InstanceStateNotificationWrapper> listeners, LocalInstanceStateNotifier lisn, Logger logger) Creates a new wrapper for the designatedInstanceStateCallback. -
Method Summary
Modifier and TypeMethodDescriptionvoidautoStartPending(EBPInstanceReference act, long termTime, QualifiedAgent agent, URI[] rtMgr, boolean rtmResolved) Notifies that the designated activity may be autostarted.protected voidRemoves this wrapper from the map of listeners and from the global instance state listener for a specific instance.getId()Gets the ID of the wrappedInstanceStateCallback-instance.URI[]getUris()Gets the URIs with which thisInstanceStateNotificationhas been registered ornull.voidSets the URIs with which thisInstanceStateNotificationhas been registered.voidinstanceFailed(UUID instId, DataContainer dc, String errorMessage, String state, long errorCode) Notifies that the designated top-level instance has failed and provides the necessary failure information.voidinstanceFinished(UUID instId, DataContainer dc) Notifies that the designated top-level instance has finished normally and provides the output parameters of the instance.voidinstanceResumed(UUID instId, URI[] newListener) Notifies that the designated top-level instance has been resumed.voidinstanceSuspended(UUID instId) Notifies that the designated top-level instance has been suspended.URI[]Sets the ID of the callback used after resuming.protected DataContainertoIlmDc(UUID instId, DataContainer dc) Gets the ILM data container for the designated data container ornullif the designated data container isnull.
-
Field Details
-
isc
The object to which to forward calls to. -
ignoreResumed
protected boolean ignoreResumedWhether this wrapper has been created when resuming. This skips the first resume notification. -
callbackAfterResume
The ID of the notification callback used after the current resume. -
session
The session token for unregistering incleanup(UUID). -
listeners
The map to unregister from incleanup(UUID). -
lisn
The instance state listener to unregister from incleanup(UUID). -
logger
The logger used for transforming data containers to ILM. -
regUris
The URIs with which thisInstanceStateNotificationhas been registered.
-
-
Constructor Details
-
InstanceStateNotificationWrapper
public InstanceStateNotificationWrapper(InstanceStateCallback isc, boolean ignoreResumed, SessionToken session, ConcurrentMap<UUID, InstanceStateNotificationWrapper> listeners, LocalInstanceStateNotifier lisn, Logger logger) Creates a new wrapper for the designatedInstanceStateCallback.- Parameters:
isc- TheInstanceStateCallbackto wrap.ignoreResumed- Whether this wrapper has been created when resuming. This skips the first resume notification.session- The session token for unregistering incleanup(UUID). This must not benulllisteners- The map to unregister from incleanup(UUID). This must not benulllisn- The instance state listener to unregister from incleanup(UUID). This must not benulllogger- The logger used for transforming data containers to ILM.
-
-
Method Details
-
init
Sets the URIs with which thisInstanceStateNotificationhas been registered.- Parameters:
uris- The URIs with which thisInstanceStateNotificationhas been registered This must not benullnor empty.
-
getUris
Gets the URIs with which thisInstanceStateNotificationhas been registered ornull.- Returns:
- The URIs with which this
InstanceStateNotificationhas been registered.
-
getId
Gets the ID of the wrappedInstanceStateCallback-instance.- Returns:
- The ID of the wrapped
InstanceStateCallback-instance.
-
setCallbackAfterResume
Sets the ID of the callback used after resuming. This is required to determine whether it is the same or a different notification. This is also part of the notification interface.- Parameters:
id- The ID of the notification callback used after the current resume.- Returns:
- The URIs with which this
InstanceStateNotificationhas been registered in case it is the wrapper for the designated callback ID ornull.
-
instanceFinished
Description copied from interface:InstanceStateNotificationNotifies 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.- Specified by:
instanceFinishedin interfaceInstanceStateNotification- Parameters:
instId- The ID of the top-level instance that has finished normally.dc- 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 anInstanceDataContainerin 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
Description copied from interface:InstanceStateNotificationNotifies 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.- Specified by:
instanceSuspendedin interfaceInstanceStateNotification- Parameters:
instId- The ID of the top-level instance that has been suspended.
-
instanceResumed
Description copied from interface:InstanceStateNotificationNotifies 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.- Specified by:
instanceResumedin interfaceInstanceStateNotification- 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 ornullin 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
public void instanceFailed(UUID instId, DataContainer dc, String errorMessage, String state, long errorCode) Description copied from interface:InstanceStateNotificationNotifies that the designated top-level instance has failed and provides the necessary failure information.- Specified by:
instanceFailedin interfaceInstanceStateNotification- Parameters:
instId- The ID of the top-level instance that failed or was aborted.dc- 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 anInstanceDataContainerin 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 in.SQLExceptionerrorCode- The error code specifying the type of error.
-
autoStartPending
public void autoStartPending(EBPInstanceReference act, long termTime, QualifiedAgent agent, URI[] rtMgr, boolean rtmResolved) Description copied from interface:InstanceStateNotificationNotifies 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.- Specified by:
autoStartPendingin interfaceInstanceStateNotification- Parameters:
act- The activity which may be autostarted.termTime- 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.rtMgr- 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 tortmResolvedto 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.
-
toIlmDc
Gets the ILM data container for the designated data container ornullif the designated data container isnull.
If there are problems determining the input and output parameters of the instance since the corresponding process manager cannot be retrieved, this will be logged andnullwill be returned.- Parameters:
instId- The ID of the instance to which the data container belongs to.dc- The data container which to transform to ILM ornull.- Returns:
- The ILM data container for the designated data container or
nullif the designated data container isnull.
-
cleanup
Removes this wrapper from the map of listeners and from the global instance state listener for a specific instance.- Parameters:
instId- The ID of the instance for which this wrapper has been listening to.
-