根据“尽力而为1PC"实现Spring ChainedTransactionManager图案 [英] Implementing Spring ChainedTransactionManager according to the "best efforts 1PC" pattern

查看:38
本文介绍了根据“尽力而为1PC"实现Spring ChainedTransactionManager图案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尽力而为 1PC 在 这篇文章.为 SpringSource 工作的作者 David Syer 提供了一个扩展 Spring AbstractPlatformTransactionManager 类的 ChainedTransactionManager 的实现.

The best effort 1PC is nicely described in this post. The author, David Syer, who works for SpringSource, provided an implementation of a ChainedTransactionManager extending the Spring AbstractPlatformTransactionManager class.

这个特定的事务管理器可以启动 n 个事务,例如 JDBC 或 JMS 会话,并使用 AbstractPlatformTransactionManagern 个实例执行提交/回滚, 每个资源一个.这在 XA 驱动程序不可用的情况下非常有用.由于帖子很旧,代码在 Spring 2.5 上运行良好,但在 Spring 3+ 上却失败了.

This particular transaction manager can start n transactions, e.g., JDBC or JMS sessions, and perform commit/rollback using n instances of AbstractPlatformTransactionManager, one per resource. This is very useful where XA drivers are not available. Since the post is very old, the code works fine with Spring 2.5, but it fails with Spring 3+.

有一个请求票来在 Spring 3+ 中实现类似的功能.我愿意尝试一下,但我想我会先问:那里有任何实现吗?

There is a request ticket to implement a similar feature in Spring 3+. I'm willing to give it a try but I thought I'd ask first: are there any implementations out there?

谢谢

推荐答案

根据 Luciano 的建议,我发现了一个完美的 ChainedTransactionManager 实现:

As suggested by Luciano, I found a perfectly working implementation of ChainedTransactionManager in:

<dependency>
  <groupId>org.springframework.data</groupId>
  <artifactId>spring-data-neo4j-tx</artifactId>
  <version>2.2.0.RELEASE</version>
</dependency>

类名:org.springframework.data.neo4j.transaction.ChainedTransactionManager

编辑:

ChainedTransactionManager 现在是 Spring Data Commons 的一部分,1.6.1 版.

The ChainedTransactionManager is now part of Spring Data Commons as of version 1.6.1.

这篇关于根据“尽力而为1PC"实现Spring ChainedTransactionManager图案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆