Commit fc61b2b4 authored by terrymanu's avatar terrymanu
Browse files

ExecuteCallback => SQLExecuteCallback

parent 12ccc776
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@ import java.sql.SQLException;
 * 
 * @param <T> class type of return value
 */
public interface JDBCExecuteCallback<T> {
public interface JDBCExecutor<T> {
    
    /**
     * execute JDBC.
+2 −2
Original line number Diff line number Diff line
@@ -41,7 +41,7 @@ import java.util.Map;
 * @param <T> class type of return value
 */
@RequiredArgsConstructor
public final class ExecuteCallback<T> implements ShardingExecuteCallback<BaseStatementUnit, T> {
public final class SQLExecuteCallback<T> implements ShardingExecuteCallback<BaseStatementUnit, T> {
    
    @Getter
    private final SQLType sqlType;
@@ -50,7 +50,7 @@ public final class ExecuteCallback<T> implements ShardingExecuteCallback<BaseSta
    
    private final Map<String, Object> dataMap;
    
    private final JDBCExecuteCallback<T> jdbcCallback;
    private final JDBCExecutor<T> jdbcCallback;
    
    private final EventBus shardingEventBus = ShardingEventBusInstance.getInstance();
    
+3 −3
Original line number Diff line number Diff line
@@ -39,14 +39,14 @@ import java.util.Map;
 * @author maxiaoguang
 * @author panjuan
 */
public final class ExecutorEngine implements AutoCloseable {
public final class SQLExecutorEngine implements AutoCloseable {
    
    @Getter
    private final ShardingExecuteEngine shardingExecuteEngine;
    
    private final ConnectionMode connectionMode;
    
    public ExecutorEngine(final int executorSize, final ConnectionMode connectionMode) {
    public SQLExecutorEngine(final int executorSize, final ConnectionMode connectionMode) {
        shardingExecuteEngine = new ShardingExecuteEngine(executorSize);
        this.connectionMode = connectionMode;
    }
@@ -60,7 +60,7 @@ public final class ExecutorEngine implements AutoCloseable {
     * @return execute result
     * @throws SQLException SQL exception
     */
    public <T> List<T> execute(final Collection<? extends BaseStatementUnit> baseStatementUnits, final ExecuteCallback<T> executeCallback) throws SQLException {
    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);
        ShardingEventBusInstance.getInstance().post(event);
        try {
+5 −5
Original line number Diff line number Diff line
@@ -20,9 +20,9 @@ package io.shardingsphere.core.executor.type.batch;
import io.shardingsphere.core.constant.DatabaseType;
import io.shardingsphere.core.constant.SQLType;
import io.shardingsphere.core.executor.BaseStatementUnit;
import io.shardingsphere.core.executor.ExecuteCallback;
import io.shardingsphere.core.executor.ExecutorEngine;
import io.shardingsphere.core.executor.JDBCExecuteCallback;
import io.shardingsphere.core.executor.SQLExecuteCallback;
import io.shardingsphere.core.executor.SQLExecutorEngine;
import io.shardingsphere.core.executor.JDBCExecutor;
import io.shardingsphere.core.executor.threadlocal.ExecutorDataMap;
import io.shardingsphere.core.executor.threadlocal.ExecutorExceptionHandler;
import lombok.RequiredArgsConstructor;
@@ -41,7 +41,7 @@ import java.util.Map;
@RequiredArgsConstructor
public final class BatchPreparedStatementExecutor {
    
    private final ExecutorEngine executorEngine;
    private final SQLExecutorEngine executorEngine;
    
    private final DatabaseType dbType;
    
@@ -60,7 +60,7 @@ public final class BatchPreparedStatementExecutor {
    public int[] executeBatch() throws SQLException {
        final boolean isExceptionThrown = ExecutorExceptionHandler.isExceptionThrown();
        final Map<String, Object> dataMap = ExecutorDataMap.getDataMap();
        ExecuteCallback<int[]> executeCallback = new ExecuteCallback<>(sqlType, isExceptionThrown, dataMap, new JDBCExecuteCallback<int[]>() {
        SQLExecuteCallback<int[]> executeCallback = new SQLExecuteCallback<>(sqlType, isExceptionThrown, dataMap, new JDBCExecutor<int[]>() {
        
            @Override
            public int[] execute(final BaseStatementUnit baseStatementUnit) throws SQLException {
+7 −7
Original line number Diff line number Diff line
@@ -19,9 +19,9 @@ package io.shardingsphere.core.executor.type.prepared;

import io.shardingsphere.core.constant.SQLType;
import io.shardingsphere.core.executor.BaseStatementUnit;
import io.shardingsphere.core.executor.ExecuteCallback;
import io.shardingsphere.core.executor.ExecutorEngine;
import io.shardingsphere.core.executor.JDBCExecuteCallback;
import io.shardingsphere.core.executor.SQLExecuteCallback;
import io.shardingsphere.core.executor.SQLExecutorEngine;
import io.shardingsphere.core.executor.JDBCExecutor;
import io.shardingsphere.core.executor.threadlocal.ExecutorDataMap;
import io.shardingsphere.core.executor.threadlocal.ExecutorExceptionHandler;
import lombok.RequiredArgsConstructor;
@@ -43,7 +43,7 @@ import java.util.Map;
@RequiredArgsConstructor
public final class PreparedStatementExecutor {
    
    private final ExecutorEngine executorEngine;
    private final SQLExecutorEngine executorEngine;
    
    private final SQLType sqlType;
    
@@ -58,7 +58,7 @@ public final class PreparedStatementExecutor {
    public List<ResultSet> executeQuery() throws SQLException {
        final boolean isExceptionThrown = ExecutorExceptionHandler.isExceptionThrown();
        final Map<String, Object> dataMap = ExecutorDataMap.getDataMap();
        ExecuteCallback<ResultSet> executeCallback = new ExecuteCallback<>(sqlType, isExceptionThrown, dataMap, new JDBCExecuteCallback<ResultSet>() {
        SQLExecuteCallback<ResultSet> executeCallback = new SQLExecuteCallback<>(sqlType, isExceptionThrown, dataMap, new JDBCExecutor<ResultSet>() {
        
            @Override
            public ResultSet execute(final BaseStatementUnit baseStatementUnit) throws SQLException {
@@ -77,7 +77,7 @@ public final class PreparedStatementExecutor {
    public int executeUpdate() throws SQLException {
        final boolean isExceptionThrown = ExecutorExceptionHandler.isExceptionThrown();
        final Map<String, Object> dataMap = ExecutorDataMap.getDataMap();
        ExecuteCallback<Integer> executeCallback = new ExecuteCallback<>(sqlType, isExceptionThrown, dataMap, new JDBCExecuteCallback<Integer>() {
        SQLExecuteCallback<Integer> executeCallback = new SQLExecuteCallback<>(sqlType, isExceptionThrown, dataMap, new JDBCExecutor<Integer>() {
        
            @Override
            public Integer execute(final BaseStatementUnit baseStatementUnit) throws SQLException {
@@ -105,7 +105,7 @@ public final class PreparedStatementExecutor {
    public boolean execute() throws SQLException {
        boolean isExceptionThrown = ExecutorExceptionHandler.isExceptionThrown();
        Map<String, Object> dataMap = ExecutorDataMap.getDataMap();
        ExecuteCallback<Boolean> executeCallback = new ExecuteCallback<>(sqlType, isExceptionThrown, dataMap, new JDBCExecuteCallback<Boolean>() {
        SQLExecuteCallback<Boolean> executeCallback = new SQLExecuteCallback<>(sqlType, isExceptionThrown, dataMap, new JDBCExecutor<Boolean>() {
            
            @Override
            public Boolean execute(final BaseStatementUnit baseStatementUnit) throws SQLException {
Loading