Class InstanceStateNotificationWrapper

    • Field Detail

      • 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.
      • logger

        protected final Logger logger
        The logger used for transforming data containers to ILM.
      • regUris

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

      • InstanceStateNotificationWrapper

        public InstanceStateNotificationWrapper​(InstanceStateCallback isc,
                                                boolean ignoreResumed,
                                                SessionToken session,
                                                ConcurrentMap<UUID,​InstanceStateNotificationWrapper> listeners,
                                                LocalInstanceStateNotifier lisn,
                                                Logger logger)
        Creates a new wrapper for the designated InstanceStateCallback.
        Parameters:
        isc - The InstanceStateCallback to wrap.
        ignoreResumed - Whether this wrapper has been created when resuming. This skips the first resume notification.
        session - The session token for unregistering in cleanup(UUID). This must not be null
        listeners - The map to unregister from in cleanup(UUID). This must not be null
        lisn - The instance state listener to unregister from in cleanup(UUID). This must not be null
        logger - The logger used for transforming data containers to ILM.
    • Method Detail

      • init

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

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

        public UUID getId()
        Gets the ID of the wrapped InstanceStateCallback-instance.
        Returns:
        The ID of the wrapped InstanceStateCallback-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 InstanceStateNotification has been registered in case it is the wrapper for the designated callback ID or null.
      • instanceFinished

        public void instanceFinished​(UUID instId,
                                     DataContainer dc)
        Description copied from interface: InstanceStateNotification
        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.
        Specified by:
        instanceFinished in interface InstanceStateNotification
        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 an InstanceDataContainer in its execution context when started, this data container will also be an InstanceDataContainer.
        The caller is responsible for closing. That means, implementors may need to DataContainer.clone() if required longer than or outside of this method.
      • instanceSuspended

        public void instanceSuspended​(UUID instId)
        Description copied from interface: InstanceStateNotification
        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.
        Specified by:
        instanceSuspended in interface InstanceStateNotification
        Parameters:
        instId - The ID of the top-level instance that has been suspended.
      • instanceResumed

        public void instanceResumed​(UUID instId,
                                    URI[] newListener)
        Description copied from interface: InstanceStateNotification
        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.
        Specified by:
        instanceResumed in interface InstanceStateNotification
        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 or null 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

        public void instanceFailed​(UUID instId,
                                   DataContainer dc,
                                   String errorMessage,
                                   String state,
                                   long errorCode)
        Description copied from interface: InstanceStateNotification
        Notifies that the designated top-level instance has failed and provides the necessary failure information.
        Specified by:
        instanceFailed in interface InstanceStateNotification
        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 an InstanceDataContainer in its execution context when started, this data container will also be an InstanceDataContainer.
        The caller is responsible for closing. That means, implementors may need to DataContainer.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 SQLException.
        errorCode - 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: InstanceStateNotification
        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.
        Specified by:
        autoStartPending in interface InstanceStateNotification
        Parameters:
        act - The activity which may be autostarted.
        termTime - The termination time of the preceeding node of the designated activity (as System.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 is null, 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 to rtmResolved 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.
      • toIlmDc

        protected DataContainer toIlmDc​(UUID instId,
                                        DataContainer dc)
        Gets the ILM data container for the designated data container or null if the designated data container is null.
        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 and null will 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 or null.
        Returns:
        The ILM data container for the designated data container or null if the designated data container is null.
      • cleanup

        protected void cleanup​(UUID instId)
        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.