You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by du...@apache.org on 2024/09/26 05:44:36 UTC
(shardingsphere) branch master updated: Fixed setSavepoint method invocation not cleaning up (#33005)
This is an automated email from the ASF dual-hosted git repository.
duanzhengqiang 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 41207f10e16 Fixed setSavepoint method invocation not cleaning up (#33005)
41207f10e16 is described below
commit 41207f10e16639b7c8d11d7aac8e7167ec47f6de
Author: ZhangCheng <ch...@apache.org>
AuthorDate: Thu Sep 26 13:44:30 2024 +0800
Fixed setSavepoint method invocation not cleaning up (#33005)
---
.../jdbc/adapter/invocation/MethodInvocationRecorder.java | 10 ++++++++++
.../jdbc/core/connection/DriverDatabaseConnectionManager.java | 3 +++
2 files changed, 13 insertions(+)
diff --git a/jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/adapter/invocation/MethodInvocationRecorder.java b/jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/adapter/invocation/MethodInvocationRecorder.java
index 4d272e8c864..a3fa1c123fe 100644
--- a/jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/adapter/invocation/MethodInvocationRecorder.java
+++ b/jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/adapter/invocation/MethodInvocationRecorder.java
@@ -39,9 +39,19 @@ public final class MethodInvocationRecorder<T> {
* @param callback callback
*/
public void record(final String methodName, final ForceExecuteCallback<T> callback) {
+ methodInvocations.remove(methodName);
methodInvocations.put(methodName, callback);
}
+ /**
+ * Remove method invocation.
+ *
+ * @param methodName method name
+ */
+ public void remove(final String methodName) {
+ methodInvocations.remove(methodName);
+ }
+
/**
* Replay methods invocation.
*
diff --git a/jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/core/connection/DriverDatabaseConnectionManager.java b/jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/core/connection/DriverDatabaseConnectionManager.java
index 8e78588537b..91b787e8bca 100644
--- a/jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/core/connection/DriverDatabaseConnectionManager.java
+++ b/jdbc/src/main/java/org/apache/shardingsphere/driver/jdbc/core/connection/DriverDatabaseConnectionManager.java
@@ -137,6 +137,7 @@ public final class DriverDatabaseConnectionManager implements DatabaseConnection
connectionTransaction.commit();
}
} finally {
+ methodInvocationRecorder.remove("setSavepoint");
for (Connection each : getCachedConnections()) {
ConnectionSavepointManager.getInstance().transactionFinished(each);
}
@@ -158,6 +159,7 @@ public final class DriverDatabaseConnectionManager implements DatabaseConnection
connectionTransaction.rollback();
}
} finally {
+ methodInvocationRecorder.remove("setSavepoint");
for (Connection each : getCachedConnections()) {
ConnectionSavepointManager.getInstance().transactionFinished(each);
}
@@ -215,6 +217,7 @@ public final class DriverDatabaseConnectionManager implements DatabaseConnection
* @throws SQLException SQL exception
*/
public void releaseSavepoint(final Savepoint savepoint) throws SQLException {
+ methodInvocationRecorder.remove("setSavepoint");
for (Connection each : getCachedConnections()) {
ConnectionSavepointManager.getInstance().releaseSavepoint(each, savepoint.getSavepointName());
}