DualSessionWrapper (Bitronix Transaction Manager :: Core 2.1.4 API)
Date: 2013-09-15

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

## bitronix.tm.resource.jms
Class DualSessionWrapper

    java.lang.Object
      bitronix.tm.resource.common.AbstractXAStatefulHolder
          bitronix.tm.resource.common.AbstractXAResourceHolder
              bitronix.tm.resource.jms.DualSessionWrapper

All Implemented Interfaces:
  StateChangeListener, XAResourceHolder, XAStatefulHolder, Runnable, javax.jms.Session

    public class DualSessionWrapper

extends AbstractXAResourceHolder
implements javax.jms.Session, StateChangeListener

JMS Session wrapper that will send calls to either a XASession or to a non-XA Session depending on the calling context.

Author:
  lorban

Field Summary

Fields inherited from interface javax.jms.Session
`AUTO_ACKNOWLEDGE, CLIENT_ACKNOWLEDGE, DUPS_OK_ACKNOWLEDGE, SESSION_TRANSACTED`

Fields inherited from interface bitronix.tm.resource.common.XAStatefulHolder
`STATE_ACCESSIBLE, STATE_CLOSED, STATE_IN_POOL, STATE_NOT_ACCESSIBLE`

Constructor Summary
`DualSessionWrapper(JmsPooledConnection pooledConnection, boolean transacted, int acknowledgeMode)`

Method Summary
`void` | `close()` Close the physical connection that this `XAStatefulHolder` represents.
`void` | `commit()`
`javax.jms.QueueBrowser` | `createBrowser(javax.jms.Queue queue)`
`javax.jms.QueueBrowser` | `createBrowser(javax.jms.Queue queue, String messageSelector)`
`javax.jms.BytesMessage` | `createBytesMessage()`
`javax.jms.MessageConsumer` | `createConsumer(javax.jms.Destination destination)`
`javax.jms.MessageConsumer` | `createConsumer(javax.jms.Destination destination, String messageSelector)`
`javax.jms.MessageConsumer` | `createConsumer(javax.jms.Destination destination, String messageSelector, boolean noLocal)`
`javax.jms.TopicSubscriber` | `createDurableSubscriber(javax.jms.Topic topic, String name)`
`javax.jms.TopicSubscriber` | `createDurableSubscriber(javax.jms.Topic topic, String name, String messageSelector, boolean noLocal)`
`javax.jms.MapMessage` | `createMapMessage()`
`javax.jms.Message` | `createMessage()`
`javax.jms.ObjectMessage` | `createObjectMessage()`
`javax.jms.ObjectMessage` | `createObjectMessage(Serializable serializable)`
`javax.jms.MessageProducer` | `createProducer(javax.jms.Destination destination)`
`javax.jms.Queue` | `createQueue(String queueName)`
`javax.jms.StreamMessage` | `createStreamMessage()`
`javax.jms.TemporaryQueue` | `createTemporaryQueue()`
`javax.jms.TemporaryTopic` | `createTemporaryTopic()`
`javax.jms.TextMessage` | `createTextMessage()`
`javax.jms.TextMessage` | `createTextMessage(String text)`
`javax.jms.Topic` | `createTopic(String topicName)`
`protected void` | `enlistResource()` Enlist this session into the current transaction if automaticEnlistingEnabled = true for this resource.
`int` | `getAcknowledgeMode()`
`Object` | `getConnectionHandle()` Create a disposable handler used to drive a pooled instance of `XAStatefulHolder`.
`Date` | `getLastReleaseDate()` Get the date at which this object was last released to the pool.
`javax.jms.MessageListener` | `getMessageListener()`
`PoolingConnectionFactory` | `getPoolingConnectionFactory()`
`ResourceBean` | `getResourceBean()` Get the ResourceBean which created this XAResourceHolder.
`javax.jms.Session` | `getSession()`
`javax.jms.Session` | `getSession(boolean forceXa)`
`boolean` | `getTransacted()`
`XAResource` | `getXAResource()` Get the vendor's `XAResource` implementation of the wrapped resource.
`List<XAResourceHolder>` | `getXAResourceHolders()` Get the list of `XAResourceHolder`s created by this `XAStatefulHolder` that are still open.
`void` | `recover()`
`void` | `rollback()`
`void` | `run()`
`void` | `setMessageListener(javax.jms.MessageListener listener)`
`void` | `stateChanged(XAStatefulHolder source, int oldState, int newState)` Fired when the internal state of a `XAStatefulHolder` has changed.
`void` | `stateChanging(XAStatefulHolder source, int currentState, int futureState)` Fired before the internal state of a `XAStatefulHolder` has changed.
`String` | `toString()`
`void` | `unsubscribe(String name)`

Methods inherited from class bitronix.tm.resource.common.AbstractXAResourceHolder
`getXAResourceHolderStateGtrids, getXAResourceHolderStatesForGtrid, hasStateForXAResource, isParticipatingInActiveGlobalTransaction, putXAResourceHolderState, removeXAResourceHolderState`

Methods inherited from class bitronix.tm.resource.common.AbstractXAStatefulHolder
`addStateChangeEventListener, getState, removeStateChangeEventListener, setState`

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

Methods inherited from interface bitronix.tm.resource.common.XAStatefulHolder
`addStateChangeEventListener, getState, removeStateChangeEventListener, setState`

Constructor Detail

### DualSessionWrapper

    public DualSessionWrapper(JmsPooledConnection pooledConnection,
                              boolean transacted,
                              int acknowledgeMode)

Method Detail

### getPoolingConnectionFactory

    public PoolingConnectionFactory getPoolingConnectionFactory()

### getSession

    public javax.jms.Session getSession()
                                 throws javax.jms.JMSException

  Throws:
    `javax.jms.JMSException`

### getSession

    public javax.jms.Session getSession(boolean forceXa)
                                 throws javax.jms.JMSException

  Throws:
    `javax.jms.JMSException`

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

### close

    public void close()
               throws javax.jms.JMSException

  Description copied from interface: `XAStatefulHolder`
  Close the physical connection that this `XAStatefulHolder` represents.

  Specified by:
    `close` in interface `XAStatefulHolder`
  Specified by:
    `close` in interface `javax.jms.Session`
  Throws:
    `javax.jms.JMSException`

### getLastReleaseDate

    public Date getLastReleaseDate()

  Description copied from interface: `XAStatefulHolder`
  Get the date at which this object was last released to the pool. This is required to check if it is eligible for discard when the containing pool needs to shrink.

  Specified by:
    `getLastReleaseDate` in interface `XAStatefulHolder`
  Returns:
    the date at which this object was last released to the pool or null if it never left the pool.

### stateChanged

    public void stateChanged(XAStatefulHolder source,
                             int oldState,
                             int newState)

  Description copied from interface: `StateChangeListener`
  Fired when the internal state of a `XAStatefulHolder` has changed.

  Specified by:
    `stateChanged` in interface `StateChangeListener`
  Parameters:
    `source` - the `XAStatefulHolder` changing state.
    `oldState` - the old state of the `XAStatefulHolder`.
    `newState` - the new state of the `XAStatefulHolder`.

### stateChanging

    public void stateChanging(XAStatefulHolder source,
                              int currentState,
                              int futureState)

  Description copied from interface: `StateChangeListener`
  Fired before the internal state of a `XAStatefulHolder` has changed.

  Specified by:
    `stateChanging` in interface `StateChangeListener`
  Parameters:
    `source` - the `XAStatefulHolder` changing state.
    `currentState` - the current state of the `XAStatefulHolder`.
    `futureState` - the future state of the `XAStatefulHolder`.

### createProducer

    public javax.jms.MessageProducer createProducer(javax.jms.Destination destination)
                                             throws javax.jms.JMSException

  Specified by:
    `createProducer` in interface `javax.jms.Session`
  Throws:
    `javax.jms.JMSException`

### createConsumer

    public javax.jms.MessageConsumer createConsumer(javax.jms.Destination destination)
                                             throws javax.jms.JMSException

  Specified by:
    `createConsumer` in interface `javax.jms.Session`
  Throws:
    `javax.jms.JMSException`

### createConsumer

    public javax.jms.MessageConsumer createConsumer(javax.jms.Destination destination,
                                                    String messageSelector)
                                             throws javax.jms.JMSException

  Specified by:
    `createConsumer` in interface `javax.jms.Session`
  Throws:
    `javax.jms.JMSException`

### createConsumer

    public javax.jms.MessageConsumer createConsumer(javax.jms.Destination destination,
                                                    String messageSelector,
                                                    boolean noLocal)
                                             throws javax.jms.JMSException

  Specified by:
    `createConsumer` in interface `javax.jms.Session`
  Throws:
    `javax.jms.JMSException`

### createDurableSubscriber

    public javax.jms.TopicSubscriber createDurableSubscriber(javax.jms.Topic topic,
                                                             String name)
                                                      throws javax.jms.JMSException

  Specified by:
    `createDurableSubscriber` in interface `javax.jms.Session`
  Throws:
    `javax.jms.JMSException`

### createDurableSubscriber

    public javax.jms.TopicSubscriber createDurableSubscriber(javax.jms.Topic topic,
                                                             String name,
                                                             String messageSelector,
                                                             boolean noLocal)
                                                      throws javax.jms.JMSException

  Specified by:
    `createDurableSubscriber` in interface `javax.jms.Session`
  Throws:
    `javax.jms.JMSException`

### getMessageListener

    public javax.jms.MessageListener getMessageListener()
                                                 throws javax.jms.JMSException

  Specified by:
    `getMessageListener` in interface `javax.jms.Session`
  Throws:
    `javax.jms.JMSException`

### setMessageListener

    public void setMessageListener(javax.jms.MessageListener listener)
                            throws javax.jms.JMSException

  Specified by:
    `setMessageListener` in interface `javax.jms.Session`
  Throws:
    `javax.jms.JMSException`

### run

    public void run()

  Specified by:
    `run` in interface `Runnable`
  Specified by:
    `run` in interface `javax.jms.Session`

### getXAResource

    public XAResource getXAResource()

  Description copied from interface: `XAResourceHolder`
  Get the vendor's `XAResource` implementation of the wrapped resource.

  Specified by:
    `getXAResource` in interface `XAResourceHolder`
  Returns:
    the vendor's XAResource implementation.

### getResourceBean

    public ResourceBean getResourceBean()

  Description copied from interface: `XAResourceHolder`
  Get the ResourceBean which created this XAResourceHolder.

  Specified by:
    `getResourceBean` in interface `XAResourceHolder`
  Returns:
    the ResourceBean which created this XAResourceHolder.

### getXAResourceHolders

    public List<XAResourceHolder> getXAResourceHolders()

  Description copied from interface: `XAStatefulHolder`
  Get the list of `XAResourceHolder`s created by this `XAStatefulHolder` that are still open.

  This method is thread-safe.

  Specified by:
    `getXAResourceHolders` in interface `XAStatefulHolder`
  Returns:
    the list of `XAResourceHolder`s created by this `XAStatefulHolder` that are still open.

### getConnectionHandle

    public Object getConnectionHandle()
                               throws Exception

  Description copied from interface: `XAStatefulHolder`
  Create a disposable handler used to drive a pooled instance of `XAStatefulHolder`.

  This method is thread-safe.

  Specified by:
    `getConnectionHandle` in interface `XAStatefulHolder`
  Returns:
    a resource-specific disaposable connection object.
  Throws:
    `Exception` - a resource-specific exception thrown when the disaposable connection cannot be created.

### getTransacted

    public boolean getTransacted()
                          throws javax.jms.JMSException

  Specified by:
    `getTransacted` in interface `javax.jms.Session`
  Throws:
    `javax.jms.JMSException`

### getAcknowledgeMode

    public int getAcknowledgeMode()
                           throws javax.jms.JMSException

  Specified by:
    `getAcknowledgeMode` in interface `javax.jms.Session`
  Throws:
    `javax.jms.JMSException`

### commit

    public void commit()
                throws javax.jms.JMSException

  Specified by:
    `commit` in interface `javax.jms.Session`
  Throws:
    `javax.jms.JMSException`

### rollback

    public void rollback()
                  throws javax.jms.JMSException

  Specified by:
    `rollback` in interface `javax.jms.Session`
  Throws:
    `javax.jms.JMSException`

### recover

    public void recover()
                 throws javax.jms.JMSException

  Specified by:
    `recover` in interface `javax.jms.Session`
  Throws:
    `javax.jms.JMSException`

### createBrowser

    public javax.jms.QueueBrowser createBrowser(javax.jms.Queue queue)
                                         throws javax.jms.JMSException

  Specified by:
    `createBrowser` in interface `javax.jms.Session`
  Throws:
    `javax.jms.JMSException`

### createBrowser

    public javax.jms.QueueBrowser createBrowser(javax.jms.Queue queue,
                                                String messageSelector)
                                         throws javax.jms.JMSException

  Specified by:
    `createBrowser` in interface `javax.jms.Session`
  Throws:
    `javax.jms.JMSException`

### createBytesMessage

    public javax.jms.BytesMessage createBytesMessage()
                                              throws javax.jms.JMSException

  Specified by:
    `createBytesMessage` in interface `javax.jms.Session`
  Throws:
    `javax.jms.JMSException`

### createMapMessage

    public javax.jms.MapMessage createMapMessage()
                                          throws javax.jms.JMSException

  Specified by:
    `createMapMessage` in interface `javax.jms.Session`
  Throws:
    `javax.jms.JMSException`

### createMessage

    public javax.jms.Message createMessage()
                                    throws javax.jms.JMSException

  Specified by:
    `createMessage` in interface `javax.jms.Session`
  Throws:
    `javax.jms.JMSException`

### createObjectMessage

    public javax.jms.ObjectMessage createObjectMessage()
                                                throws javax.jms.JMSException

  Specified by:
    `createObjectMessage` in interface `javax.jms.Session`
  Throws:
    `javax.jms.JMSException`

### createObjectMessage

    public javax.jms.ObjectMessage createObjectMessage(Serializable serializable)
                                                throws javax.jms.JMSException

  Specified by:
    `createObjectMessage` in interface `javax.jms.Session`
  Throws:
    `javax.jms.JMSException`

### createStreamMessage

    public javax.jms.StreamMessage createStreamMessage()
                                                throws javax.jms.JMSException

  Specified by:
    `createStreamMessage` in interface `javax.jms.Session`
  Throws:
    `javax.jms.JMSException`

### createTextMessage

    public javax.jms.TextMessage createTextMessage()
                                            throws javax.jms.JMSException

  Specified by:
    `createTextMessage` in interface `javax.jms.Session`
  Throws:
    `javax.jms.JMSException`

### createTextMessage

    public javax.jms.TextMessage createTextMessage(String text)
                                            throws javax.jms.JMSException

  Specified by:
    `createTextMessage` in interface `javax.jms.Session`
  Throws:
    `javax.jms.JMSException`

### createQueue

    public javax.jms.Queue createQueue(String queueName)
                                throws javax.jms.JMSException

  Specified by:
    `createQueue` in interface `javax.jms.Session`
  Throws:
    `javax.jms.JMSException`

### createTopic

    public javax.jms.Topic createTopic(String topicName)
                                throws javax.jms.JMSException

  Specified by:
    `createTopic` in interface `javax.jms.Session`
  Throws:
    `javax.jms.JMSException`

### createTemporaryQueue

    public javax.jms.TemporaryQueue createTemporaryQueue()
                                                  throws javax.jms.JMSException

  Specified by:
    `createTemporaryQueue` in interface `javax.jms.Session`
  Throws:
    `javax.jms.JMSException`

### createTemporaryTopic

    public javax.jms.TemporaryTopic createTemporaryTopic()
                                                  throws javax.jms.JMSException

  Specified by:
    `createTemporaryTopic` in interface `javax.jms.Session`
  Throws:
    `javax.jms.JMSException`

### unsubscribe

    public void unsubscribe(String name)
                     throws javax.jms.JMSException

  Specified by:
    `unsubscribe` in interface `javax.jms.Session`
  Throws:
    `javax.jms.JMSException`

### enlistResource

    protected void enlistResource()
                           throws javax.jms.JMSException

  Enlist this session into the current transaction if automaticEnlistingEnabled = true for this resource. If no transaction is running then this method does nothing.

  Throws:
    `javax.jms.JMSException`

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

Copyright © 2006-2013 Bitronix Software. All Rights Reserved.