Search code examples
springatomikos

Atomikos config UserTransactionImp with UserTransactionServiceImp


I´m using Atomikos with Spring and I´m having problems to update the max_actives.

I´m creating the UserTransactionImp

<bean id="AtomikosUserTransaction" class="com.atomikos.icatch.jta.UserTransactionImp">
    <property name="transactionTimeout" value="300"/>
</bean>

But I would like to set UserTransactionServiceImp with the config of max_actives

<bean id="atomikosUserTransactionService" class="com.atomikos.icatch.config.UserTransactionServiceImp"
      init-method="init" destroy-method="shutdownForce">
    <constructor-arg>
        <props>
            <prop key="com.atomikos.icatch.service">com.atomikos.icatch.standalone.UserTransactionServiceFactory</prop>
            <prop key="com.atomikos.icatch.log_base_name">f2e_transactions</prop>
            <prop key="com.atomikos.icatch.output_dir">../standalone/log/</prop>
            <prop key="com.atomikos.icatch.log_base_dir">../standalone/log/</prop>
            <prop key="com.atomikos.icatch.max_actives">1000</prop>

        </props>
    </constructor-arg>
</bean>

The problem is that it´s seems like UserTransactionImp is creating an instance of UserTransactionService manually.

Any idea how to achieve this in Spring configuration?

 private void checkSetup() {
        Class var1 = TransactionManagerImp.class;
        synchronized(TransactionManagerImp.class) {
            this.txmgr_ = TransactionManagerImp.getTransactionManager();
            if (this.txmgr_ == null) {
                UserTransactionService uts = new UserTransactionServiceImp();
                uts.init();
                this.txmgr_ = TransactionManagerImp.getTransactionManager();
            }

        }
    }

Regards.


Solution

  • Instead of configuring a UserTransactionServiceImp you can provide a file called transactions.properties at the root of the classpath as described here :

    https://www.atomikos.com/Documentation/JtaProperties