You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2026/09/23 14:43:49 UTC

(shardingsphere) branch master updated: Refactor FirebirdBatchedStatementsExecutor (#39931)

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

terrymanu 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 680d94f8d44 Refactor FirebirdBatchedStatementsExecutor (#39931)
680d94f8d44 is described below

commit 680d94f8d44a9c80fbc72e85eec268148ee6c9ea
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Wed Sep 23 22:43:41 2026 +0800

    Refactor FirebirdBatchedStatementsExecutor (#39931)
---
 .../query/batch/FirebirdBatchedStatementsExecutor.java | 18 +++++-------------
 1 file changed, 5 insertions(+), 13 deletions(-)

diff --git a/proxy/frontend/dialect/firebird/src/main/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/batch/FirebirdBatchedStatementsExecutor.java b/proxy/frontend/dialect/firebird/src/main/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/batch/FirebirdBatchedStatementsExecutor.java
index 6294d12aab8..741625a45b4 100644
--- a/proxy/frontend/dialect/firebird/src/main/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/batch/FirebirdBatchedStatementsExecutor.java
+++ b/proxy/frontend/dialect/firebird/src/main/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/batch/FirebirdBatchedStatementsExecutor.java
@@ -149,17 +149,9 @@ public final class FirebirdBatchedStatementsExecutor {
     
     private void addExecutionUnitParams(final ExecutionContext executionContext, final int batchMessageIndex) {
         for (ExecutionUnit each : executionContext.getExecutionUnits()) {
-            List<List<Object>> params = executionUnitParams.get(each);
-            if (null == params) {
-                params = new LinkedList<>();
-                executionUnitParams.put(each, params);
-            }
+            List<List<Object>> params = executionUnitParams.computeIfAbsent(each, k -> new LinkedList<>());
             params.add(each.getSqlUnit().getParameters());
-            List<Integer> batchMessageIndexes = executionUnitBatchMessageIndexes.get(each);
-            if (null == batchMessageIndexes) {
-                batchMessageIndexes = new LinkedList<>();
-                executionUnitBatchMessageIndexes.put(each, batchMessageIndexes);
-            }
+            List<Integer> batchMessageIndexes = executionUnitBatchMessageIndexes.computeIfAbsent(each, k -> new LinkedList<>());
             batchMessageIndexes.add(batchMessageIndex);
         }
     }
@@ -223,12 +215,12 @@ public final class FirebirdBatchedStatementsExecutor {
     }
     
     private List<List<Object>> getBatchParams(final BatchExecution batchExecution) {
-        return executionUnitParams.getOrDefault(batchExecution.executionUnit.getExecutionUnit(), Collections.<List<Object>>emptyList())
+        return executionUnitParams.getOrDefault(batchExecution.executionUnit.getExecutionUnit(), Collections.emptyList())
                 .subList(batchExecution.fromOffset, batchExecution.toOffset);
     }
     
     private List<Integer> getBatchMessageIndexes(final BatchExecution batchExecution) {
-        return executionUnitBatchMessageIndexes.getOrDefault(batchExecution.executionUnit.getExecutionUnit(), Collections.<Integer>emptyList())
+        return executionUnitBatchMessageIndexes.getOrDefault(batchExecution.executionUnit.getExecutionUnit(), Collections.emptyList())
                 .subList(batchExecution.fromOffset, batchExecution.toOffset);
     }
     
@@ -364,7 +356,7 @@ public final class FirebirdBatchedStatementsExecutor {
     private List<BatchExecution> createBatchExecutionsInMessageOrder(final Collection<JDBCExecutionUnit> executionUnits) {
         Map<Integer, Collection<JDBCExecutionUnit>> unitsByBatchMessageIndex = new TreeMap<>();
         for (JDBCExecutionUnit each : executionUnits) {
-            for (int eachMessageIndex : executionUnitBatchMessageIndexes.getOrDefault(each.getExecutionUnit(), Collections.<Integer>emptyList())) {
+            for (int eachMessageIndex : executionUnitBatchMessageIndexes.getOrDefault(each.getExecutionUnit(), Collections.emptyList())) {
                 unitsByBatchMessageIndex.computeIfAbsent(eachMessageIndex, key -> new LinkedList<>()).add(each);
             }
         }