Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jboss.soa.esb.listeners.lifecycle
Class AbstractManagedLifecycle

    java.lang.Object
      org.jboss.soa.esb.listeners.lifecycle.AbstractManagedLifecycle

All Implemented Interfaces:
  java.io.Serializable, ManagedLifecycle

Direct Known Subclasses:
  AbstractFileGateway, AbstractThreadedManagedLifecycle, HibernateGatewayListener, JBossRemotingGatewayListener, JcaGatewayListener, JcaInflowGateway, JcaMessageAwareListener, MockListener, ScheduleListener

    public abstract class AbstractManagedLifecycle

extends java.lang.Object
implements ManagedLifecycle, java.io.Serializable

This class represents the lifecycle for a managed instance.

Author:
  kevin
See Also:
  Serialized Form

Field Summary
`static java.lang.String` | `PARAM_TERMINATION_PERIOD` The name of the attribute specifying the termination period.

Constructor Summary
`protected` | `AbstractManagedLifecycle(ConfigTree config)` Construct the managed lifecycle.

Method Summary
`void` | `addManagedLifecycleEventListener(ManagedLifecycleEventListener listener)` Add a managed lifecycle event listener.
`protected void` | `changeState(ManagedLifecycleState newState)` Change the state of the managed instance.
`void` | `destroy()` Destroy the managed instance.
`protected abstract void` | `doDestroy()` Handle the destroy of the managed instance.
`protected abstract void` | `doInitialise()` Handle the initialisation of the managed instance.
`protected abstract void` | `doStart()` Handle the start of the managed instance.
`protected abstract void` | `doStop()` Handle the stop of the managed instance.
`ConfigTree` | `getConfig()` Get the configuration associated with this lifecycle.
`ManagedLifecycleState` | `getState()` Get the state of the managed instance.
`protected long` | `getTerminationPeriod()` Get the termination period for this service.
`void` | `initialise()` Initialise the managed instance.
`void` | `removeManagedLifecycleEventListener(ManagedLifecycleEventListener listener)` Remove a managed lifecycle event listener.
`void` | `start()` Start the managed instance.
`void` | `stop()` Stop the managed instance.
`boolean` | `waitUntilDestroyed()` Wait until the managed instance has transitioned into the DESTROYED state.
`boolean` | `waitUntilDestroyed(long transitionPeriod)` Wait until the managed instance has transitioned into the DESTROYED state.
`protected boolean` | `waitUntilNotState(ManagedLifecycleState state, long transitionPeriod)` Wait until the managed instance is not in the specified state.
`protected boolean` | `waitUntilState(ManagedLifecycleState state, long transitionPeriod)` Wait until the managed instance has transitioned into the specified state.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### PARAM_TERMINATION_PERIOD

    public static final java.lang.String PARAM_TERMINATION_PERIOD

  The name of the attribute specifying the termination period.

  See Also:
    Constant Field Values

Constructor Detail

### AbstractManagedLifecycle

    protected AbstractManagedLifecycle(ConfigTree config)
                                throws ConfigurationException

  Construct the managed lifecycle.

  Parameters:
    `config` - The configuration associated with this instance.
  Throws:
    `ConfigurationException` - for configuration errors during initialisation.

Method Detail

### initialise

    public final void initialise()
                          throws ManagedLifecycleException

  Initialise the managed instance.

  This method is called after the managed instance has been instantiated so that configuration options can be validated.

  Specified by:
    `initialise` in interface `ManagedLifecycle`
  Throws:
    `ManagedLifecycleException` - for errors during initialisation.

### doInitialise

    protected abstract void doInitialise()
                                  throws ManagedLifecycleException

  Handle the initialisation of the managed instance.

  Throws:
    `ManagedLifecycleException` - for errors while initialisation.

### start

    public final void start()
                     throws ManagedLifecycleException

  Start the managed instance.

  This method is called to inform the managed instance that it can initialise resources prior to enabling the service.

  Specified by:
    `start` in interface `ManagedLifecycle`
  Throws:
    `ManagedLifecycleException`

### doStart

    protected abstract void doStart()
                             throws ManagedLifecycleException

  Handle the start of the managed instance.

  Throws:
    `ManagedLifecycleException` - for errors while starting.

### stop

    public final void stop()
                    throws ManagedLifecycleException

  Stop the managed instance.

  This method is called to inform the managed instance that it must disable resources associated with the running service. The service may choose to disable the resources asynchronously provided that any subsequent call to `start()` or `destroy()` blocks until these resources have been disabled.

  Specified by:
    `stop` in interface `ManagedLifecycle`
  Throws:
    `ManagedLifecycleException`

### doStop

    protected abstract void doStop()
                            throws ManagedLifecycleException

  Handle the stop of the managed instance.

  Throws:
    `ManagedLifecycleException` - for errors while stopping.

### destroy

    public final void destroy()
                       throws ManagedLifecycleException

  Destroy the managed instance.

  This method is called prior to the release of the managed instance. All resources associated with this managed instance should be released as the instance will no longer be used.

  Specified by:
    `destroy` in interface `ManagedLifecycle`
  Throws:
    `ManagedLifecycleException`

### doDestroy

    protected abstract void doDestroy()
                               throws ManagedLifecycleException

  Handle the destroy of the managed instance.

  Throws:
    `ManagedLifecycleException` - for errors while destroying.

### getState

    public ManagedLifecycleState getState()

  Get the state of the managed instance.

  Specified by:
    `getState` in interface `ManagedLifecycle`
  Returns:
    The managed instance state.

### changeState

    protected void changeState(ManagedLifecycleState newState)
                        throws ManagedLifecycleException

  Change the state of the managed instance.

  Parameters:
    `newState` - The new state of the managed instance.
  Throws:
    `ManagedLifecycleException`

### getTerminationPeriod

    protected long getTerminationPeriod()

  Get the termination period for this service.

  Returns:
    The termination period.

### waitUntilDestroyed

    public boolean waitUntilDestroyed()

  Wait until the managed instance has transitioned into the DESTROYED state.

  Specified by:
    `waitUntilDestroyed` in interface `ManagedLifecycle`
  Returns:
    true if the transition occurs within the expected period, false otherwise.

### waitUntilDestroyed

    public boolean waitUntilDestroyed(long transitionPeriod)

  Wait until the managed instance has transitioned into the DESTROYED state.

  Specified by:
    `waitUntilDestroyed` in interface `ManagedLifecycle`
  Parameters:
    `transitionPeriod` - The maximum delay expected for the transition, specified in milliseconds.
  Returns:
    true if the transition occurs within the expected period, false otherwise.

### waitUntilState

    protected boolean waitUntilState(ManagedLifecycleState state,
                                     long transitionPeriod)

  Wait until the managed instance has transitioned into the specified state.

  Parameters:
    `state` - The expected state.
    `transitionPeriod` - The maximum delay expected for the transition, specified in milliseconds.
  Returns:
    true if the transition occurs within the expected period, false otherwise.

### waitUntilNotState

    protected boolean waitUntilNotState(ManagedLifecycleState state,
                                        long transitionPeriod)

  Wait until the managed instance is not in the specified state.

  Parameters:
    `state` - The original state.
    `transitionPeriod` - The maximum delay expected for the transition, specified in milliseconds.
  Returns:
    true if the transition occurs within the expected period, false otherwise.

### addManagedLifecycleEventListener

    public void addManagedLifecycleEventListener(ManagedLifecycleEventListener listener)

  Add a managed lifecycle event listener.

  Specified by:
    `addManagedLifecycleEventListener` in interface `ManagedLifecycle`
  Parameters:
    `listener` - The listener.

### removeManagedLifecycleEventListener

    public void removeManagedLifecycleEventListener(ManagedLifecycleEventListener listener)

  Remove a managed lifecycle event listener.

  Specified by:
    `removeManagedLifecycleEventListener` in interface `ManagedLifecycle`
  Parameters:
    `listener` - The listener.

### getConfig

    public ConfigTree getConfig()

  Get the configuration associated with this lifecycle.

  Specified by:
    `getConfig` in interface `ManagedLifecycle`
  Returns:
    The instance configuration.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD