15

We have a timer service triggered task in JBoss 5.1.0.GA application and the problem is that we cannot change the transaction time out. This long Lucene indexing can take longer than the default 300 second limit.

The question is how to change the timeout value, adding @TransactionTimeout(1800) to the worker method or the class did not have any effect.

Edit: Setting this in deploy/transaction-jboss-beans.xml works fine:

<property name="transactionTimeout">1800</property>

but the annotation doesn't seem to have effect on either timer initiated or normal stateless EJBs.

Petteri H
  • 11,779
  • 12
  • 64
  • 94

7 Answers7

11

Transaction timeout,default settings in JBOSS EPA 7.1 version is 300.

jboss portal screen

Add this line(<coordinator-environment enable-tsm-status="true" default-timeout="1200"/>) add the configuration file in path "..standalone/configuration/standalone.xml"

                                    ....
<subsystem xmlns="urn:jboss:domain:transactions:4.0">
            <core-environment>
                <process-id>
                    <uuid/>
                </process-id>
            </core-environment>
            <recovery-environment socket-binding="txn-recovery-environment" status-socket-binding="txn-status-manager"/>
            <coordinator-environment enable-tsm-status="true" default-timeout="1200"/>
            <object-store path="tx-object-store" relative-to="jboss.server.data.dir"/>
 </subsystem>
fgul
  • 5,763
  • 2
  • 46
  • 32
9

I am using EJB3 with Jboss 5.1.0.GA and have successfully set this value in JBOSS_HOME/deploy/transaction-jboss-beans.xml.

The default was 300 in <property name="transactionTimeout">300</property>

David Hedlund
  • 128,221
  • 31
  • 203
  • 222
Vijay Kumar
  • 841
  • 1
  • 9
  • 13
4

Try setting this in jboss-service.xml:

   <!-- JBoss Transactions JTA -->
   <mbean code="com.arjuna.ats.jbossatx.jta.TransactionManagerService"
      name="jboss:service=TransactionManager">
      <attribute name="TransactionTimeout">120</attribute> <!-- timeout in seconds-->
      <attribute name="ObjectStoreDir">${jboss.server.data.dir}/tx-object-store</attribute>
   </mbean>

This is a server based configuration, so look for conf/jboss-service.xml under your server directory.

Awi
  • 285
  • 1
  • 3
  • 12
2

TransactionTimeout is it a MDB? they have a different annotation. The link gives the various options for setting the transation timeout either via code on config files.

Dherik
  • 17,757
  • 11
  • 115
  • 164
HadleyHope
  • 1,173
  • 1
  • 10
  • 19
2

You can manually declare the timeout period and create a timer in Session Bean.

Below is sample code of my Stateless Bean :

public void createTimer(String timerName) {
  //...
  sessionContext.getTimerService().createTimer(timeLongValue, timerName);
  //...
}

@Timeout
public void timeOutHandler(Timer timer){
  // code  
}
Guido
  • 46,642
  • 28
  • 120
  • 174
Nayan Wadekar
  • 11,444
  • 4
  • 50
  • 73
2

Not related to Jboss but you can set arjuna transaction timeout via com.arjuna.ats.arjuna.coordinator.defaultTimeout=60 property.

Gregor
  • 385
  • 3
  • 15
1

Specify the transaction timeout in the <blocking-timeout-millis> element.This element indicates the maximum time in milliseconds to block a transaction while waiting for a connection and before displaying an exception. This blocks only while waiting for a permit for a connection, and does not display an exception if creating a new connection that takes an inordinately long time.

<subsystem xmlns="urn:jboss:domain:datasources:4.0">
            <datasources>
                <datasource jndi-name="java:jboss/xyz" pool-name="abc" enabled="true" use-java-context="true">
                    <connection-url>jdbc:sqlserver://xx.xx.xxx.xxx:1433;databaseName=xxxx</connection-url>
                    <driver>SQLServerDriver</driver>
                    <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
                    <pool>
                        <min-pool-size>50</min-pool-size>
                        <max-pool-size>150</max-pool-size>
                        <prefill>false</prefill>
                    </pool>
                    <security>
                        <user-name>xxx</user-name>
                        <password>xxx</password>
                    </security>
                    <timeout>
                        <blocking-timeout-millis>36000</blocking-timeout-millis>
                    </timeout>
                </datasource>
                <datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true">
                    <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
                    <driver>h2</driver>
                    <security>
                        <user-name>sa</user-name>
                        <password>sa</password>
                    </security>
                </datasource>
                <drivers>
                    <driver name="SQLServerDriver" module="com.microsoft.sqlserver">
                        <xa-datasource-class>com.microsoft.sqlserver.jdbc.SQLServerDataSource</xa-datasource-class>
                    </driver>
                    <driver name="h2" module="com.h2database.h2">
                        <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
                    </driver>
                </drivers>
            </datasources>
        </subsystem>
Mahendra Andhale
  • 489
  • 8
  • 14