Commit 66bf1657 authored by terrymanu's avatar terrymanu
Browse files

TCLType => TransactionOperationType

parent 7b14fcb8
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@

package io.shardingsphere.core.constant;

import io.shardingsphere.core.constant.transaction.TransactionType;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

+4 −4
Original line number Diff line number Diff line
@@ -15,14 +15,14 @@
 * </p>
 */

package io.shardingsphere.core.constant;
package io.shardingsphere.core.constant.transaction;

/**
 * TCL Type.
 * Transaction operation type.
 *
 * @author zhaojun
 */
public enum TCLType {
public enum TransactionOperationType {
    
    SET, BEGIN, COMMIT, ROLLBACK, SAVEPOINT
    BEGIN, COMMIT, ROLLBACK
}
+1 −1
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@
 * </p>
 */

package io.shardingsphere.core.constant;
package io.shardingsphere.core.constant.transaction;

/**
 * Transaction type.
+8 −8
Original line number Diff line number Diff line
@@ -18,8 +18,8 @@
package io.shardingsphere.core.jdbc.adapter;

import com.google.common.base.Preconditions;
import io.shardingsphere.core.constant.TCLType;
import io.shardingsphere.core.constant.TransactionType;
import io.shardingsphere.core.constant.transaction.TransactionOperationType;
import io.shardingsphere.core.constant.transaction.TransactionType;
import io.shardingsphere.core.hint.HintManagerHolder;
import io.shardingsphere.core.jdbc.unsupported.AbstractUnsupportedOperationConnection;
import io.shardingsphere.core.routing.router.masterslave.MasterVisitedManager;
@@ -91,25 +91,25 @@ public abstract class AbstractConnectionAdapter extends AbstractUnsupportedOpera
        this.autoCommit = autoCommit;
        TransactionTypeHolder.set(TransactionType.LOCAL);
        recordMethodInvocation(Connection.class, "setAutoCommit", new Class[] {boolean.class}, new Object[] {autoCommit});
        EventBusInstance.getInstance().post(createTransactionEvent(TCLType.BEGIN));
        EventBusInstance.getInstance().post(createTransactionEvent(TransactionOperationType.BEGIN));
    }
    
    @Override
    public final void commit() {
        EventBusInstance.getInstance().post(createTransactionEvent(TCLType.COMMIT));
        EventBusInstance.getInstance().post(createTransactionEvent(TransactionOperationType.COMMIT));
    }
    
    @Override
    public final void rollback() {
        EventBusInstance.getInstance().post(createTransactionEvent(TCLType.ROLLBACK));
        EventBusInstance.getInstance().post(createTransactionEvent(TransactionOperationType.ROLLBACK));
    }
    
    private ShardingTransactionEvent createTransactionEvent(final TCLType tclType) {
    private ShardingTransactionEvent createTransactionEvent(final TransactionOperationType operationType) {
        switch (TransactionTypeHolder.get()) {
            case LOCAL:
                return new LocalTransactionEvent(tclType, cachedConnections.values(), autoCommit);
                return new LocalTransactionEvent(operationType, cachedConnections.values(), autoCommit);
            case XA:
                return new XATransactionEvent(tclType, "");
                return new XATransactionEvent(operationType, "");
            case BASE:
            default:
                throw new UnsupportedOperationException(TransactionTypeHolder.get().name());
+1 −1
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@ package io.shardingsphere.proxy.backend.jdbc;

import io.shardingsphere.core.constant.DatabaseType;
import io.shardingsphere.core.constant.SQLType;
import io.shardingsphere.core.constant.TransactionType;
import io.shardingsphere.core.constant.transaction.TransactionType;
import io.shardingsphere.core.merger.MergeEngineFactory;
import io.shardingsphere.core.merger.MergedResult;
import io.shardingsphere.core.metadata.table.executor.TableMetaDataLoader;
Loading