javax.transaction.Transaction翻译

来源:互联网 发布:网络摄像机 刷机 编辑:程序博客网 时间:2024/05/29 11:07
 Overview Package  Class Tree Deprecated Index Help JavaTM 2 Platform
Ent. Ed. v1.4
 PREV CLASS   NEXT CLASSFRAMES    NO FRAMES     All Classes SUMMARY: NESTED | FIELD | CONSTR | METHODDETAIL: FIELD | CONSTR | METHOD

javax.transaction
Interface Transaction


public interface Transaction

The Transaction interface allows operations to be performed against the transaction in the target Transaction object. A Transaction object is created corresponding to each global transaction creation. The Transaction object can be used for resource enlistment, synchronization registration, transaction completion, and status query operations. Transaction接口允许操作执行基于目标Transaction对象的事务。创建一个Transaction对象 符合每一个全局事务创建。Transaction对象可以用于资源征集、同步注册、事务完成和状态查询操作。


Method Summary voidcommit()
          Complete the transaction represented by this Transaction object. 完成Transaction对象表示的事务。
 booleandelistResource(XAResource xaRes, int flag)
          Disassociate the resource specified from the transaction associated with the target Transaction object. 解除与目标Transaction对象关联的事务指定的资源关联。
 booleanenlistResource(XAResource xaRes)
          Enlist the resource specified with the transaction associated with the target Transaction object. 加入与目标Transaction对象关联的事务指定的资源。
 intgetStatus()
          Obtain the status of the transaction associated with the target Transaction object. 获取与目标Transaction对象关联的事务状态。
 voidregisterSynchronization(Synchronization sync)
          Register a synchronization object for the transaction currently associated with the target object. 为目前与目标对象关联的事务注册一个同步对象。
 voidrollback()
          Rollback the transaction represented by this Transaction object. 回滚Transaction对象表示的事务。
 voidsetRollbackOnly()
          Modify the transaction associated with the target object such that the only possible outcome of the transaction is to roll back the transaction. 修改当前线程的关联事务,使得事务的唯一可能结果是回滚该事务。
 

Method Detail

commit

public void commit()            throws RollbackException,                   HeuristicMixedException,                   HeuristicRollbackException,                   SecurityException,                   IllegalStateException,                   SystemException
Complete the transaction represented by this Transaction object. 完成Transaction对象表示的事务。

Throws:
RollbackException - Thrown to indicate that the transaction has been rolled back rather than committed. 抛出表示事务已被回滚而不是提交。
HeuristicMixedException - Thrown to indicate that a heuristic decision was made and that some relevant updates have been committed while others have been rolled back. 抛出表示试探性决定已经作出,某些相关更新已提交,然而其它一些被回滚。
HeuristicRollbackException - Thrown to indicate that a heuristic decision was made and that all relevant updates have been rolled back. 抛出表示试探性决定已经做出,但所有相关更新已回滚。
SecurityException - Thrown to indicate that the thread is not allowed to commit the transaction. 抛出表示当前线程不允许提交事务。
IllegalStateException - Thrown if the transaction in the target object is inactive. 如果目标对象的事务为非活动状态则抛出。
SystemException - Thrown if the transaction manager encounters an unexpected error condition. 如果事务管理器遭遇无法预料错误的情况时抛出。

delistResource

public boolean delistResource(XAResource xaRes,                              int flag)                       throws IllegalStateException,                              SystemException
Disassociate the resource specified from the transaction associated with the target Transaction object. 解除与目标Transaction对象关联的事务指定的资源关联。

Parameters:
xaRes - The XAResource object associated with the resource (connection). 与资源关联的XAResource对象(连接)。
flag - One of the values of TMSUCCESS, TMSUSPEND, or TMFAIL. TMSUCCESS、TMSUSPEND或者TMFAIL值之一。
Returns:
true if the resource was delisted successfully; otherwise false. 如果资源已成功被解除,返回true,否则为false。
Throws:
IllegalStateException - Thrown if the transaction in the target object is inactive. 如果目标对象的事务为非活动状态则抛出。
SystemException - Thrown if the transaction manager encounters an unexpected error condition. 如果事务管理器遭遇无法预料错误的情况时抛出。

enlistResource

public boolean enlistResource(XAResource xaRes)                       throws RollbackException,                              IllegalStateException,                              SystemException
Enlist the resource specified with the transaction associated with the target Transaction object. 加入与目标Transaction对象关联的事务指定的资源。

Parameters:
xaRes - The XAResource object associated with the resource (connection). 与资源关联的XAResource对象(连接)。
Returns:
true if the resource was enlisted successfully; otherwise false. 如果资源已成功被加入,返回true,否则为false。
Throws:
RollbackException - Thrown to indicate that the transaction has been marked for rollback only. 抛出表示事务已被标记为仅回滚。
IllegalStateException - Thrown if the transaction in the target object is in the prepared state or the transaction is inactive. 如果目标对象的事务在准备状态或者为非活动状态则抛出。
SystemException - Thrown if the transaction manager encounters an unexpected error condition. 如果事务管理器遭遇无法预料错误的情况时抛出。

getStatus

public int getStatus()              throws SystemException
Obtain the status of the transaction associated with the target Transaction object. 获取与目标Transaction对象关联的事务状态。

Returns:
The transaction status. If no transaction is associated with the target object, this method returns the Status.NoTransaction value. 事务状态。如果当前线程没有关联事务,方法返回Status.NoTransaction值。
Throws:
SystemException - Thrown if the transaction manager encounters an unexpected error condition. 如果事务管理器遭遇无法预料错误的情况时抛出。

registerSynchronization

public void registerSynchronization(Synchronization sync)                             throws RollbackException,                                    IllegalStateException,                                    SystemException
Register a synchronization object for the transaction currently associated with the target object. The transction manager invokes the beforeCompletion method prior to starting the two-phase transaction commit process. After the transaction is completed, the transaction manager invokes the afterCompletion method. 为目前与目标对象关联的事务注册一个同步对象。事务管理器在开始两步事务提交过程前调用 beforeCompletion方法。事务完成后,事务管理器调用afterCompletion方法。

Parameters:
sync - The Synchronization object for the transaction associated with the target object. 与目标对象关联事务的Synchronization对象。
Throws:
RollbackException - Thrown to indicate that the transaction has been marked for rollback only. 抛出表示事务已被标记为仅回滚。
IllegalStateException - Thrown if the transaction in the target object is in the prepared state or the transaction is inactive. 如果目标对象的事务在准备状态或者为非活动状态则抛出。
SystemException - Thrown if the transaction manager encounters an unexpected error condition. 如果事务管理器遭遇无法预料错误的情况时抛出。

rollback

public void rollback()              throws IllegalStateException,                     SystemException
Rollback the transaction represented by this Transaction object. 回滚Transaction对象表示的事务。

Throws:
IllegalStateException - Thrown if the transaction in the target object is in the prepared state or the transaction is inactive. 如果目标对象的事务在准备状态或者为非活动状态则抛出。
SystemException - Thrown if the transaction manager encounters an unexpected error condition. 如果事务管理器遭遇无法预料错误的情况时抛出。

setRollbackOnly

public void setRollbackOnly()                     throws IllegalStateException,                            SystemException
Modify the transaction associated with the target object such that the only possible outcome of the transaction is to roll back the transaction. 修改当前线程的关联事务,使得事务的唯一可能结果是回滚该事务。

Throws:
IllegalStateException - Thrown if the target object is not associated with any transaction. 如果目标对象没有和关联任何事务时抛出。
SystemException - Thrown if the transaction manager encounters an unexpected error condition. 如果事务管理器遭遇无法预料错误的情况时抛出。

Overview Package  Class Tree Deprecated Index Help JavaTM 2 Platform
Ent. Ed. v1.4
 PREV CLASS   NEXT CLASSFRAMES    NO FRAMES     All Classes SUMMARY: NESTED | FIELD | CONSTR | METHODDETAIL: FIELD | CONSTR | METHOD
Submit a bug or feature

Copyright 2003 Sun Microsystems, Inc. All rights reserved.

原创粉丝点击