ActiveMQXASession (ActiveMQ 1.1 API)
Keywords: org.codehaus.activemq.ActiveMQXASession class

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

## org.codehaus.activemq
Class ActiveMQXASession

    java.lang.Object
      org.codehaus.activemq.ActiveMQSession
          org.codehaus.activemq.ActiveMQXASession

All Implemented Interfaces:
  ActiveMQMessageDispatcher, MessageAcknowledge, QueueSession, Runnable, Session, StatsCapable, TopicSession, XAQueueSession, XAResource, XASession, XATopicSession

public class ActiveMQXASession
extends ActiveMQSession
implements XASession, XAQueueSession, XATopicSession, XAResource

The XASession interface extends the capability of Session by adding access to a JMS provider's support for the Java Transaction API (JTA) (optional). This support takes the form of a javax.transaction.xa.XAResource object. The functionality of this object closely resembles that defined by the standard X/Open XA Resource interface.

An application server controls the transactional assignment of an XASession by obtaining its XAResource. It uses the XAResource to assign the session to a transaction, prepare and commit work on the transaction, and so on.

An XAResource provides some fairly sophisticated facilities for interleaving work on multiple transactions, recovering a list of transactions in progress, and so on. A JTA aware JMS provider must fully implement this functionality. This could be done by using the services of a database that supports XA, or a JMS provider may choose to implement this functionality from scratch.

A client of the application server is given what it thinks is a regular JMS Session. Behind the scenes, the application server controls the transaction management of the underlying XASession.

The XASession interface is optional. JMS providers are not required to support this interface. This interface is for use by JMS providers to support transactional environments. Client programs are strongly encouraged to use the transactional support available in their environment, rather than use these XA interfaces directly.

Version:
  $Revision: 1.11 $
See Also:
  `Session`, `QueueSession`, `TopicSession`, `XASession`

Field Summary

Fields inherited from class org.codehaus.activemq.ActiveMQSession
`closed, connection, CONSUMER_DISPATCH_ASYNC, CONSUMER_DISPATCH_SYNC, CONSUMER_DISPATCH_UNSET, consumers, currentTransactionId, packetIdGenerator, producers`

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

Fields inherited from interface javax.transaction.xa.XAResource
`TMENDRSCAN, TMFAIL, TMJOIN, TMNOFLAGS, TMONEPHASE, TMRESUME, TMSTARTRSCAN, TMSUCCESS, TMSUSPEND, XA_OK, XA_RDONLY`

Constructor Summary
`ActiveMQXASession(ActiveMQXAConnection theConnection)`

Method Summary
`protected void` | `checkClosedXA()`
`void` | `close()` overide Session - which needs to rollback if transacted
`void` | `commit()` Commits all messages done in this transaction and releases any locks currently held.
`void` | `commit(Xid xid, boolean onePhase)`
`protected void` | `doStartTransaction()` This is called before transacted work is done by the session.
`void` | `end(Xid xid, int flags)`
`void` | `forget(Xid xid)`
`protected String` | `getNextTransactionId()`
`QueueSession` | `getQueueSession()`
`Session` | `getSession()`
`TopicSession` | `getTopicSession()`
`boolean` | `getTransacted()` Indicates whether the session is in transacted mode.
`int` | `getTransactionTimeout()`
`XAResource` | `getXAResource()`
`boolean` | `isSameRM(XAResource xaResource)`
`protected boolean` | `isXaTransacted()`
`int` | `prepare(Xid xid)`
`Xid[]` | `recover(int flag)`
`void` | `rollback()` Rolls back any messages done in this transaction and releases any locks currently held.
`void` | `rollback(Xid xid)`
`boolean` | `setTransactionTimeout(int seconds)`
`void` | `start(Xid xid, int flags)` Associates a transaction with the resource.

Methods inherited from class org.codehaus.activemq.ActiveMQSession
`acknowledge, addConsumer, addProducer, checkClosed, clearMessagesInProgress, createBrowser, createBrowser, createBytesMessage, createConsumer, createConsumer, createConsumer, createConsumerInfo, createDurableSubscriber, createDurableSubscriber, createMapMessage, createMessage, createObjectMessage, createObjectMessage, createProducer, createProducerInfo, createPublisher, createQueue, createReceiver, createReceiver, createSender, createStreamMessage, createSubscriber, createSubscriber, createTemporaryQueue, createTemporaryTopic, createTextMessage, createTextMessage, createTopic, dispatch, doAcknowledge, doClose, getAcknowledgeMode, getLocalTransactionEventListener, getMessageListener, getSessionId, getSessionStats, getStartTime, getStats, isClientAcknowledge, isTarget, isTransacted, messageDelivered, recover, redeliverUnacknowledgedMessages, redeliverUnacknowledgedMessages, removeConsumer, removeProducer, run, send, setLocalTransactionEventListener, setMessageListener, setSessionConsumerDispatchState, setSessionId, setStartTime, start, stop, unsubscribe`

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

Methods inherited from interface javax.jms.Session
`createBrowser, createBrowser, createBytesMessage, createConsumer, createConsumer, createConsumer, createDurableSubscriber, createDurableSubscriber, createMapMessage, createMessage, createObjectMessage, createObjectMessage, createProducer, createQueue, createStreamMessage, createTemporaryQueue, createTemporaryTopic, createTextMessage, createTextMessage, createTopic, getAcknowledgeMode, getMessageListener, recover, run, setMessageListener, unsubscribe`

Constructor Detail

### ActiveMQXASession

    public ActiveMQXASession(ActiveMQXAConnection theConnection)
                      throws JMSException

Method Detail

### getTransacted

    public boolean getTransacted()
                          throws JMSException

  Description copied from class: `ActiveMQSession`
  Indicates whether the session is in transacted mode.

  Specified by:
    `getTransacted` in interface `XASession`
  Overrides:
    `getTransacted` in class `ActiveMQSession`
  Returns:
    true if the session is in transacted mode
  Throws:
    `JMSException` - if there is some internal error.

### rollback

    public void rollback()
                  throws JMSException

  Description copied from class: `ActiveMQSession`
  Rolls back any messages done in this transaction and releases any locks currently held.

  Specified by:
    `rollback` in interface `XASession`
  Overrides:
    `rollback` in class `ActiveMQSession`
  Throws:
    `JMSException` - if the JMS provider fails to roll back the transaction due to some internal error.

### commit

    public void commit()
                throws JMSException

  Description copied from class: `ActiveMQSession`
  Commits all messages done in this transaction and releases any locks currently held.

  Specified by:
    `commit` in interface `XASession`
  Overrides:
    `commit` in class `ActiveMQSession`
  Throws:
    `JMSException` - if the JMS provider fails to commit the transaction due to some internal error.

### getSession

    public Session getSession()
                       throws JMSException

  Specified by:
    `getSession` in interface `XASession`
  Throws:
    `JMSException`

### getXAResource

    public XAResource getXAResource()

  Specified by:
    `getXAResource` in interface `XASession`

### getQueueSession

    public QueueSession getQueueSession()
                                 throws JMSException

  Specified by:
    `getQueueSession` in interface `XAQueueSession`
  Throws:
    `JMSException`

### getTopicSession

    public TopicSession getTopicSession()
                                 throws JMSException

  Specified by:
    `getTopicSession` in interface `XATopicSession`
  Throws:
    `JMSException`

### start

    public void start(Xid xid,
                      int flags)
               throws XAException

  Associates a transaction with the resource.

  Specified by:
    `start` in interface `XAResource`
  Throws:
    `XAException`

### end

    public void end(Xid xid,
                    int flags)
             throws XAException

  Specified by:
    `end` in interface `XAResource`
  Throws:
    `XAException`

### prepare

    public int prepare(Xid xid)
                throws XAException

  Specified by:
    `prepare` in interface `XAResource`
  Throws:
    `XAException`

### rollback

    public void rollback(Xid xid)
                  throws XAException

  Specified by:
    `rollback` in interface `XAResource`
  Throws:
    `XAException`

### commit

    public void commit(Xid xid,
                       boolean onePhase)
                throws XAException

  Specified by:
    `commit` in interface `XAResource`
  Throws:
    `XAException`

### forget

    public void forget(Xid xid)
                throws XAException

  Specified by:
    `forget` in interface `XAResource`
  Throws:
    `XAException`

### isSameRM

    public boolean isSameRM(XAResource xaResource)
                     throws XAException

  Specified by:
    `isSameRM` in interface `XAResource`
  Throws:
    `XAException`

### recover

    public Xid[] recover(int flag)
                  throws XAException

  Specified by:
    `recover` in interface `XAResource`
  Throws:
    `XAException`

### getTransactionTimeout

    public int getTransactionTimeout()
                              throws XAException

  Specified by:
    `getTransactionTimeout` in interface `XAResource`
  Throws:
    `XAException`

### setTransactionTimeout

    public boolean setTransactionTimeout(int seconds)
                                  throws XAException

  Specified by:
    `setTransactionTimeout` in interface `XAResource`
  Throws:
    `XAException`

### close

    public void close()
               throws JMSException

  overide Session - which needs to rollback if transacted

  Specified by:
    `close` in interface `Session`
  Overrides:
    `close` in class `ActiveMQSession`
  Throws:
    `JMSException` - if the JMS provider fails to close the session due to some internal error.

### checkClosedXA

    protected void checkClosedXA()
                          throws XAException

  Throws:
    `XAException` - if the Session is closed

### isXaTransacted

    protected boolean isXaTransacted()

  Overrides:
    `isXaTransacted` in class `ActiveMQSession`

### getNextTransactionId

    protected String getNextTransactionId()

  Overrides:
    `getNextTransactionId` in class `ActiveMQSession`

### doStartTransaction

    protected void doStartTransaction()
                               throws JMSException

  This is called before transacted work is done by the session. XA Work can only be done when this XA resource is associated with an Xid.

  Overrides:
    `doStartTransaction` in class `ActiveMQSession`
  Throws:
    `JMSException` - not associated with an Xid

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 © 2004 Protique, Ltd.. All Rights Reserved.