`
isiqi
  • 浏览: 16754825 次
  • 性别: Icon_minigender_1
  • 来自: 济南
社区版块
存档分类
最新评论

javax.transaction.TransactionManager翻译

阅读更多
<!-- ========= START OF TOP NAVBAR ======= --><!-- -->
JavaTM 2 Platform
Ent. Ed. v1.4
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->

javax.transaction
Interface TransactionManager


public interface TransactionManager

The TransactionManager interface defines the methods that allow an application server to manage transaction boundaries. TransactionManager接口定义了一些用来让应用服务器管理事务的方法。


<!-- ======== NESTED CLASS SUMMARY ======== --><!-- =========== FIELD SUMMARY =========== --><!-- ======== CONSTRUCTOR SUMMARY ======== --><!-- ========== METHOD SUMMARY =========== --><!-- -->

Method Summary
void begin()
Create a new transaction and associate it with the current thread. 创建一个新事物并与当前线程关联。
void commit()
Complete the transaction associated with the current thread. 完成与当前线程关联的事务。
int getStatus()
Obtain the status of the transaction associated with the current thread. 获取与当前线程关联事务的状态。
Transaction getTransaction()
Get the transaction object that represents the transaction context of the calling thread. 获得表示调用线程事务上下文的事务对象。
void resume(Transactiontobj)
Resume the transaction context association of the calling thread with the transaction represented by the supplied Transaction object. 恢复调用线程的事务上下文与提供的Transaction对象表示的事务的关联。
void rollback()
Roll back the transaction associated with the current thread. 回滚与当前线程关联的事务。
void setRollbackOnly()
Modify the transaction associated with the current thread such that the only possible outcome of the transaction is to roll back the transaction. 修改当前线程的关联事务,使得事务的唯一可能结果是回滚该事务。
void setTransactionTimeout(intseconds)
Modify the timeout value that is associated with transactions started by subsequent invocations of the begin method. 修改随后使用begin方法调用开始的事务超时值。
Transaction suspend()
Suspend the transaction currently associated with the calling thread and return a Transaction object that represents the transaction context being suspended. 延迟调用线程当前关联的事务,返回表示事务上下文被延迟的Transaction对象。

<!-- ============ FIELD DETAIL =========== --><!-- ========= CONSTRUCTOR DETAIL ======== --><!-- ============ METHOD DETAIL ========== --><!-- -->

Method Detail
<!-- -->

begin

public void begin()
           throws NotSupportedException,
                  SystemException
Create a new transaction and associate it with the current thread. 创建一个新事物并与当前线程关联。

Throws:
NotSupportedException - Thrown if the thread is already associated with a transaction and the Transaction Manager implementation does not support nested transactions. 当线程已经与事务关联,事务管理器的实现不支持嵌套事务时抛出。
SystemException - Thrown if the transaction manager encounters an unexpected error condition. 如果事务管理器遭遇无法预料错误的情况时抛出。

<!-- -->

commit

public void commit()
            throws RollbackException,
                   HeuristicMixedException,
                   HeuristicRollbackException,
                   SecurityException,
                   IllegalStateException,
                   SystemException
Complete the transaction associated with the current thread. When this method completes, the thread is no longer associated with a 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 current thread is not associated with a transaction. 如果当前线程没有和事务关联时抛出。
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 current thread. 获取与当前线程关联事务的状态。

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

<!-- -->

getTransaction

public Transaction getTransaction()
                           throws SystemException
Get the transaction object that represents the transaction context of the calling thread. 获得表示调用线程事务上下文的事务对象。

Returns:
the Transaction object representing the transaction associated with the calling thread. 表示调用线程关联事务的Transaction对象。
Throws:
SystemException - Thrown if the transaction manager encounters an unexpected error condition. 如果事务管理器遭遇无法预料错误的情况时抛出。

<!-- -->

resume

public void resume(Transactiontobj)
            throws InvalidTransactionException,
                   IllegalStateException,
                   SystemException
Resume the transaction context association of the calling thread with the transaction represented by the supplied Transaction object. When this method returns, the calling thread is associated with the transaction context specified. 恢复调用线程的事务上下文与提供的Transaction对象表示的事务的关联。 当方法返回后,调用线程和指定事务上下文关联。

Parameters:
tobj - The Transaction object that represents the transaction to be resumed. 要恢复的表示事务的Transaction对象。
Throws:
InvalidTransactionException - Thrown if the parameter transaction object contains an invalid transaction. 如果事务对象参数包含一个无效事务时抛出。
IllegalStateException - Thrown if the thread is already associated with another transaction. 如果线程已经与另一个事务关联时抛出。
SystemException - Thrown if the transaction manager encounters an unexpected error condition. 如果事务管理器遭遇无法预料错误的情况时抛出。

<!-- -->

rollback

public void rollback()
              throws IllegalStateException,
                     SecurityException,
                     SystemException
Roll back the transaction associated with the current thread. When this method completes, the thread is no longer associated with a transaction. 回滚与当前线程关联的事务。方法完成后,线程不再与事务关联。

Throws:
SecurityException - Thrown to indicate that the thread is not allowed to roll back the transaction. 抛出表示当前线程不允许回滚事务。
IllegalStateException - Thrown if the current thread is not associated with a transaction. 如果当前线程没有和事务关联时抛出。
SystemException - Thrown if the transaction manager encounters an unexpected error condition. 如果事务管理器遭遇无法预料错误的情况时抛出。

<!-- -->

setRollbackOnly

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

Throws:
IllegalStateException - Thrown if the current thread is not associated with a transaction. 如果当前线程没有和事务关联时抛出。
SystemException - Thrown if the transaction manager encounters an unexpected error condition. 如果事务管理器遭遇无法预料错误的情况时抛出。

<!-- -->

setTransactionTimeout

public void setTransactionTimeout(intseconds)
                           throws SystemException
Modify the timeout value that is associated with transactions started by subsequent invocations of the begin method. 修改随后使用begin方法调用开始的事务超时值。

If an application has not called this method, the transaction service uses some default value for the transaction timeout. 如果应用没有调用该方法,事务服务将使用事务超时的默认值。

Parameters:
seconds - The value of the timeout in seconds. If the value is zero, the transaction service restores the default value. If the value is negative a SystemException is thrown. 以秒为单位的超时值。如果值为0,事务服务恢复为初始值。如果值为负,抛出SystemException。
Throws:
SystemException - Thrown if the transaction manager encounters an unexpected error condition. 如果事务管理器遭遇无法预料错误的情况时抛出。

<!-- -->

suspend

public Transaction suspend()
                    throws SystemException
Suspend the transaction currently associated with the calling thread and return a Transaction object that represents the transaction context being suspended. If the calling thread is not associated with a transaction, the method returns a null object reference. When this method returns, the calling thread is not associated with a transaction. 延迟调用线程当前关联的事务,返回表示事务上下文被延迟的Transaction对象。 如果调用线程未与事务关联,方法返回null对象引用。当方法返回后,调用 线程不再与事务关联。

Returns:
Transaction object representing the suspended transaction. 表示延迟事务的Transaction对象。
Throws:
SystemException - Thrown if the transaction manager encounters an unexpected error condition. 如果事务管理器遭遇无法预料错误的情况时抛出。
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== --><!-- -->
JavaTM 2 Platform
Ent. Ed. v1.4
<!-- ======== END OF BOTTOM NAVBAR ======= -->
Submit a bug or feature

Copyright 2003 Sun Microsystems, Inc. All rights reserved.

分享到:
评论

相关推荐

    javax.transaction.jar

    【javax.transaction.jar】是Java平台上的一个核心组件,主要用于处理分布式环境中的事务管理。这个库包含了一组接口和类,这些接口和类定义了事务管理的API,使得开发者能够在Java应用程序中实现事务处理的规范。在...

    javaee.jar源代码

    6. **JTA(Java Transaction API)**:`javax.transaction`包提供了分布式事务管理的接口,如`javax.transaction.UserTransaction`用于手动控制事务,而`javax.transaction.TransactionManager`则用于程序化的事务...

    j2ee的用到的所有jar

    `jta.jar`包含了`javax.transaction.UserTransaction`和`javax.transaction.TransactionManager`等接口。 6. **JMS API JAR**:JMS用于在Java应用程序之间发送和接收消息。`jms.jar`包含了`javax.jms.Message`和`...

    最新J2EE中午API

    `javax.transaction`包中的`UserTransaction`、`TransactionManager`接口以及`javax.transaction.xa.XAResource`接口,为开发者提供了事务的开始、提交、回滚和参与资源的能力。 6. **JNDI(Java Naming and ...

    jta.jar包;jta.jar包

    `javax.transaction.TransactionManager`接口提供了这些功能。 3. **ResourceManager**: 这是与特定数据源(如数据库、消息队列)交互的组件。每个资源管理器都实现了`javax.transaction.xa.XAResource`接口,能够...

    INT系统src(elis)

    6. **JTA接口**:Java Transaction API(JTA)定义了管理分布式事务的标准接口,如`javax.transaction.UserTransaction`和`javax.transaction.TransactionManager`,使得应用能够跨越多个资源(如数据库和JMS队列)...

    J2EE API   

    `javax.transaction`包定义了`UserTransaction`, `TransactionManager`等接口,用于管理和控制事务的生命周期。 **6. Java Naming and Directory Interface (JNDI)** JNDI提供了一种查找和管理命名和目录服务的统一...

    J2EE搭建站点常用API

    `javax.transaction`包包含了TransactionManager和UserTransaction接口,使得开发者能够控制事务的开始、提交、回滚等操作。 7. **JAF (JavaBeans Activation Framework)**:JAF是Java中的一个框架,用于处理不同...

    浅谈SpringBoot之事务处理机制

    需要特别注意的是,此@Transactional注解来自org.springframework.transaction.annotation包,而不是javax.transaction。Spring提供了一个@EnableTransactionManagement注解在配置类上来开启声明式事务的支持。 ...

    JavaEE源码

    javax.transaction包提供了事务管理和协调的接口,如UserTransaction和TransactionManager。 10. **JAF(JavaBeans Activation Framework)**:JAF帮助Java应用程序识别和操作不同的数据格式。javax.activation包包...

    j2ee api

    `javax.transaction`包中的接口如`UserTransaction`, `TransactionManager`等,用于管理和控制分布式事务。 7. **JNDI(Java Naming and Directory Interface)**:JNDI提供了一个统一的接口,用于查找和管理分布式...

    j2ee api文档

    `javax.transaction`包中的`UserTransaction`和`TransactionManager`接口用于控制事务的开始、提交、回滚等操作。 8. **JAF(JavaBeans Activation Framework)**:JAF为处理MIME类型的数据提供了一套框架,使得...

    J2EE-API.zip_java2ee

    `javax.transaction`包定义了`UserTransaction`和`TransactionManager`接口,用于控制事务的开始、提交、回滚和查询。 7. **JavaMail API**:JavaMail API允许开发者在Java应用程序中发送和接收电子邮件。它包括`...

    jdbc驱动,三个jar文件

    3. **javax.transaction**:虽然不是所有JDBC应用都需要这个,但在某些情况下,特别是涉及到事务管理时,可能需要引入`javax.transaction`相关的JAR文件。这个库提供了事务处理的接口和类,如`UserTransaction`和`...

    在Spring中使用JTA事务管理

    type="javax.transaction.TransactionManager" factory="com.atomikos.icatch.jta.UserTransactionManagerFactory" /&gt; &lt;!-- ... --&gt; ``` #### 2.3. 配置JNDI数据源 同样在`server.xml`中,配置两个JNDI数据源,...

    Java事务处理详细介绍

    - `javax.transaction.TransactionManager`:管理事务生命周期。 - `javax.sql.XADataSource`、`javax.sql.XAConnection`和`javax.sql.XAResource`:这些接口用于支持X/Open XA协议,使得不同的资源能够协同工作在一...

    JTA1.2规范

    - `javax.transaction.TransactionManager`:为事务管理器提供了一个标准接口,支持程序化事务控制。 - `javax.transaction.Status`:定义了一系列事务状态常量,用于指示当前事务的状态。 2. **事务的生命周期...

    J2EE_API帮助文档

    `UserTransaction`接口允许程序员显式控制事务,而`TransactionManager`则用于全局事务管理。 **7. Java Naming and Directory Interface (JNDI)** JNDI为查找和管理网络资源提供了一个统一的接口。它可以在EJB、...

    在学习中发现的一些ssh-error

    Error creating bean with name 'sessionFactory' defined in resource`可能是因为缺少JTA(Java Transaction API)的支持,例如找不到`javax.transaction.TransactionManager`。确保JTA相关的库(如jta.jar)在类...

Global site tag (gtag.js) - Google Analytics