Results 1 to 4 of 4

Thread: Setting transaction timeout on Jotm Current/JotmFactoryBean

  1. #1
    Join Date
    Jul 2005
    Posts
    16

    Default 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. #2
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    I don't think there is. However I think you can raise an issue on JIRA to make this feature reach the main distribution.
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

  3. #3
    Join Date
    Aug 2004
    Location
    Athens, OH
    Posts
    3

    Default

    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

  4. #4
    Join Date
    Jul 2010
    Posts
    1

    Thumbs up

    Quote 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!

Similar Threads

  1. Unit testing with JOTM and JtaTransactionManager
    By lalle in forum Architecture
    Replies: 1
    Last Post: Oct 15th, 2005, 09:05 AM
  2. Replies: 6
    Last Post: Mar 9th, 2005, 01:08 PM
  3. Transaction Management
    By caverns in forum Data
    Replies: 3
    Last Post: Mar 8th, 2005, 06:38 AM
  4. Replies: 3
    Last Post: Nov 19th, 2004, 07:16 PM
  5. Transaction pb Hibernate/MySQL
    By syluser in forum Data
    Replies: 2
    Last Post: Aug 28th, 2004, 02:40 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •