Class ActivityStateNotificationWrapper
- java.lang.Object
-
- de.aristaflow.ilm.core.runtimemanager.ActivityStateNotificationWrapper
-
- All Implemented Interfaces:
ActivityStateNotification
public class ActivityStateNotificationWrapper extends Object implements ActivityStateNotification
This class wraps anActivityStateCallbackand forwards calls toActivityStateNotificationappropriately.
-
-
Field Summary
Fields Modifier and Type Field Description protected ActivityStateCallbackascThe object to which to forward calls to.protected UUIDcallbackAfterResumeThe ID of the notification callback used after the current resume.protected booleanignoreResumedWhether this wrapper has been created when resuming.protected EBPInstanceReferencejActivityThe (Java) activity for unregistering incleanup().protected LocalActivityStateNotifierlasnThe activity state listener to unregister from incleanup().protected ConcurrentMap<EBPInstanceReference,ActivityStateNotificationWrapper>listenersThe map to unregister from incleanup().protected URI[]regUrisThe URIs with which thisActivityStateNotificationhas been registered.protected SessionTokensessionThe session token for unregistering incleanup().
-
Constructor Summary
Constructors Constructor Description ActivityStateNotificationWrapper(ActivityStateCallback asc, boolean ignoreResumed, SessionToken session, EBPInstanceReference jActivity, ConcurrentMap<EBPInstanceReference,ActivityStateNotificationWrapper> listeners, LocalActivityStateNotifier lasn)Creates a new wrapper for the designatedActivityStateCallback.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactivityClosed(EBPInstanceReference activity, String sessionId)Notifies that the designated activity in the designated execution session has been closed.voidactivityFailed(EBPInstanceReference activity, String sessionId, String errorMessage, String state, long errorCode)Notifies that the designated activity in the designated execution session has failed with the designated additional failure information.voidactivityReset(EBPInstanceReference activity, String sessionId)Notifies that the designated activity in the designated execution session has been reset.voidactivityResumed(EBPInstanceReference activity, String sessionId, URI[] newListener)Notifies that the designated activity has been resumed.voidactivitySignalled(EBPInstanceReference activity, String sessionId, int signal)Notifies that the designated activity in the designated execution session has terminated with the designated signal.voidactivitySuspended(EBPInstanceReference activity, String sessionId)Notifies that the designated activity in the designated execution session has been suspended normally.voidactivitySuspended(EBPInstanceReference activity, String sessionId, long timeout)Notifies that the designated activity in the designated execution session has been suspended and needs to be resumed after the designated timeout.protected voidcleanup()Removes this wrapper from the map of listeners and from the global activity state listener for a specific activity.UUIDgetId()Gets the ID of the wrappedActivityStateCallback-instance.URI[]getUris()Gets the URIs with which thisActivityStateNotificationhas been registered ornull.voidinit(URI[] uris)Sets the URIs with which thisActivityStateNotificationhas been registered.URI[]setCallbackAfterResume(UUID id)Sets the ID of the callback used after resuming.
-
-
-
Field Detail
-
asc
protected final ActivityStateCallback asc
The object to which to forward calls to.
-
ignoreResumed
protected boolean ignoreResumed
Whether this wrapper has been created when resuming. This skips the first resume notification.
-
callbackAfterResume
protected UUID callbackAfterResume
The ID of the notification callback used after the current resume.
-
session
protected final SessionToken session
The session token for unregistering incleanup().
-
jActivity
protected final EBPInstanceReference jActivity
The (Java) activity for unregistering incleanup().
-
listeners
protected final ConcurrentMap<EBPInstanceReference,ActivityStateNotificationWrapper> listeners
The map to unregister from incleanup().
-
lasn
protected final LocalActivityStateNotifier lasn
The activity state listener to unregister from incleanup().
-
regUris
protected URI[] regUris
The URIs with which thisActivityStateNotificationhas been registered.
-
-
Constructor Detail
-
ActivityStateNotificationWrapper
public ActivityStateNotificationWrapper(ActivityStateCallback asc, boolean ignoreResumed, SessionToken session, EBPInstanceReference jActivity, ConcurrentMap<EBPInstanceReference,ActivityStateNotificationWrapper> listeners, LocalActivityStateNotifier lasn)
Creates a new wrapper for the designatedActivityStateCallback.- Parameters:
asc- TheActivityStateCallbackto wrap.ignoreResumed- Whether this wrapper has been created when resuming. This skips the first resume notification.session- The session token for unregistering incleanup(). This must not benulljActivity- The (Java) activity for unregistering incleanup(). This must not benulllisteners- The map to unregister from incleanup(). This must not benulllasn- The activity state listener to unregister from incleanup(). This must not benull
-
-
Method Detail
-
init
public void init(URI[] uris)
Sets the URIs with which thisActivityStateNotificationhas been registered.- Parameters:
uris- The URIs with which thisActivityStateNotificationhas been registered This must not benullnor empty.
-
getUris
public URI[] getUris()
Gets the URIs with which thisActivityStateNotificationhas been registered ornull.- Returns:
- The URIs with which this
ActivityStateNotificationhas been registered.
-
getId
public UUID getId()
Gets the ID of the wrappedActivityStateCallback-instance.- Returns:
- The ID of the wrapped
ActivityStateCallback-instance.
-
setCallbackAfterResume
public URI[] setCallbackAfterResume(UUID id)
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
ActivityStateNotificationhas been registered in case it is the wrapper for the designated callback ID ornull.
-
activityClosed
public void activityClosed(EBPInstanceReference activity, String sessionId)
Description copied from interface:ActivityStateNotificationNotifies that the designated activity in the designated execution session has been closed.- Specified by:
activityClosedin interfaceActivityStateNotification- Parameters:
activity- The activity that has been closed.sessionId- The ID of the execution session of the closed activity.
-
activitySuspended
public void activitySuspended(EBPInstanceReference activity, String sessionId)
Description copied from interface:ActivityStateNotificationNotifies that the designated activity in the designated execution session has been suspended normally. There may be an resume and further notifications afterwards.- Specified by:
activitySuspendedin interfaceActivityStateNotification- Parameters:
activity- The activity that has been suspended normally.sessionId- The ID of the execution session of the suspended activity.
-
activitySuspended
public void activitySuspended(EBPInstanceReference activity, String sessionId, long timeout)
Description copied from interface:ActivityStateNotificationNotifies that the designated activity in the designated execution session has been suspended and needs to be resumed after the designated timeout. Usually this will be started by aResumingRuntimeManagerand thus there will be a resume and further notifications afterwards.- Specified by:
activitySuspendedin interfaceActivityStateNotification- Parameters:
activity- The activity that has been suspended normally.sessionId- The ID of the execution session of the suspended activity.timeout- The time period (in milliseconds) when the suspended application wants to be resumed automatically.
-
activityResumed
public void activityResumed(EBPInstanceReference activity, String sessionId, URI[] newListener)
Description copied from interface:ActivityStateNotificationNotifies that the designated activity has been resumed. This will only be sent if the activity is resumed on the very same runtime manager.- Specified by:
activityResumedin interfaceActivityStateNotification- Parameters:
activity- The activity that has been suspended normally.sessionId- The ID of the new execution session of the resumed activity.newListener- The URIs of the listener that has been registered when resuming ornullin case no listener has been registered when resuming. If a new listener has been registered, this listener will not be notified any more.- See Also:
SynchronousActivityStarting.resumeActivitySynchronously(de.aristaflow.adept2.base.sessionmanagement.SessionToken, EBPInstanceReference)
-
activityReset
public void activityReset(EBPInstanceReference activity, String sessionId)
Description copied from interface:ActivityStateNotificationNotifies that the designated activity in the designated execution session has been reset.- Specified by:
activityResetin interfaceActivityStateNotification- Parameters:
activity- The activity that has been reset.sessionId- The ID of the execution session of the reset activity.
-
activitySignalled
public void activitySignalled(EBPInstanceReference activity, String sessionId, int signal)
Description copied from interface:ActivityStateNotificationNotifies that the designated activity in the designated execution session has terminated with the designated signal.- Specified by:
activitySignalledin interfaceActivityStateNotification- Parameters:
activity- The activity that has been terminated.sessionId- The ID of the execution session of the signalled activity.signal- The signal that led to the termination of the activity.
-
activityFailed
public void activityFailed(EBPInstanceReference activity, String sessionId, String errorMessage, String state, long errorCode)
Description copied from interface:ActivityStateNotificationNotifies that the designated activity in the designated execution session has failed with the designated additional failure information.- Specified by:
activityFailedin interfaceActivityStateNotification- Parameters:
activity- The activity that has failed.sessionId- The ID of the execution session of the failed activity.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.
-
cleanup
protected void cleanup()
Removes this wrapper from the map of listeners and from the global activity state listener for a specific activity.
-
-