org.jboss.soa.esb.listeners.lifecycle
Interface ManagedLifecycle

All Known Implementing Classes:
AbstractFileGateway, AbstractManagedLifecycle, AbstractThreadedManagedLifecycle, FileGatewayListener, GroovyGateway, HibernateGatewayListener, JBossRemotingGatewayListener, JcaGatewayListener, JcaInflowGateway, JcaMessageAwareListener, JmsGatewayListener, MessageAwareListener, MockListener, ReadOnlyRemoteGatewayListener, RemoteGatewayListener, ScheduleListener, SqlTableGatewayListener

public interface ManagedLifecycle


Method Summary
 void addManagedLifecycleEventListener(ManagedLifecycleEventListener listener)
          Add a managed lifecycle event listener.
 void destroy()
          Destroy the managed instance.
 ConfigTree getConfig()
          Get the configuration assoicated with the ManagedLifecycle.
 ManagedLifecycleState getState()
          Get the state of the managed instance.
 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.
 

Method Detail

initialise

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.

Throws:
ManagedLifecycleException - for errors during initialisation.

start

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.

Throws:
ManagedLifecycleException

stop

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.

Throws:
ManagedLifecycleException

destroy

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.

Throws:
ManagedLifecycleException

getState

ManagedLifecycleState getState()
Get the state of the managed instance.

Returns:
The managed instance state.

waitUntilDestroyed

boolean waitUntilDestroyed()
Wait until the managed instance has transitioned into the DESTROYED state.

Returns:
true if the transition occurs within the expected period, false otherwise.

waitUntilDestroyed

boolean waitUntilDestroyed(long transitionPeriod)
Wait until the managed instance has transitioned into the DESTROYED state.

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

addManagedLifecycleEventListener

void addManagedLifecycleEventListener(ManagedLifecycleEventListener listener)
Add a managed lifecycle event listener.

Parameters:
listener - The listener.

removeManagedLifecycleEventListener

void removeManagedLifecycleEventListener(ManagedLifecycleEventListener listener)
Remove a managed lifecycle event listener.

Parameters:
listener - The listener.

getConfig

ConfigTree getConfig()
Get the configuration assoicated with the ManagedLifecycle.

Returns:
Configuration.