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 anActivityStateCallback
and forwards calls toActivityStateNotification
appropriately.
-
-
Field Summary
Fields Modifier and Type Field Description protected ActivityStateCallback
asc
The object to which to forward calls to.protected UUID
callbackAfterResume
The ID of the notification callback used after the current resume.protected boolean
ignoreResumed
Whether this wrapper has been created when resuming.protected EBPInstanceReference
jActivity
The (Java) activity for unregistering incleanup()
.protected LocalActivityStateNotifier
lasn
The activity state listener to unregister from incleanup()
.protected ConcurrentMap<EBPInstanceReference,ActivityStateNotificationWrapper>
listeners
The map to unregister from incleanup()
.protected URI[]
regUris
The URIs with which thisActivityStateNotification
has been registered.protected SessionToken
session
The 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 void
activityClosed(EBPInstanceReference activity, String sessionId)
Notifies that the designated activity in the designated execution session has been closed.void
activityFailed(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.void
activityReset(EBPInstanceReference activity, String sessionId)
Notifies that the designated activity in the designated execution session has been reset.void
activityResumed(EBPInstanceReference activity, String sessionId, URI[] newListener)
Notifies that the designated activity has been resumed.void
activitySignalled(EBPInstanceReference activity, String sessionId, int signal)
Notifies that the designated activity in the designated execution session has terminated with the designated signal.void
activitySuspended(EBPInstanceReference activity, String sessionId)
Notifies that the designated activity in the designated execution session has been suspended normally.void
activitySuspended(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 void
cleanup()
Removes this wrapper from the map of listeners and from the global activity state listener for a specific activity.UUID
getId()
Gets the ID of the wrappedActivityStateCallback
-instance.URI[]
getUris()
Gets the URIs with which thisActivityStateNotification
has been registered ornull
.void
init(URI[] uris)
Sets the URIs with which thisActivityStateNotification
has 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 thisActivityStateNotification
has 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
- TheActivityStateCallback
to 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 benull
jActivity
- The (Java) activity for unregistering incleanup()
. This must not benull
listeners
- The map to unregister from incleanup()
. This must not benull
lasn
- 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 thisActivityStateNotification
has been registered.- Parameters:
uris
- The URIs with which thisActivityStateNotification
has been registered This must not benull
nor empty.
-
getUris
public URI[] getUris()
Gets the URIs with which thisActivityStateNotification
has been registered ornull
.- Returns:
- The URIs with which this
ActivityStateNotification
has 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
ActivityStateNotification
has 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:ActivityStateNotification
Notifies that the designated activity in the designated execution session has been closed.- Specified by:
activityClosed
in 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:ActivityStateNotification
Notifies that the designated activity in the designated execution session has been suspended normally. There may be an resume and further notifications afterwards.- Specified by:
activitySuspended
in 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:ActivityStateNotification
Notifies 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 aResumingRuntimeManager
and thus there will be a resume and further notifications afterwards.- Specified by:
activitySuspended
in 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:ActivityStateNotification
Notifies 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:
activityResumed
in 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 ornull
in 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:ActivityStateNotification
Notifies that the designated activity in the designated execution session has been reset.- Specified by:
activityReset
in 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:ActivityStateNotification
Notifies that the designated activity in the designated execution session has terminated with the designated signal.- Specified by:
activitySignalled
in 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:ActivityStateNotification
Notifies that the designated activity in the designated execution session has failed with the designated additional failure information.- Specified by:
activityFailed
in 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
.SQLException
errorCode
- 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.
-
-