【问题标题】:Spring Batch suspend transaction (NOT_SUPPORTED) for tasklet execution on websphere application serverSpring Batch 暂停事务(NOT_SUPPORTED),用于在 websphere 应用程序服务器上执行 tasklet
【发布时间】:2016-02-03 16:45:42
【问题描述】:

这是我们的应用程序如何为 Spring 批处理配置的。

Spring 批处理和 Quartz 相关表在单独的实例上配置。 特定于应用程序的数据库实例是不同的。 应用程序在 WebSphere Application Server 8.0 上运行

我们不希望将 spring 批处理事务传播到 tasklet 执行。为了实现这一点,我们已经尝试过,但它似乎不起作用。 有没有人遇到过类似的问题?请建议如何进行。

交易没有暂停。 Spring 使用 ConnectionHolder 缓存连接,如果它在事务下,则不会释放连接。我们不希望连接被缓存,我们希望从数据源(连接池)获取新的连接,而不是使用 spring 缓存的连接句柄。

<batch:job id="jobId" job-repository="jobRepository">
    <batch:step id="stepId">
        <batch:tasklet ref="taskletId">
            <batch:transaction-attributes propagation="NOT_SUPPORTED" />
        </batch:tasklet>
    </batch:step>
</batch:job>

<bean id="transactionManager" class="org.springframework.transaction.jta.WebSphereUowTransactionManager"/>

谢谢。

【问题讨论】:

    标签: spring websphere spring-batch spring-transactions propagation


    【解决方案1】:

    真正解决这个问题的最佳方法是使用一个独立的、特定于应用程序的数据源,该数据源与您当前参与的事务无关。这首先会阻止正在使用的连接成为事务的一部分。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-01-13
      • 1970-01-01
      • 2011-11-30
      • 1970-01-01
      • 2019-08-06
      • 2020-01-22
      • 2017-11-17
      • 2015-03-25
      相关资源
      最近更新 更多