Commit 800f1a7e authored by terrymanu's avatar terrymanu
Browse files

remove SQL type from OverallExecutionEvent

parent fc61b2b4
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -24,7 +24,6 @@ import io.shardingsphere.core.executor.event.sql.SQLExecutionEvent;
import io.shardingsphere.core.executor.event.sql.SQLExecutionEventFactory;
import io.shardingsphere.core.executor.threadlocal.ExecutorDataMap;
import io.shardingsphere.core.executor.threadlocal.ExecutorExceptionHandler;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

import java.sql.SQLException;
@@ -41,9 +40,8 @@ import java.util.Map;
 * @param <T> class type of return value
 */
@RequiredArgsConstructor
public final class SQLExecuteCallback<T> implements ShardingExecuteCallback<BaseStatementUnit, T> {
public class SQLExecuteCallback<T> implements ShardingExecuteCallback<BaseStatementUnit, T> {
    
    @Getter
    private final SQLType sqlType;
    
    private final boolean isExceptionThrown;
+1 −1
Original line number Diff line number Diff line
@@ -61,7 +61,7 @@ public final class SQLExecutorEngine implements AutoCloseable {
     * @throws SQLException SQL exception
     */
    public <T> List<T> execute(final Collection<? extends BaseStatementUnit> baseStatementUnits, final SQLExecuteCallback<T> executeCallback) throws SQLException {
        OverallExecutionEvent event = new OverallExecutionEvent(executeCallback.getSqlType(), baseStatementUnits.size() > 1);
        OverallExecutionEvent event = new OverallExecutionEvent(baseStatementUnits.size() > 1);
        ShardingEventBusInstance.getInstance().post(event);
        try {
            List<T> result = ConnectionMode.MEMORY_STRICTLY == connectionMode ? shardingExecuteEngine.execute(new LinkedList<>(baseStatementUnits), executeCallback)
+0 −3
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@

package io.shardingsphere.core.executor.event.overall;

import io.shardingsphere.core.constant.SQLType;
import io.shardingsphere.core.event.ShardingEvent;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
@@ -31,7 +30,5 @@ import lombok.RequiredArgsConstructor;
@Getter
public final class OverallExecutionEvent extends ShardingEvent {
    
    private final SQLType sqlType;
    
    private final boolean parallelExecute;
}
+0 −1
Original line number Diff line number Diff line
@@ -52,7 +52,6 @@ public final class ExecutorTestUtil {
     * @param event overall execution event
     */
    public static void listen(final EventCaller eventCaller, final OverallExecutionEvent event) {
        eventCaller.verifySQLType(event.getSqlType());
        eventCaller.verifyIsParallelExecute(event.isParallelExecute());
        if (ShardingEventType.EXECUTE_FAILURE == event.getEventType()) {
            eventCaller.verifyException(event.getException());
+1 −1
Original line number Diff line number Diff line
@@ -55,7 +55,7 @@ public final class OverallExecuteEventListener extends OpenTracingListener<Overa
    
    @Override
    protected void beforeExecute(final OverallExecutionEvent event) {
        ActiveSpan activeSpan = ShardingTracer.get().buildSpan(OPERATION_NAME_PREFIX + event.getSqlType().name()).withTag(Tags.COMPONENT.getKey(), ShardingTags.COMPONENT_NAME).startActive();
        ActiveSpan activeSpan = ShardingTracer.get().buildSpan(OPERATION_NAME_PREFIX).withTag(Tags.COMPONENT.getKey(), ShardingTags.COMPONENT_NAME).startActive();
        SPAN.set(activeSpan);
        if (event.isParallelExecute()) {
            ExecutorDataMap.getDataMap().put(SNAPSHOT_DATA_KEY, activeSpan.capture());