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, DefaultComponent

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  Container container
           
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  Map<String,Set<String>> knownExchanges
           
protected  Log logger
           
protected  ObjectName mbeanName
           
protected  Thread poller
           
protected  AtomicBoolean polling
           
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()
           
 Container getContainer()
           
 javax.jbi.component.ComponentContext getContext()
           
 String getCurrentState()
           
 QName getEPRServiceName()
           
 org.apache.servicemix.executors.Executor getExecutor()
           
 org.apache.servicemix.executors.ExecutorFactory getExecutorFactory()
           
protected  Object getExtensionMBean()
           
 ObjectName getExtensionMBeanName()
           
protected  Set<String> getKnownExchanges(Endpoint endpoint)
           
protected  Endpoint getResolvedEPR(javax.jbi.servicedesc.ServiceEndpoint ep)
          Handle an exchange sent to an EPR resolved by this component
 Object getSmx3Container()
           
 void handleExchange(Endpoint endpoint, javax.jbi.messaging.MessageExchange exchange, boolean add)
           
 void init(javax.jbi.component.ComponentContext context)
           
 boolean isInitialized()
           
 boolean isShutDown()
           
 boolean isStarted()
           
 boolean isStopped()
           
 boolean isUnknown()
           
 void onMessageExchange(javax.jbi.messaging.MessageExchange exchange)
           
protected  void pollDeliveryChannel()
           
 void prepareExchange(javax.jbi.messaging.MessageExchange exchange, Endpoint endpoint)
           
 void prepareShutdown(Endpoint endpoint)
           
protected  void processExchange(javax.jbi.messaging.MessageExchange exchange)
           
protected  void processExchangeInTx(javax.jbi.messaging.MessageExchange exchange, Transaction tx)
           
protected  void setComponent(ServiceMixComponent component)
           
protected  void setCurrentState(String currentState)
           
 void setExecutor(org.apache.servicemix.executors.Executor executor)
           
 void setExecutorFactory(org.apache.servicemix.executors.ExecutorFactory executorFactory)
           
 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

correlationId

protected ThreadLocal<String> correlationId

currentState

protected String currentState

container

protected Container container

knownExchanges

protected Map<String,Set<String>> knownExchanges
Constructor Detail

AsyncBaseLifeCycle

public AsyncBaseLifeCycle()

AsyncBaseLifeCycle

public AsyncBaseLifeCycle(ServiceMixComponent component)
Method Detail

getContainer

public Container getContainer()

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()

setExecutor

public void setExecutor(org.apache.servicemix.executors.Executor executor)

getExecutorFactory

public org.apache.servicemix.executors.ExecutorFactory getExecutorFactory()

setExecutorFactory

public void setExecutorFactory(org.apache.servicemix.executors.ExecutorFactory executorFactory)

createExecutorFactory

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

getSmx3Container

public Object getSmx3Container()

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)

onMessageExchange

public void onMessageExchange(javax.jbi.messaging.MessageExchange exchange)

processExchange

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

prepareExchange

public void prepareExchange(javax.jbi.messaging.MessageExchange exchange,
                            Endpoint endpoint)
                     throws javax.jbi.messaging.MessagingException
Throws:
javax.jbi.messaging.MessagingException

prepareShutdown

public void prepareShutdown(Endpoint endpoint)
                     throws InterruptedException
Throws:
InterruptedException

getKnownExchanges

protected Set<String> getKnownExchanges(Endpoint endpoint)

handleExchange

public void handleExchange(Endpoint endpoint,
                           javax.jbi.messaging.MessageExchange exchange,
                           boolean add)

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-2008 Apache Software Foundation. All Rights Reserved.