Java Code Examples for com.atomikos.icatch.jta.UserTransactionImp#setTransactionTimeout()

The following examples show how to use com.atomikos.icatch.jta.UserTransactionImp#setTransactionTimeout() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NodeListener.java    From JPPF with Apache License 2.0 6 votes vote down vote up
/**
 * Terminate the transaction and return an exception if any occurred.
 * @return Exception if any error occurred.
 */
@Override
public Exception call() {
  try {
    // create the datasource; it will be automatically enlisted in the transaction
    getDataSource();
    // start the atomikos transaction manager
    final UserTransactionImp utx = new UserTransactionImp();
    utx.setTransactionTimeout(60);
    if (rollbackOnly) utx.setRollbackOnly();
    utx.begin();
    final Connection c = getConnection();
    c.close();
    return null;
  } catch (final Exception e) {
    return e;
  }
}
 
Example 2
Source File: FastDepAtomikosTransactionConfigure.java    From fastdep with Apache License 2.0 5 votes vote down vote up
/**
 * userTransaction
 *
 * @return userTransactionImp
 * @throws Throwable throwable
 */
@Bean(name = "userTransaction")
public UserTransaction userTransaction() throws Throwable {
    UserTransactionImp userTransactionImp = new UserTransactionImp();
    userTransactionImp.setTransactionTimeout(10000);
    return userTransactionImp;
}
 
Example 3
Source File: SupportConfig.java    From jeesupport with MIT License 5 votes vote down vote up
/**
 * atomikos事务实现,一般情况无需修改
 * @return
 */
@Bean
public UserTransactionImp atomikosUT() throws SystemException {
    UserTransactionImp uti = new UserTransactionImp();

    if( CommonConfig.getBoolean( "jees.jdbs.enable" ) != true ) return uti;

    uti.setTransactionTimeout( CommonConfig.getInteger("jees.jdbs.trans.timeout", 300 ) );

    log.debug( "--Spring Bean[atomikosUT]初始化." );
    return uti;
}
 
Example 4
Source File: JpaCoreConfig.java    From bearchoke with Apache License 2.0 5 votes vote down vote up
@Bean
public UserTransactionImp userTransactionImp() throws SystemException {
    UserTransactionImp uti = new UserTransactionImp();
    uti.setTransactionTimeout(300);

    return uti;
}
 
Example 5
Source File: MainConfig.java    From spring-boot-jta-atomikos-sample with Apache License 2.0 4 votes vote down vote up
@Bean(name = "userTransaction")
public UserTransaction userTransaction() throws Throwable {
	UserTransactionImp userTransactionImp = new UserTransactionImp();
	userTransactionImp.setTransactionTimeout(10000);
	return userTransactionImp;
}