org.apache.servicemix.common
Class AsyncBaseLifeCycle

java.lang.Object
  extended by org.apache.servicemix.common.AsyncBaseLifeCycle
All Implemented Interfaces:
javax.jbi.component.ComponentLifeCycle
Direct Known Subclasses:
BaseLifeCycle

public class AsyncBaseLifeCycle
extends Object
implements javax.jbi.component.ComponentLifeCycle

Base class for life cycle management of components. This class may be used as is.

Since:
3.0
Version:
$Revision: 399873 $
Author:
Guillaume Nodet

Field Summary
protected  javax.jbi.messaging.DeliveryChannel channel
           
protected  ServiceMixComponent component
           
protected  javax.jbi.component.ComponentContext context
           
protected  ThreadLocal<String> correlationId
           
protected  String currentState
           
protected  org.apache.servicemix.executors.Executor executor
           
protected  org.apache.servicemix.executors.ExecutorFactory executorFactory
           
static String INITIALIZED
           
protected  Log logger
           
protected  ObjectName mbeanName
           
protected  Thread poller
           
protected  AtomicBoolean polling
           
protected  Map<String,ExchangeProcessor> processors
           
protected  AtomicBoolean running
           
protected  TransactionManager transactionManager
           
protected  boolean workManagerCreated
           
 
Constructor Summary
AsyncBaseLifeCycle()
           
AsyncBaseLifeCycle(ServiceMixComponent component)
           
 
Method Summary
protected  org.apache.servicemix.executors.ExecutorFactory createExecutorFactory()
           
protected  ObjectName createExtensionMBeanName()
           
protected  void doInit()
           
protected  void doShutDown()
           
protected  void doStart()
           
protected  void doStop()
           
protected  boolean exceptionShouldRollbackTx(Exception e)
           
protected  org.apache.servicemix.executors.ExecutorFactory findExecutorFactory()
           
 javax.jbi.component.ComponentContext getContext()
           
 String getCurrentState()
           
 QName getEPRServiceName()
           
 org.apache.servicemix.executors.Executor getExecutor()
           
protected  Object getExtensionMBean()
           
 ObjectName getExtensionMBeanName()
           
protected  Endpoint getResolvedEPR(javax.jbi.servicedesc.ServiceEndpoint ep)
          Handle an exchange sent to an EPR resolved by this component
 void init(javax.jbi.component.ComponentContext context)
           
 boolean isInitialized()
           
 boolean isShutDown()
           
 boolean isStarted()
           
 boolean isStopped()
           
 boolean isUnknown()
           
protected  void pollDeliveryChannel()
           
 void prepareConsumerExchange(javax.jbi.messaging.MessageExchange exchange, Endpoint endpoint)
           
protected  void processExchange(javax.jbi.messaging.MessageExchange exchange)
           
protected  void processExchangeInTx(javax.jbi.messaging.MessageExchange exchange, Transaction tx)
           
 void sendConsumerExchange(javax.jbi.messaging.MessageExchange exchange, Endpoint endpoint)
          This method allows the component to keep no state in memory so that components can be clustered and provide fail-over and load-balancing.
 void sendConsumerExchange(javax.jbi.messaging.MessageExchange exchange, ExchangeProcessor processor)
          Deprecated. use sendConsumerExchange(MessageExchange, Endpoint) instead
protected  void setComponent(ServiceMixComponent component)
           
protected  void setCurrentState(String currentState)
           
 void shutDown()
           
 void start()
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INITIALIZED

public static final String INITIALIZED
See Also:
Constant Field Values

logger

protected transient Log logger

component

protected ServiceMixComponent component

context

protected javax.jbi.component.ComponentContext context

mbeanName

protected ObjectName mbeanName

executorFactory

protected org.apache.servicemix.executors.ExecutorFactory executorFactory

executor

protected org.apache.servicemix.executors.Executor executor

running

protected AtomicBoolean running

channel

protected javax.jbi.messaging.DeliveryChannel channel

poller

protected Thread poller

polling

protected AtomicBoolean polling

transactionManager

protected TransactionManager transactionManager

workManagerCreated

protected boolean workManagerCreated

processors

protected Map<String,ExchangeProcessor> processors

correlationId

protected ThreadLocal<String> correlationId

currentState

protected String currentState
Constructor Detail

AsyncBaseLifeCycle

public AsyncBaseLifeCycle()

AsyncBaseLifeCycle

public AsyncBaseLifeCycle(ServiceMixComponent component)
Method Detail

setComponent

protected void setComponent(ServiceMixComponent component)

getExtensionMBeanName

public ObjectName getExtensionMBeanName()
Specified by:
getExtensionMBeanName in interface javax.jbi.component.ComponentLifeCycle

getExtensionMBean

protected Object getExtensionMBean()
                            throws Exception
Throws:
Exception

createExtensionMBeanName

protected ObjectName createExtensionMBeanName()
                                       throws Exception
Throws:
Exception

getEPRServiceName

public QName getEPRServiceName()

getCurrentState

public String getCurrentState()

setCurrentState

protected void setCurrentState(String currentState)

isStarted

public boolean isStarted()

isStopped

public boolean isStopped()
Returns:
true if the object is stopped

isShutDown

public boolean isShutDown()
Returns:
true if the object is shutDown

isInitialized

public boolean isInitialized()
Returns:
true if the object is shutDown

isUnknown

public boolean isUnknown()
Returns:
true if the object is shutDown

init

public void init(javax.jbi.component.ComponentContext context)
          throws javax.jbi.JBIException
Specified by:
init in interface javax.jbi.component.ComponentLifeCycle
Throws:
javax.jbi.JBIException

doInit

protected void doInit()
               throws Exception
Throws:
Exception

shutDown

public void shutDown()
              throws javax.jbi.JBIException
Specified by:
shutDown in interface javax.jbi.component.ComponentLifeCycle
Throws:
javax.jbi.JBIException

doShutDown

protected void doShutDown()
                   throws Exception
Throws:
Exception

start

public void start()
           throws javax.jbi.JBIException
Specified by:
start in interface javax.jbi.component.ComponentLifeCycle
Throws:
javax.jbi.JBIException

doStart

protected void doStart()
                throws Exception
Throws:
Exception

pollDeliveryChannel

protected void pollDeliveryChannel()

stop

public void stop()
          throws javax.jbi.JBIException
Specified by:
stop in interface javax.jbi.component.ComponentLifeCycle
Throws:
javax.jbi.JBIException

doStop

protected void doStop()
               throws Exception
Throws:
Exception

getContext

public javax.jbi.component.ComponentContext getContext()
Returns:
Returns the context.

getExecutor

public org.apache.servicemix.executors.Executor getExecutor()

createExecutorFactory

protected org.apache.servicemix.executors.ExecutorFactory createExecutorFactory()

findExecutorFactory

protected org.apache.servicemix.executors.ExecutorFactory findExecutorFactory()

processExchangeInTx

protected void processExchangeInTx(javax.jbi.messaging.MessageExchange exchange,
                                   Transaction tx)

exceptionShouldRollbackTx

protected boolean exceptionShouldRollbackTx(Exception e)

processExchange

protected void processExchange(javax.jbi.messaging.MessageExchange exchange)
                        throws Exception
Throws:
Exception

sendConsumerExchange

public void sendConsumerExchange(javax.jbi.messaging.MessageExchange exchange,
                                 ExchangeProcessor processor)
                          throws javax.jbi.messaging.MessagingException
Deprecated. use sendConsumerExchange(MessageExchange, Endpoint) instead

Parameters:
exchange -
processor -
Throws:
javax.jbi.messaging.MessagingException

sendConsumerExchange

public void sendConsumerExchange(javax.jbi.messaging.MessageExchange exchange,
                                 Endpoint endpoint)
                          throws javax.jbi.messaging.MessagingException
This method allows the component to keep no state in memory so that components can be clustered and provide fail-over and load-balancing.

Parameters:
exchange -
endpoint -
Throws:
javax.jbi.messaging.MessagingException

prepareConsumerExchange

public void prepareConsumerExchange(javax.jbi.messaging.MessageExchange exchange,
                                    Endpoint endpoint)

getResolvedEPR

protected Endpoint getResolvedEPR(javax.jbi.servicedesc.ServiceEndpoint ep)
                           throws Exception
Handle an exchange sent to an EPR resolved by this component

Parameters:
ep - the service endpoint
Returns:
an endpoint to use for handling the exchange
Throws:
Exception


Copyright © 2005-2007 Apache Software Foundation. All Rights Reserved.