JBoss事务超时设置?
我们在JBoss 5.1.0.GA应用程序中有一个计时器服务触发任务,问题是我们无法更改事务超时。这种长Lucene索引可能需要比默认的300秒限制更长的时间 问题是如何更改超时值,将@TransactionTimeout(1800)添加到worker方法或类没有任何效果 编辑:在deploy/transaction-jboss-beans.xml中设置此选项可以正常工作:JBoss事务超时设置?,jboss,timeout,ejb-3.0,transactions,jboss5.x,Jboss,Timeout,Ejb 3.0,Transactions,Jboss5.x,我们在JBoss 5.1.0.GA应用程序中有一个计时器服务触发任务,问题是我们无法更改事务超时。这种长Lucene索引可能需要比默认的300秒限制更长的时间 问题是如何更改超时值,将@TransactionTimeout(1800)添加到worker方法或类没有任何效果 编辑:在deploy/transaction-jboss-beans.xml中设置此选项可以正常工作: <property name="transactionTimeout">1800</property&g
<property name="transactionTimeout">1800</property>
1800
但是注释似乎对计时器启动的EJB或正常的无状态EJB都没有影响 它是MDB吗?它们有不同的注释。该链接提供了通过配置文件上的代码设置事务超时的各种选项。您可以手动声明超时时间并在会话Bean中创建计时器 下面是我的无状态Bean的示例代码:
public void createTimer(String timerName) {
//...
sessionContext.getTimerService().createTimer(timeLongValue, timerName);
//...
}
@Timeout
public void timeOutHandler(Timer timer){
// code
}
请尝试在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>
120
${jboss.server.data.dir}/tx对象存储
这是一个基于服务器的配置,因此请在您的服务器目录下查找conf/jboss service.xml。我正在将EJB3与jboss 5.1.0.GA一起使用,并已成功设置 此值位于
JBOSS\u HOME/deploy/transaction JBOSS beans.xml
中
在
300
中,默认值为300。请在
元素中指定事务超时时间。此元素表示在等待连接和显示异常之前阻止事务的最长时间(以毫秒为单位)。
这只会在等待连接许可证时阻塞,并且如果创建新连接需要非常长的时间,则不会显示异常
<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>
jdbc:sqlserver://xx.xx.xxx.xxx:1433;databaseName=xxxx
SQLServerDriver
事务读取已提交
50
150
假的
xxx
xxx
36000
jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB\u关闭\u打开\u退出=错误
氢
sa
sa
com.microsoft.sqlserver.jdbc.SQLServerDataSource
org.h2.jdbcx.JdbcDataSource
与Jboss无关,但您可以通过
com.arjuna.ats.arjuna.coordinator.defaultTimeout=60属性。事务超时,JBOSS EPA 7.1版本中的默认设置为300 添加此行(
)在路径“.standalone/configuration/standalone.xml中添加配置文件
。。。。
@TransactionTimeout
不是标准的JavaEE注释。。。它来自哪里?它是JBoss特有的注释。
....
<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>