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 an ActivityStateCallback and forwards calls to ActivityStateNotification appropriately.
  • Field Details

    • 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 in cleanup().
    • jActivity

      protected final EBPInstanceReference jActivity
      The (Java) activity for unregistering in cleanup().
    • listeners

      The map to unregister from in cleanup().
    • lasn

      protected final LocalActivityStateNotifier lasn
      The activity state listener to unregister from in cleanup().
    • regUris

      protected URI[] regUris
      The URIs with which this ActivityStateNotification has been registered.
  • Constructor Details

  • Method Details

    • init

      public void init(URI[] uris)
      Sets the URIs with which this ActivityStateNotification has been registered.
      Parameters:
      uris - The URIs with which this ActivityStateNotification has been registered This must not be null nor empty.
    • getUris

      public URI[] getUris()
      Gets the URIs with which this ActivityStateNotification has been registered or null.
      Returns:
      The URIs with which this ActivityStateNotification has been registered.
    • getId

      public UUID getId()
      Gets the ID of the wrapped ActivityStateCallback-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 or null.
    • 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 interface ActivityStateNotification
      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 interface ActivityStateNotification
      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 a ResumingRuntimeManager and thus there will be a resume and further notifications afterwards.
      Specified by:
      activitySuspended in interface ActivityStateNotification
      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 interface ActivityStateNotification
      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 or null 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:
    • 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 interface ActivityStateNotification
      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 interface ActivityStateNotification
      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 interface ActivityStateNotification
      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.