Commit 56b97f62 authored by terrymanu's avatar terrymanu
Browse files

split local transaction and xa transaction

parent e8815ef0
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -93,7 +93,7 @@ public abstract class AbstractConnectionAdapter extends AbstractUnsupportedOpera
    @Override
    public final void setAutoCommit(final boolean autoCommit) {
        this.autoCommit = autoCommit;
        TransactionContextHolder.set(new TransactionContext(new LocalTransactionManager(), TransactionType.XA, LocalTransactionEvent.class));
        TransactionContextHolder.set(new TransactionContext(new LocalTransactionManager(), TransactionType.LOCAL, LocalTransactionEvent.class));
        recordMethodInvocation(Connection.class, "setAutoCommit", new Class[] {boolean.class}, new Object[] {autoCommit});
        EventBusInstance.getInstance().post(buildTransactionEvent(TCLType.BEGIN));
    }
+1 −1
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ public final class TransactionContext {
    
    private TransactionManager transactionManager;
    
    private TransactionType transactionType = TransactionType.XA;
    private TransactionType transactionType = TransactionType.LOCAL;
    
    private Class<? extends TransactionEvent> transactionEventClazz = LocalTransactionEvent.class;

+1 −1
Original line number Diff line number Diff line
@@ -49,6 +49,6 @@ public class TransactionContextFactory {
     * @return local transaction context
     */
    public static TransactionContext newLocalTransactionContext() {
        return new TransactionContext(new LocalTransactionManager(), TransactionType.XA, LocalTransactionEvent.class);
        return new TransactionContext(new LocalTransactionManager(), TransactionType.LOCAL, LocalTransactionEvent.class);
    }
}
+3 −2
Original line number Diff line number Diff line
@@ -38,9 +38,10 @@ public final class TransactionEventFactory {
     */
    public static TransactionEvent create(final TCLType tclType) {
        switch (TransactionContextHolder.get().getTransactionType()) {
            case LOCAL:
                return new LocalTransactionEvent(tclType);
            case XA:
                return TransactionContextHolder.get().getTransactionEventClazz().isAssignableFrom(XaTransactionEvent.class)
                        ? new XaTransactionEvent(tclType, "") : new LocalTransactionEvent(tclType);
                return new XaTransactionEvent(tclType, "");
            case BASE:
            default:
                return null;