上次资源优化 [英] Last Resource Optimization

查看:167
本文介绍了上次资源优化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个不支持两阶段提交的资源适配器。
我知道有一种称为上一次资源优化的优化技术。



在JBoss上,你的XAResource类应该实现LastResource以便进行优化。 / p>

我的问题是:如何在WebLogic,WebSpehre,Glassfish等中完成这项工作......

解决方案

Weblogic: AFAIK (可能非常错误)只有JDBC驱动程序可以与LRO一起使用,而且它是纯粹的管理任务。当驱动程序不支持XA时,可以将其配置为与LRO一起使用:如果要从数据源启用非XA JDBC连接以模拟使用JTA参与全局事务,请选择此选项



基本上,LRO容忍没有准备阶段的资源,并且只能提交或回滚。因此,如果XA事务中只存在一个这样的资源,我们可能首先尝试准备所有其他资源,然后提交LRO,然后,如果成功,则提交其他资源,否则回滚其他资源。



您看,声明任何接口都没有特殊需要。它是一种可以与任何非XA资源一起使用的算法。我不确定JBoss为什么会这样,但我不希望其他服务器有类似的东西。


I'm writing a Resource Adaptor which does not support two phase commit. I know there is an optimization technique called: "Last Resource Optimization".

On JBoss your XAResource class should implement LastResource in order to have the optimization.

My question is: how this can be done in WebLogic, WebSpehre, Glassfish, etc...

解决方案

Weblogic: AFAIK (may be very wrong) only JDBC drivers can be used with LRO, and it's a purely administrative task. When a driver doesn't support XA, it can be configured to be used with LRO: "Select this option if you want to enable non-XA JDBC connections from the data source to emulate participation in global transactions using JTA".

Essentially, LRO tolerates a resource that has no prepare phase, and can only be committed or rolled back. Thus, if only one such resource exist in XA-transaction, we may first attempt to prepare all others, then commit that LRO one, then, if succeed, commit others, otherwise rollback others.

You see, there is no special need in declaring any interface. It's an algorithm that can work with any non-XA resource. I'm not sure why JBoss has it, but I don't expect other servers have something similar.

这篇关于上次资源优化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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