This is an automated email from the ASF dual-hosted git repository.

panjuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 5687ee8  Refactor JDBCExecutorCallback (#8293)
5687ee8 is described below

commit 5687ee847b30511b2b8269e29f6a96a051fa5827
Author: Liang Zhang <[email protected]>
AuthorDate: Sun Nov 22 20:20:34 2020 +0800

    Refactor JDBCExecutorCallback (#8293)
---
 .../sql/execute/engine/driver/jdbc/JDBCExecutorCallback.java | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git 
a/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/engine/driver/jdbc/JDBCExecutorCallback.java
 
b/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/engine/driver/jdbc/JDBCExecutorCallback.java
index da1f95f..505073f 100644
--- 
a/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/engine/driver/jdbc/JDBCExecutorCallback.java
+++ 
b/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/engine/driver/jdbc/JDBCExecutorCallback.java
@@ -21,7 +21,7 @@ import lombok.RequiredArgsConstructor;
 import org.apache.shardingsphere.infra.database.metadata.DataSourceMetaData;
 import org.apache.shardingsphere.infra.database.type.DatabaseType;
 import org.apache.shardingsphere.infra.executor.kernel.model.ExecutorCallback;
-import org.apache.shardingsphere.infra.executor.sql.context.ExecutionUnit;
+import org.apache.shardingsphere.infra.executor.sql.context.SQLUnit;
 import 
org.apache.shardingsphere.infra.executor.sql.execute.engine.ConnectionMode;
 import 
org.apache.shardingsphere.infra.executor.sql.execute.engine.ExecutorExceptionHandler;
 import org.apache.shardingsphere.infra.executor.sql.hook.SPISQLExecutionHook;
@@ -53,7 +53,7 @@ public abstract class JDBCExecutorCallback<T> implements 
ExecutorCallback<JDBCEx
     public final Collection<T> execute(final Collection<JDBCExecutionUnit> 
executionUnits, final boolean isTrunkThread, final Map<String, Object> dataMap) 
throws SQLException {
         Collection<T> result = new LinkedList<>();
         for (JDBCExecutionUnit each : executionUnits) {
-            result.add(execute0(each, isTrunkThread, dataMap));
+            result.add(execute(each, isTrunkThread, dataMap));
         }
         return result;
     }
@@ -64,14 +64,14 @@ public abstract class JDBCExecutorCallback<T> implements 
ExecutorCallback<JDBCEx
      *
      * @see <a 
href="https://github.com/apache/skywalking/blob/master/docs/en/guides/Java-Plugin-Development-Guide.md#user-content-plugin-development-guide";>Plugin
 Development Guide</a>
      */
-    private T execute0(final JDBCExecutionUnit jdbcExecutionUnit, final 
boolean isTrunkThread, final Map<String, Object> dataMap) throws SQLException {
+    private T execute(final JDBCExecutionUnit jdbcExecutionUnit, final boolean 
isTrunkThread, final Map<String, Object> dataMap) throws SQLException {
         ExecutorExceptionHandler.setExceptionThrown(isExceptionThrown);
         DataSourceMetaData dataSourceMetaData = 
getDataSourceMetaData(jdbcExecutionUnit.getStorageResource().getConnection().getMetaData());
         SQLExecutionHook sqlExecutionHook = new SPISQLExecutionHook();
         try {
-            ExecutionUnit executionUnit = jdbcExecutionUnit.getExecutionUnit();
-            sqlExecutionHook.start(executionUnit.getDataSourceName(), 
executionUnit.getSqlUnit().getSql(), 
executionUnit.getSqlUnit().getParameters(), dataSourceMetaData, isTrunkThread, 
dataMap);
-            T result = executeSQL(executionUnit.getSqlUnit().getSql(), 
jdbcExecutionUnit.getStorageResource(), jdbcExecutionUnit.getConnectionMode());
+            SQLUnit sqlUnit = 
jdbcExecutionUnit.getExecutionUnit().getSqlUnit();
+            
sqlExecutionHook.start(jdbcExecutionUnit.getExecutionUnit().getDataSourceName(),
 sqlUnit.getSql(), sqlUnit.getParameters(), dataSourceMetaData, isTrunkThread, 
dataMap);
+            T result = executeSQL(sqlUnit.getSql(), 
jdbcExecutionUnit.getStorageResource(), jdbcExecutionUnit.getConnectionMode());
             sqlExecutionHook.finishSuccess();
             return result;
         } catch (final SQLException ex) {

Reply via email to