You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by cd...@apache.org on 2025/08/21 06:24:10 UTC
(plc4x) branch develop updated: fix: Ensured cached connections are correctly closed, when calling removeCachedConnection on the CachedPlcConnectionManager.
This is an automated email from the ASF dual-hosted git repository.
cdutz pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git
The following commit(s) were added to refs/heads/develop by this push:
new edbb080ce8 fix: Ensured cached connections are correctly closed, when calling removeCachedConnection on the CachedPlcConnectionManager.
edbb080ce8 is described below
commit edbb080ce80124f233be1bdc36b04737f655c445
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Thu Aug 21 08:24:01 2025 +0200
fix: Ensured cached connections are correctly closed, when calling removeCachedConnection on the CachedPlcConnectionManager.
---
.../org/apache/plc4x/java/utils/cache/CachedPlcConnectionManager.java | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/plc4j/tools/connection-cache/src/main/java/org/apache/plc4x/java/utils/cache/CachedPlcConnectionManager.java b/plc4j/tools/connection-cache/src/main/java/org/apache/plc4x/java/utils/cache/CachedPlcConnectionManager.java
index 0c1ea133c8..67ea13b3db 100644
--- a/plc4j/tools/connection-cache/src/main/java/org/apache/plc4x/java/utils/cache/CachedPlcConnectionManager.java
+++ b/plc4j/tools/connection-cache/src/main/java/org/apache/plc4x/java/utils/cache/CachedPlcConnectionManager.java
@@ -79,6 +79,10 @@ public class CachedPlcConnectionManager implements PlcConnectionManager, AutoClo
*/
public void removeCachedConnection(String url) {
synchronized (connectionContainers) {
+ // Make sure the connection is closed before removing it.
+ if(connectionContainers.containsKey(url)) {
+ connectionContainers.get(url).close();
+ }
connectionContainers.remove(url);
}
}