|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
javax.jms Interface XASession
- All Known Subinterfaces:
- XAQueueSession, XATopicSession
public interface XASession
- extends Session
XASession
接口扩展了 Session
的功能,它可以通过 JMS 提供者支持 Java Transaction API (JTA)(可选)。此支持采用 javax.transaction.xa.XAResource
对象的形式。此对象的功能与标准 X/Open XA Resource 接口定义的功能非常类似。
应用服务器通过获取 XASession
的 XAResource
控制其事务分配。它使用 XAResource
将会话分配给事务、准备和提交事务工作等。
XAResource
提供了一些相当复杂的工具来交错多个事务的工作、恢复正在进行的事务列表等。JTA 感知的 JMS 提供者必须完全实现此功能。可以使用支持 XA 的数据库服务来实现此功能,或者 JMS 提供者可以选择从头开始实现此功能。
为应用服务器客户端提供了它认为是常规的 JMS Session
。应用服务器在后台控制底层 XASession
的事务管理。
XASession
接口是可选的。JMS 提供者不需要支持此接口。此接口供 JMS 提供者使用,以支持事务环境。强烈建议客户端程序使用其环境中可用的事务支持,而不是直接使用这些 XA 接口。
version |
| |
See also | javax.jms.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.
- Version:
- 1.1 February 2, 2002
- Author:
- Mark Hapner, Rich Burridge, Kate Stout
- See Also:
Session
Field Summary |
---|
Fields inherited from interface javax.jms.Session |
---|
AUTO_ACKNOWLEDGE, CLIENT_ACKNOWLEDGE, DUPS_OK_ACKNOWLEDGE, SESSION_TRANSACTED |
Method Summary | |
---|---|
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. |
Method Detail |
---|
public Session
getSession() throws JMSException
获取与此 XASession
关联的会话。
return | 会话对象 |
Throws | JMSException: 如果发生内部错误。 |
since | 1.1 |
getSession
Session getSession() throws JMSException
- Gets the session associated with this
XASession
. - Returns:
- the session object
- Throws:
JMSException
- if an internal error occurs.- Since:
- 1.1
public XAResource
getXAResource()
返回调用者的 XA 资源。
return | 调用者的 XA 资源 |
getXAResource
XAResource getXAResource()
- Returns an XA resource to the caller.
- Returns:
- an XA resource to the caller
public boolean
getTransacted() throws JMSException
指示会话是否处于事务性模式。
return |
| |
Throws | JMSException: 如果 JMS 提供者由于某个内部错误无法返回事务模式。 |
getTransacted
boolean getTransacted() throws JMSException
- Indicates whether the session is in transacted mode.
- Specified by:
getTransacted
in interfaceSession
- Returns:
- true
- Throws:
JMSException
- if the JMS provider fails to return the transaction mode due to some internal error.
public void
commit() throws JMSException
抛出 TransactionInProgressException
,因为不应对 XASession
对象调用它。
Throws | TransactionInProgressException:
如果对 XASession 调用此方法。 |
commit
void commit() throws JMSException
- Throws a
TransactionInProgressException
, since it should not be called for anXASession
object. - Throws:
TransactionInProgressException
- if the method is called on anXASession
.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.
public void
rollback() throws JMSException
抛出 TransactionInProgressException
,因为不应对 XASession
对象调用它。
Throws | TransactionInProgressException:
如果对 XASession 调用此方法。 |
rollback
void rollback() throws JMSException
- Throws a
TransactionInProgressException
, since it should not be called for anXASession
object. - Throws:
TransactionInProgressException
- if the method is called on anXASession
.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.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Submit a bug or feature
Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.
PS : 未经我党受权你也可自由散发此文档。 如有任何错误请自行修正;若因此而造成任何损失请直接找人民主席,请勿与本人联系。谢谢!