2014-10-31 06:20:28 -04:00
|
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
|
<!-- ============================================================================= -->
|
|
|
|
|
<!-- Copyright © 2009 Red Hat, Inc. and others. -->
|
|
|
|
|
<!-- -->
|
|
|
|
|
<!-- The text of and illustrations in this document are licensed by Red Hat under -->
|
|
|
|
|
<!-- a Creative Commons Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). -->
|
|
|
|
|
<!-- -->
|
|
|
|
|
<!-- An explanation of CC-BY-SA is available at -->
|
|
|
|
|
<!-- -->
|
|
|
|
|
<!-- http://creativecommons.org/licenses/by-sa/3.0/. -->
|
|
|
|
|
<!-- -->
|
|
|
|
|
<!-- In accordance with CC-BY-SA, if you distribute this document or an adaptation -->
|
|
|
|
|
<!-- of it, you must provide the URL for the original version. -->
|
|
|
|
|
<!-- -->
|
|
|
|
|
<!-- Red Hat, as the licensor of this document, waives the right to enforce, -->
|
|
|
|
|
<!-- and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent -->
|
|
|
|
|
<!-- permitted by applicable law. -->
|
|
|
|
|
<!-- ============================================================================= -->
|
|
|
|
|
<chapter id="transaction-config">
|
|
|
|
|
<title>配置资源管理器(Resource Manager)</title>
|
2014-11-19 03:44:57 -05:00
|
|
|
|
<para>ActiveMQ有自己的资源管理器来管理JTA事务。当一个事务开始时,资源管理器就得到通知并记录下该事务和它的状态。
|
2014-10-31 06:20:28 -04:00
|
|
|
|
有的时候一个事务开始后,最終被忘记。有时客户端崩溃并且再也不能恢复,这样的话该事务就一直存在下去。</para>
|
2014-11-19 03:44:57 -05:00
|
|
|
|
<para>为了解决这个问题,可以配置ActiveMQ来扫描过期的事务,并且将它们回滚。默认值是3000000毫秒(5分钟)。
|
2014-10-31 06:20:28 -04:00
|
|
|
|
它表示任何超过5分钟的事务都将被删除。这个超时对应的参数是<literal
|
2014-11-18 09:52:57 -05:00
|
|
|
|
>transaction-timeout</literal>,它在配置文件<literal>activemq-configuration.xml</literal>中(单位毫秒)。
|
2014-11-19 03:44:57 -05:00
|
|
|
|
参数<literal>transaction-timeout-scan-period</literal>定义了ActiveMQ扫描过期事务的间隔。</para>
|
|
|
|
|
<para>注意ActiveMQ不会单方面回滚一个已经处于准备状态的XA事务。如果你认为这些事务永远不会被事务管理器(transaction manager)
|
2014-10-31 06:20:28 -04:00
|
|
|
|
来处理的话,你必须通过管理接口来进行回滚。</para>
|
|
|
|
|
</chapter>
|