Class TerminatedActivityState

  • All Implemented Interfaces:
    Serializable

    public class TerminatedActivityState
    extends ActivityState
    This class distinguishes the several termination states of an activity as an extension to the states of the component of an activity. This is closely related to NodeStates. However, the termination state provides additional information depending on the state. This includes the timeout for a suspended activity that wants to be resumed after a specific time, the error information (message, state, code) for a failed activity and the signal in case the activity terminated due to an arbitrary signal. This arbitrary signal is handled by the superclass.

    Note that just like ActivityState TerminatedActivityState is read-only; when changing the state a new ActivityState needs to be created. This also avoids the need for synchronising access to this class.

    Author:
    Ulrich Kreher
    See Also:
    Serialized Form
    • Constructor Detail

      • TerminatedActivityState

        public TerminatedActivityState​(TerminatedActivityState.TerminatedState state)
        Creates a new a TerminatedActivityState for the designated (simple) terminated state. No signal, no suspend timeout and no error information will be set.
        Parameters:
        state - The (simple) terminated state for the created ActivityState.
      • TerminatedActivityState

        public TerminatedActivityState​(long suspendTimeout)
        Creates a new a TerminatedActivityState for a suspended state having the designated suspend timeout. No signal and no error information will be set.
        Parameters:
        suspendTimeout - The timeout in milliseconds the activity wants to be resumed after its suspension.
      • TerminatedActivityState

        public TerminatedActivityState​(int signalledSignal)
        Creates a new a TerminatedActivityState for a signalled state having the designated suspend timeout. No suspend timeout and no error information will be set.
        Parameters:
        signalledSignal - The signal the activity has received that led to the termination.
      • TerminatedActivityState

        public TerminatedActivityState​(String errorMessage,
                                       String errorState,
                                       long errorCode)
        Creates a new a TerminatedActivityState for a failed state having the designated error information. No signal and no suspend timeout will be set.
        Parameters:
        errorMessage - The error message to be interpreted by a user or by a failure handling routine.
        errorState - Arbitrary state information specific to the instance, comparable to the vendor code in SQLException.
        errorCode - The error code specifying the type of error.
    • Method Detail

      • getTerminatedState

        public TerminatedActivityState.TerminatedState getTerminatedState()
        Gets the state of the activity after its termination.
        Returns:
        The state of the activity after its termination.
      • getSuspendTimeout

        public Long getSuspendTimeout()
        Gets the timeout in case the activity has suspended and wants to be resumed after the designated time has elapsed. This will be null in case the activity has not suspended or does not have a timeout for resume.
        Returns:
        The timeout in case the activity has suspended and wants to be resumed or null in case the activity has not suspended or does not have a timeout for resume.
      • getErrorMessage

        public String getErrorMessage()
        Gets the arbitrary message indicating the error in case the activity has failed. This will be null in case the activity has not failed but another terminated state.
        Returns:
        The arbitrary message indicating the error in case the activity has failed or null in case the activity has not failed but another terminated state.
      • getErrorState

        public String getErrorState()
        Gets the arbitrary state indicating the error in case the activity has failed. This will be null in case the activity has not failed but another terminated state.
        Returns:
        The arbitrary state indicating the error in case the activity has failed or null in case the activity has not failed but another terminated state.
      • getErrorCode

        public Long getErrorCode()
        Gets the arbitrary code indicating the error in case the activity has failed. This will be null in case the activity has not failed but another terminated state.
        Returns:
        The arbitrary code indicating the error in case the activity has failed or null in case the activity has not failed but another terminated state.