XATerminator (Java EE 5)

Java EE API


javax.resource.spi Interface XATerminator


public interface XATerminator


XATerminator 接口用于事务完成和崩溃恢复流。

英文文档:

The XATerminator interface is used for transaction completion and crash recovery flows.

Version:
1.0
Author:
Ram Jeyaraman

Method Summary
 void
 void
 int
 Xid[]
 void
 

Method Detail

public void commit(Xid xid, boolean onePhase) throws XAException
提交 xid 指定的全局事务。
xid 全局事务标识符
onePhase 如果为 true,则资源管理器应使用单阶段提交协议提交代表 xid 执行的工作。
ThrowsXAException: 发生错误。可能的 XAExceptions 有 XA_HEURHAZ、XA_HEURCOM、XA_HEURRB、XA_HEURMIX、XAER_RMERR、XAER_RMFAIL、XAER_NOTA、XAER_INVAL 或 XAER_PROTO。

如果资源管理器不提交事务,并且将参数 onePhase 设置为 true,则资源管理器可能抛出 XA_RB* 异常之一。返回后,资源管理器回滚分支的工作,并释放所有占用的资源。

英文文档:

commit

void commit(Xid xid,
            boolean onePhase)
            throws XAException
Commits the global transaction specified by xid.

Parameters:
xid - A global transaction identifier
onePhase - If true, the resource manager should use a one-phase commit protocol to commit the work done on behalf of xid.
Throws:
XAException - An error has occurred. Possible XAExceptions are XA_HEURHAZ, XA_HEURCOM, XA_HEURRB, XA_HEURMIX, XAER_RMERR, XAER_RMFAIL, XAER_NOTA, XAER_INVAL, or XAER_PROTO.

If the resource manager did not commit the transaction and the parameter onePhase is set to true, the resource manager may throw one of the XA_RB* exceptions. Upon return, the resource manager has rolled back the branch's work and has released all held resources.


public void forget(Xid xid) throws XAException
告知资源管理器忘记以启发方式完成的事务分支。
xid 全局事务标识符
ThrowsXAException: 发生错误。可能的异常值有 XAER_RMERR、XAER_RMFAIL、XAER_NOTA、XAER_INVAL 或 XAER_PROTO。
英文文档:

forget

void forget(Xid xid)
            throws XAException
Tells the resource manager to forget about a heuristically completed transaction branch.

Parameters:
xid - A global transaction identifier.
Throws:
XAException - An error has occurred. Possible exception values are XAER_RMERR, XAER_RMFAIL, XAER_NOTA, XAER_INVAL, or XAER_PROTO.

public int prepare(Xid xid) throws XAException
请求资源管理器准备好提交 xid 中指定的事务。
xid 全局事务标识符
ThrowsXAException: 发生错误。可能的异常值有:XA_RB*、XAER_RMERR、XAER_RMFAIL、XAER_NOTA、XAER_INVAL 或 XAER_PROTO。
return 一个值,它指示资源管理器对事务结果的表决。可能的值有:XA_RDONLY 或 XA_OK。这些常量在 javax.transaction.xa.XAResource 接口中定义。如果资源管理器要回滚事务,则应该通过引发 prepare 方法中相应的 XAException 实现这一点。
英文文档:

prepare

int prepare(Xid xid)
            throws XAException
Ask the resource manager to prepare for a transaction commit of the transaction specified in xid.

Parameters:
xid - A global transaction identifier.
Returns:
A value indicating the resource manager's vote on the outcome of the transaction. The possible values are: XA_RDONLY or XA_OK. These constants are defined in javax.transaction.xa.XAResource interface. If the resource manager wants to roll back the transaction, it should do so by raising an appropriate XAException in the prepare method.
Throws:
XAException - An error has occurred. Possible exception values are: XA_RB*, XAER_RMERR, XAER_RMFAIL, XAER_NOTA, XAER_INVAL, or XAER_PROTO.

public Xid[] recover(int flag) throws XAException
从资源管理器获取准备好的事务分支的列表。恢复过程中,事务管理器调用此方法,以获取当前处于准备状态或启发式完成状态的事务分支的列表。
flag TMSTARTRSCAN、MENDRSCAN、MNOFLAGS 之一。参数中没有设置任何其他标志时,必须使用 MNOFLAGS。这些常量在 javax.transaction.xa.XAResource 接口中定义。
ThrowsXAException: 发生错误。可能的值为 XAER_RMERR、XAER_RMFAIL、XAER_INVAL 和 XAER_PROTO。
return 资源管理器返回当前处于准备状态或启发式完成状态的事务分支的 0 个或多个 XID。如果在操作过程中发生错误,则资源管理器应抛出相应的 XAException。
英文文档:

recover

Xid[] recover(int flag)
              throws XAException
Obtains a list of prepared transaction branches from a resource manager. The transaction manager calls this method during recovery to obtain the list of transaction branches that are currently in prepared or heuristically completed states.

Parameters:
flag - One of TMSTARTRSCAN, TMENDRSCAN, TMNOFLAGS. TMNOFLAGS must be used when no other flags are set in the parameter. These constants are defined in javax.transaction.xa.XAResource interface.
Returns:
The resource manager returns zero or more XIDs of the transaction branches that are currently in a prepared or heuristically completed state. If an error occurs during the operation, the resource manager should throw the appropriate XAException.
Throws:
XAException - An error has occurred. Possible values are XAER_RMERR, XAER_RMFAIL, XAER_INVAL, and XAER_PROTO.

public void rollback(Xid xid) throws XAException
通知资源管理器回滚代表事务分支完成的工作。
xid 全局事务标识符
ThrowsXAException: 发生错误。可能的 XAExceptions 有 XA_HEURHAZ、XA_HEURCOM、XA_HEURRB、XA_HEURMIX、XAER_RMERR、XAER_RMFAIL、XAER_NOTA、XAER_INVAL 或 XAER_PROTO。

如果事务分支已经标记为只回滚,则资源管理器抛出 XA_RB* 异常之一。返回后,资源管理器回滚分支的工作,并释放所有占用的资源。

英文文档:

rollback

void rollback(Xid xid)
              throws XAException
Informs the resource manager to roll back work done on behalf of a transaction branch.

Parameters:
xid - A global transaction identifier.
Throws:
XAException - An error has occurred. Possible XAExceptions are XA_HEURHAZ, XA_HEURCOM, XA_HEURRB, XA_HEURMIX, XAER_RMERR, XAER_RMFAIL, XAER_NOTA, XAER_INVAL, or XAER_PROTO.

If the transaction branch is already marked rollback-only the resource manager may throw one of the XA_RB* exceptions. Upon return, the resource manager has rolled back the branch's work and has released all held resources.



Submit a bug or feature

Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.

一看就知道只有菜鸟才干这么无知的事啦。

PS : 未经我党受权你也可自由散发此文档。 如有任何错误请自行修正;若因此而造成任何损失请直接找人民主席,请勿与本人联系。谢谢!