Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tcc-transaction 1.2.12 Dubbo模块,TccInvokerInvocationHandler 设置参数bug #310

Closed
LinMingHang opened this issue Jul 13, 2020 · 1 comment

Comments

@LinMingHang
Copy link

package org.mengyun.tcctransaction.dubbo.proxy.jdk;
public class TccInvokerInvocationHandler extends InvokerInvocationHandler {
......

@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
    Compensable compensable = method.getAnnotation(Compensable.class);
    if (compensable != null) {
        // 设置 @Compensable 属性
        if (StringUtils.isEmpty(compensable.confirmMethod())) {
            ReflectionUtils.changeAnnotationValue(compensable, "confirmMethod", method.getName());
            ReflectionUtils.changeAnnotationValue(compensable, "cancelMethod", method.getName());
            ReflectionUtils.changeAnnotationValue(compensable, "transactionContextEditor", DubboTransactionContextEditor.class);
            ReflectionUtils.changeAnnotationValue(compensable, "propagation", Propagation.SUPPORTS);
        }
        // 生成切面
        ProceedingJoinPoint pjp = new MethodProceedingJoinPoint(proxy, target, method, args);

        return FactoryBuilder.factoryOf(ResourceCoordinatorAspect.class).getInstance().interceptTransactionContextMethod(pjp);
    } else {
        return super.invoke(target, method, args);
    }
}

}

直接把 confirmMethod cancelMethod 名称赋值成方法名,导致事务恢复时 提交和回滚 出现错误

@changmingxie
Copy link
Owner

try confirm cancel都是同一个接口,根据transactioncontext参数不同 在provider端掉用不同的方法,可参考1.6.x看看 是否有你说的问题。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants