## javax.jbi.component
Interface ComponentLifeCycle

    public interface ComponentLifeCycle

This interface must be implemented by a JBI component to provide initialization, start, stop, and shutdown life cycle processing. These methods comprise the life cycle contract between the JBI implementation and the component. The life cycle of a component begins with a call to the init() method on an instance of the component's implementation of this interface, and ends with the first call to the shutDown() method on that instance. Between these two calls, there can be any number of stop() and start() calls.

The JBI implementation must track the running state of a component, and ensure that life cycle state changes are always legal. For example, if the management interface for controlling a component's life cycle (`ComponentLifeCycleMBean`) is used to start a component that was just installed (and thus in the Shutdown state), the implementation must invoke this component's `init(ComponentContext)` method before invoking its `start()` method.

Author:
  JSR208 Expert Group

Method Summary
`javax.management.ObjectName` `getExtensionMBeanName()` Get the JMX object name for the extension MBean for this component; if there is none, return `null`.
`void` `init(ComponentContext context)` Initialize the component.
`void` `shutDown()` Shut down the component.
`void` `start()` Start the component.
`void` `stop()` Stop the component.

Method Detail

### getExtensionMBeanName

    javax.management.ObjectName getExtensionMBeanName()

  Get the JMX object name for the extension MBean for this component; if there is none, return `null`.

  Returns:
    the JMX object name of the additional MBean or `null` if there is no additional MBean.

### init

    void init(ComponentContext context)
              throws JBIException

  Initialize the component. This performs initialization required by the component but does not make it ready to process messages. This method is called once for each life cycle of the component.

  If the component needs to register an additional MBean to extend its life cycle, or provide other component management tasks, it should be registered during this call.

  Parameters:
    `context` - the component's context, providing access to component data provided by the JBI environment; must be non-null.
  Throws:
    `JBIException` - if the component is unable to initialize.

### shutDown

    void shutDown()
                  throws JBIException

  Shut down the component. This performs clean-up, releasing all run-time resources used by the component. Once this method has been called, `init(ComponentContext)` must be called before the component can be started again with a call to `start()`.

  Throws:
    `JBIException` - if the component is unable to shut down.

### start

    void start()
               throws JBIException

  Start the component. This makes the component ready to process messages. This method is called after `init(ComponentContext)`, both when the component is being started for the first time and when the component is being restarted after a previous call to `shutDown()`. If `stop()` was called previously but `shutDown()` was not, `start()` can be called again without another call to `init(ComponentContext)`.

  Throws:
    `JBIException` - if the component is unable to start.

### stop

    void stop()
              throws JBIException

  Stop the component. This makes the component stop accepting messages for processing. After a call to this method, `start()` may be called again without first calling `init(ComponentContext)`.

  Throws:
    `JBIException` - if the component is unable to stop.

${build-info}

${copyright}