Class
Tree
          
SUMMARY: INNER | FIELD | CONSTR | METHODDETAIL: FIELD | CONSTR | METHOD
 

com.newstep.solid.management.runtime
Class AsyncManagedExecutable
All Implemented Interfaces:
       ManagedExecutable
Direct Known Subclasses:
       ChannelAccessPoint, Component, ExceptionAsynExec, ManagedThread, NonSuspendableAsyncExec, ReplicationService, SuspendableAsyncExec, ThreePassProcessor

public abstract class AsyncManagedExecutable      
Provides default state management for asyncronous executables.
AsyncManagedExecutable provides validation for the basic state transitions
and implements the ManagedExectuableListener notification.


On invocation AsyncManagedExecutable will transition to an transient
state and invoke the associated abstract method to kick-off the process of
transitioning the executable to the target state. For example, when an IDLE
asynchronous executable is started, AsyncManagedExecutable will transition
to the transient STARTING state and invoke the doStart() method
on the implementation. The implementation will kick-off the starting process
and return. When the implemenation reaches the RUNNING state it MUST
indicate it's arrival through the running() callback.

NOTE: it is the responsibility of the implementor to indicate when
they reach the target state by invoking one of the following:

  • running(): invoked to indicate that the executable has reached the RUNNING state

  • suspended(): invoked to indicate that the executable has reached the SUSPENDED state

  • done(): invoked to indicate that the executable has reached the DONE state

  • error(): invoked to indicate that the executable has reached the ERROR state



  • extending AsyncManagedExecutable requires implementations for the following
    methods:

  • doStart(): kick-off executable startup

  • doStop(): kick-off executable stop

  • doRestart(): kick-off executable restart

  • doShutdown(): kick-off executable graceful shutdown

  • doSuspend(): kick-off suspension of execution

  • doResume(): kick-off resuming of execution


  • NOTE: If the implementation throws and exception during its
    do...() method, AsyncManagedExecutable will automatically
    transition to exectuable to ERROR and rethrow the exception.


    NOTE: the AsyncManagedExecutable implementation has a default
    implementation for doSuspend, doResume, and doRestart that throw an ExecutableException
    indicating that the suspend/resume/restart operation is not supported


    NOTE:invoking these from the body of your
    do...() method renders the implemenation of the operation
    synchronous. You should reconsider using the SyncManagedExecutable if this
    is true for all your transitions.

    Abstract.
    Implements:
    ManagedExecutable
     
    Links:
    Kernel Association Association Link
    to Enumeration ExecState
    Associates type:
    association
    Client cardinality:
    1
    Client navigability:
    NOT NAVIGABLE
    Client visibility:
    private
    Supplier cardinality:
    1
    Supplier navigability:
    NAVIGABLE
    Supplier visibility:
    private
     
    Implementation Implementation Link
    to Interface ManagedExecutable
    Provides default state management for asyncronous executables.
    AsyncManagedExecutable provides validation for the basic state transitions
    and implements the ManagedExectuableListener notification.


    On invocation AsyncManagedExecutable will transition to an transient
    state and invoke the associated abstract method to kick-off the process of
    transitioning the executable to the target state. For example, when an IDLE
    asynchronous executable is started, AsyncManagedExecutable will transition
    to the transient STARTING state and invoke the doStart() method
    on the implementation. The implementation will kick-off the starting process
    and return. When the implemenation reaches the RUNNING state it MUST
    indicate it's arrival through the running() callback.

    NOTE: it is the responsibility of the implementor to indicate when
    they reach the target state by invoking one of the following:

  • running(): invoked to indicate that the executable has reached the RUNNING state

  • suspended(): invoked to indicate that the executable has reached the SUSPENDED state

  • done(): invoked to indicate that the executable has reached the DONE state

  • error(): invoked to indicate that the executable has reached the ERROR state



  • extending AsyncManagedExecutable requires implementations for the following
    methods:

  • doStart(): kick-off executable startup

  • doStop(): kick-off executable stop

  • doRestart(): kick-off executable restart

  • doShutdown(): kick-off executable graceful shutdown

  • doSuspend(): kick-off suspension of execution

  • doResume(): kick-off resuming of execution


  • NOTE: If the implementation throws and exception during its
    do...() method, AsyncManagedExecutable will automatically
    transition to exectuable to ERROR and rethrow the exception.


    NOTE: the AsyncManagedExecutable implementation has a default
    implementation for doSuspend, doResume, and doRestart that throw an ExecutableException
    indicating that the suspend/resume/restart operation is not supported


    NOTE:invoking these from the body of your
    do...() method renders the implemenation of the operation
    synchronous. You should reconsider using the SyncManagedExecutable if this
    is true for all your transitions.

     
     

    Field Summary
    private final static String
    private String
    private List
    private static Logger
    private ExecState
    Constructor Summary
    public void
    Method Summary
    public synchronized void
    protected synchronized final void
    protected void
    protected void
    protected abstract void
    protected abstract void
    protected abstract void
    protected void
    protected synchronized final void
    public synchronized ExecState
    public synchronized void
    public synchronized void
    protected synchronized final void
    private void
    public synchronized void
    public synchronized void
    public synchronized void
    public synchronized void
    protected synchronized final void
    Field Detail
    className
    private final static String className
    Final.
    Multiplicity:
    1
    Static.
     

    derivedName
    private String derivedName
    Multiplicity:
    1
     

    listeners
    private List listeners
    Multiplicity:
    1
     

    logger
    private static Logger logger
    Multiplicity:
    1
    Static.
     

    state
    ExecState state
     

    state
    private ExecState state
    Multiplicity:
    1
     
    Constructor Detail
    AsyncManagedExecutable
    public void AsyncManagedExecutable ()
     
    initializes the asynchronous executable by creating its logger,
    initializing its listeners list and setting the state to IDLE.
    Stereotype:
    create
     
    Method Detail
    addListener
    public synchronized void addListener (ManagedExecutableListener listener)
     
    adds the specified ManagedExecutableListener to its notification list
    Parameters:
    listener the ManagedExecutableListener to add to its notification list
    Synchronized.
     

    done
    protected synchronized final void done ()
     
    transitions the executable to the DONE state and ensures that it may
    only be transitioned from the DONE, STOPPING and SHUTTINGDOWN states


    NOTE: done() MUST be invoked by AsyncManagedExecutable
    implementations to indicate that they have reached the DONE state.


    NOTE:invoking done() from the body of your
    doStop() or doShutdown() methods creates a
    synchronous implementation of the transition. You may reconsider using the
    SyncManagedExecutable if this is true for all your transitions.

    Final.
    Synchronized.
    Throws:
    ExecutableException
     

    doRestart
    protected void doRestart ()
     
    MUST be overriden to allow executable restart
    (transition from DONE to STARTING)


    NOTE: AsyncManagedExecutable implementations MUST invoke the
    running() method to indicate that they have reached the
    RUNNING state.

    Throws:
    ExecutableException
     

    doResume
    protected void doResume ()
     
    MUST be overriden to kick-off the resuming of execution


    NOTE: AsyncManagedExecutable implementations MUST invoke the
    running() method to indicate that they have reached the
    RUNNING state.

    Throws:
    ExecutableException
     

    doShutdown
    protected abstract void doShutdown ()
     
    MUST be overriden to kick-off the graceful shutdown of execution


    NOTE: AsyncManagedExecutable implementations MUST invoke the
    idle() method to indicate that they have reached the
    IDLE state.

    Abstract.
    Throws:
    ExecutableException
     

    doStart
    protected abstract void doStart ()
     
    MUST be overriden to perform the execution startup


    NOTE: AsyncManagedExecutable implementations MUST invoke the
    running() method to indicate that they have reached the
    RUNNING state.

    Abstract.
    Throws:
    ExecutableException
     

    doStop
    protected abstract void doStop ()
     
    MUST be overriden to kick-off the termination of execution


    NOTE: AsyncManagedExecutable implementations MUST invoke the
    idle() method to indicate that they have reached the
    IDLE state.

    Abstract.
    Throws:
    ExecutableException
     

    doSuspend
    protected void doSuspend ()
     
    MUST be overriden to kick-off the suspension of execution


    NOTE: AsyncManagedExecutable implementations MUST invoke the
    suspended() method to indicate that they have reached the
    SUSPENDED state.

    Throws:
    ExecutableException
     

    error
    protected synchronized final void error ()
     
    transitions the executable to the ERROR state and ensures that it may
    be transitioned from any state


    NOTE: error() MUST be invoked by AsyncManagedExecutable
    implementations to indicate that they have reached the ERROR state.

    Final.
    Synchronized.
     

    getState
    public synchronized ExecState getState ()
     
    Return:
    ExecState the current state of the executable
    Synchronized.
     

    removeListener
    public synchronized void removeListener (ManagedExecutableListener listener)
     
    removes the specified ManagedExectuableListener from its notification list
    Parameters:
    listener the ManagedExecutableListener to remove from the notification list
    Synchronized.
     

    resume
    public synchronized void resume ()
     
    initiates the transition from SUSPENDED to RUNNING by placing the executable
    in the RESUMING state and invoking the doResume() method.


    NOTE:

  • resume() may only be invoked on
    AsyncManagedExecutables that are in the RUNNING or SUSPENDED state

  • implementations of the AsyncManagedExecutable method MUST
    invoke the running() method to indicate that they have
    reached the RUNNING state.


  • NOTE:invokingrunning() from the body of your
    doResume() method creates a synchronous implementation of the
    transition. You may reconsider using the SyncManagedExecutable if this
    is true for all your transitions.

    Synchronized.
    Throws:
    ExecutableException
     

    running
    protected synchronized final void running ()
     
    transitions the executable to the RUNNING state and ensures that it may
    only be transitioned from the RUNNING, STARTING and RESUMING states


    NOTE: running() MUST be invoked by AsyncManagedExecutable
    implementations to indicate that they have reached the RUNNING state.


    NOTE:invoking running() from the body of your
    doStart() or doResume() methods creates a
    synchronous implementation of the transition. You may reconsider using the
    SyncManagedExecutable if this is true for all your transitions.

    Final.
    Synchronized.
    Throws:
    ExecutableException
     

    setState
    private void setState (ExecState state)
     
    assigns the specified state value to the executable and notifies all
    associated listeners of the state change.
     

    shutdown
    public synchronized void shutdown ()
     
    initiates the graceful transition to DONE by placing the executable
    in the SHUTTINGDOWN state and invoking the doShutdown() method.


    NOTE:

  • shutdown() may only be invoked on
    AsyncManagedExecutables that are in the DONE and RUNNING states

  • implementations of the AsyncManagedExecutable method MUST
    invoke the done() method to indicate that they have
    reached the DONE state.


  • NOTE:invokingdone() from the body of your
    doShutdown() method creates a synchronous implementation of the
    transition. You may reconsider using the SyncManagedExecutable if this
    is true for all your transitions.

    Synchronized.
    Throws:
    ExecutableException
     

    start
    public synchronized void start ()
     
    initiates the transition from IDLE to RUNNING by placing the executable
    in the STARTING state and invoking the doStart() method.


    NOTE:

  • start() may only be invoked on
    AsyncManagedExecutables that are in the IDLE or RUNNING state

  • implementations of the AsyncManagedExecutable method MUST
    invoke the running() method to indicate that they have
    reached the RUNNING state.


  • NOTE:invoking running() from the body of your
    doStart() method creates a synchronous implementation of the
    transition. You may reconsider using the SyncManagedExecutable if this
    is true for all your transitions.

    Synchronized.
    Throws:
    ExecutableException
     

    stop
    public synchronized void stop ()
     
    initiates the transition to DONE by placing the executable
    in the STOPPING state and invoking the doStop() method.


    NOTE:

  • stop() may only be invoked on
    AsyncManagedExecutables that are in the DONE, RUNNING, SUSPENDED, or SHUTTINGDOWN states

  • implementations of the AsyncManagedExecutable method MUST
    invoke the done() method to indicate that they have
    reached the DONE state.


  • NOTE:invokingdone() from the body of your
    doStop() method creates a synchronous implementation of the
    transition. You may reconsider using the SyncManagedExecutable if this
    is true for all your transitions.

    Synchronized.
    Throws:
    ExecutableException
     

    suspend
    public synchronized void suspend ()
     
    initiates the transition from RUNNING to SUSPENDED by placing the executable
    in the SUSPENDING state and invoking the doSuspend() method.


    NOTE:

  • suspend() may only be invoked on
    AsyncManagedExecutables that are in the SUSPENDED and RUNNING states

  • implementations of the AsyncManagedExecutable method MUST
    invoke the suspended() method to indicate that they have
    reached the SUSPENDED state.


  • NOTE:invokingsuspended() from the body of your
    doSuspdend() method creates a synchronous implementation of the
    transition. You may reconsider using the SyncManagedExecutable if this
    is true for all your transitions.

    Synchronized.
    Throws:
    ExecutableException
     

    suspended
    protected synchronized final void suspended ()
     
    transitions the executable to the SUSPENDED state and ensures that it may
    only be transitioned from the SUSPENDED and SUSPENDING states


    NOTE: suspended() MUST be invoked by AsyncManagedExecutable
    implementations to indicate that they have reached the SUSPENDED state.


    NOTE:invoking suspended() from the body of your
    doSuspend() method creates a synchronous implementation
    of the transition. You may reconsider using the SyncManagedExecutable if
    this is true for all your transitions.

    Final.
    Synchronized.
    Throws:
    ExecutableException
     

    Class
    Tree
              
    SUMMARY: INNER | FIELD | CONSTR | METHODDETAIL: FIELD | CONSTR | METHOD