Announcement Announcement Module
Collapse
No announcement yet.
Setting transaction timeout on Jotm Current/JotmFactoryBean Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Setting transaction timeout on Jotm Current/JotmFactoryBean

    We are using JOTM for Transaction Manager functionality when running our code outside of an app server. Our configuration looks like this:

    Code:
    <beans>
    	<bean id="jotm" class="org.springframework.transaction.jta.JotmFactoryBean">
    	</bean>
    
    	<bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">
    		<property name="userTransaction"><ref local="jotm"/></property>
    	</bean>
    
    	<bean id="dataSource" class="org.enhydra.jdbc.pool.StandardXAPoolDataSource" destroy-method="shutdown">
    	   <property name="dataSource">
    	      <bean class="org.enhydra.jdbc.standard.StandardXADataSource" destroy-method="shutdown">
    	         <property name="transactionManager" ref="jotm" />
    	         <property name="driverName" value="com.ibm.db2.jcc.DB2Driver" />
    	         <property name="url" value="jdbc&#58;db2&#58;dbname" />
    			 <property name="user" value="xxx"/>
    			 <property name="password" value="xxx"/>
    	      </bean>
    	   </property>
    	   <property name="user" value="xxx"/>
    	   <property name="password" value="xxx"/>
    	   <property name="maxSize" value="50"/>
    	</bean>
    
    
        <bean id="exampleDAO" class="example.ExampleDAOImpl">
            <property name="dataSource"><ref bean="dataSource"></ref></property>
        </bean>
    In certain situations we need to increase the default transaction timeout, which with JOTM is 60 seconds (this is a batch application).

    How do you set a property on the JotmFactoryBean to set the transaction timeout value? The JotmFactoryBean bean itself does not have transactionTimeout property, but the bean it returns does (an instance of JOTM current).

    In this case do I need to write a wrapper bean around the JotmFactoryBean to a) get an instance from the factory, and then b) set the transactionTimeout on it?

    I know I can programmatically call setTransactionTimeout() on Current, which is returned by JotmFactoryBean, so writing a wrapper bean to do this seems like the way I have to do this, but is there an easier way?

    Thanks,
    Kevin Hooke

  • #2
    I don't think there is. However I think you can raise an issue on JIRA to make this feature reach the main distribution.

    Comment


    • #3
      I've had the situation where JOTM would automatically rollback the transaction due to timeout. If you're using the TransactionProxyFactoryBean to setup your transactions, you can specify specify a timeout in the transactionAttributes properties.

      For example, we have batch jobs that run which need a long timeout. For the method "executeJob", I specify timeout_600. This seems to have fixed the problem without needing to change the default timeout.

      <prop key="executeJob">
      PROPAGATION_REQUIRED,timeout_600
      </prop>

      ~Don

      Comment


      • #4
        Originally posted by dp3 View Post
        I've had the situation where JOTM would automatically rollback the transaction due to timeout. If you're using the TransactionProxyFactoryBean to setup your transactions, you can specify specify a timeout in the transactionAttributes properties.

        For example, we have batch jobs that run which need a long timeout. For the method "executeJob", I specify timeout_600. This seems to have fixed the problem without needing to change the default timeout.

        <prop key="executeJob">
        PROPAGATION_REQUIRED,timeout_600
        </prop>

        ~Don
        Hey, you settle my problem! Thank you very much!

        Comment

        Working...
        X