2010-07-15 7 views
7

Sto eseguendo un'applicazione J2SE che utilizza Atomikos che scarica i suoi numerosi file di registro nella directory corrente. Mi piacerebbe spostare la posizione di questi file in "/ tmp", ma non riesco a individuare una proprietà di configurazione che posso impostare dal mio file di configurazione Spring XML.Come spostare la posizione dei file tm.out e * .epoch di Atomikos?

documentazione

L'Atomikos fa riferimento a una proprietà:

com.atomikos.icatch.output_dir 

che sembra esattamente quello che mi serve, ma come impostare dalla primavera senza un file di jta.properties? Ecco il mio Transaction Manager config:

<bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager"> 
    <property name="transactionManager" ref="atomikosTransactionManager" /> 
    <property name="userTransaction" ref="atomikosUserTransaction" /> 
</bean> 

<bean id="atomikosTransactionManager" class="com.atomikos.icatch.jta.UserTransactionManager" 
    init-method="init" destroy-method="close"> 
    <!-- When close is called, should we force transactions to terminate? --> 
    <property name="forceShutdown" value="false" /> 
</bean> 

<bean id="atomikosUserTransaction" class="com.atomikos.icatch.jta.UserTransactionImp"> 
    <!-- Number of seconds before transaction timesout. --> 
    <property name="transactionTimeout" value="30" /> 
</bean> 

risposta

11

La proprietà in questione deve essere impostata sulla istanza singleton della transactionService - un oggetto che viene normalmente creato su richiesta da parte del gestore delle transazioni dell'utente:

<bean id="userTransactionService" class="com.atomikos.icatch.config.UserTransactionServiceImp" 
    init-method="init" destroy-method="shutdownForce"> 
    <constructor-arg> 
     <!-- IMPORTANT: specify all Atomikos properties here --> 
     <props> 
      <prop key="com.atomikos.icatch.service">com.atomikos.icatch.standalone.UserTransactionServiceFactory</prop> 
      <prop key="com.atomikos.icatch.output_dir">target/</prop> 
      <prop key="com.atomikos.icatch.log_base_dir">target/</prop> 
     </props> 
    </constructor-arg> 
</bean> 

Ora la proprietà è impostata. Tuttavia, per assicurarti di non avere due servizi di transazione in esecuzione, devi anche modificare il bean del gestore transazioni utente come segue:

<bean id="atomikosTransactionManager" class="com.atomikos.icatch.jta.UserTransactionManager" 
    init-method="init" destroy-method="close" depends-on="userTransactionService"> 
    <!-- When close is called, should we force transactions to terminate? --> 
    <property name="forceShutdown" value="false" /> 
    <!-- Do not create a transaction service as we have specified the bean in this file --> 
    <property name="startupTransactionService" value="false" /> 
</bean> 
+0

+1 per entrambe le domande e le risposte –

Problemi correlati