Atomikos使用UserTransactionServiceImp

时间:2018-05-11 08:18:56

标签: spring atomikos

我在使用Spring的Atomikos时遇到了更新max_actives的问题。

我正在创建UserTransactionImp

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

但我想将UserTransactionServiceImp设置为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>

问题是,似乎UserTransactionImp正在手动创建UserTransactionService的实例。

知道如何在Spring配置中实现这一点吗?

 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();
            }

        }
    }

问候。

1 个答案:

答案 0 :(得分:1)

您可以在类路径的根目录中提供名为transactions.properties的文件,而不是配置UserTransactionServiceImp,如下所述:

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