XASession (Java EE 5 SDK)

Java

Java EE 5 SDK

深圳电信培训中心.徐海蛟老师.


javax.jms Interface XASession

所有父接口:
Runnable, Session
所有已知子接口:
XAQueueSession, XATopicSession

public interface XASession
extends Session

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.

版本:
1.1 February 2, 2002
作者:
Mark Hapner, Rich Burridge, Kate Stout
另请参见:
Session

字段摘要
 
Fields inherited from interface javax.jms.Session
AUTO_ACKNOWLEDGE, CLIENT_ACKNOWLEDGE, DUPS_OK_ACKNOWLEDGE, SESSION_TRANSACTED
 
方法摘要
 void commit()
          Throws a TransactionInProgressException, since it should not be called for an XASession object.
 Session getSession()
          Gets the session associated with this XASession.
 boolean getTransacted()
          Indicates whether the session is in transacted mode.
 XAResource getXAResource()
          Returns an XA resource to the caller.
 void rollback()
          Throws a TransactionInProgressException, since it should not be called for an XASession object.
 
Methods inherited from interface javax.jms.Session
close, 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
 

方法详细信息

getSession

Session getSession()
                   throws JMSException
Gets the session associated with this XASession.

返回:
the session object
抛出异常:
JMSException - if an internal error occurs.
从以下版本开始:
1.1

getXAResource

XAResource getXAResource()
Returns an XA resource to the caller.

返回:
an XA resource to the caller

getTransacted

boolean getTransacted()
                      throws JMSException
Indicates whether the session is in transacted mode.

规范说明:
getTransacted in interface Session
返回:
true
抛出异常:
JMSException - if the JMS provider fails to return the transaction mode due to some internal error.

commit

void commit()
            throws JMSException
Throws a TransactionInProgressException, since it should not be called for an XASession object.

规范说明:
commit in interface Session
抛出异常:
TransactionInProgressException - if the method is called on an XASession.
JMSException - if the JMS provider fails to commit the transaction due to some internal error.
TransactionRolledBackException - if the transaction is rolled back due to some internal error during commit.
IllegalStateException - if the method is not called by a transacted session.

rollback

void rollback()
              throws JMSException
Throws a TransactionInProgressException, since it should not be called for an XASession object.

规范说明:
rollback in interface Session
抛出异常:
TransactionInProgressException - if the method is called on an XASession.
JMSException - if the JMS provider fails to roll back the transaction due to some internal error.
IllegalStateException - if the method is not called by a transacted session.

Java EE 5 SDK

深圳电信培训中心.徐海蛟老师.


提交错误或意见

版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。深圳电信培训中心.徐海蛟老师教学参考.