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 2023/10/21 15:37:33 UTC
[plc4x] 01/02: fix: Make sure a leased-connection isn't double-closed
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
commit 87a163cbba74129d6b28960ee1d6a5ef80edba09
Author: Christofer Dutz <cd...@apache.org>
AuthorDate: Sat Oct 21 17:24:06 2023 +0200
fix: Make sure a leased-connection isn't double-closed
fixes: 1168
---
.../java/org/apache/plc4x/java/utils/cache/LeasedPlcConnection.java | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/plc4j/tools/connection-cache/src/main/java/org/apache/plc4x/java/utils/cache/LeasedPlcConnection.java b/plc4j/tools/connection-cache/src/main/java/org/apache/plc4x/java/utils/cache/LeasedPlcConnection.java
index 48854782aa..ca391510ef 100644
--- a/plc4j/tools/connection-cache/src/main/java/org/apache/plc4x/java/utils/cache/LeasedPlcConnection.java
+++ b/plc4j/tools/connection-cache/src/main/java/org/apache/plc4x/java/utils/cache/LeasedPlcConnection.java
@@ -58,6 +58,11 @@ public class LeasedPlcConnection implements PlcConnection {
@Override
public synchronized void close() {
+ // In this case the connection was already closed (possibly by the timer)
+ if(connection == null) {
+ return;
+ }
+
// Cancel automatically timing out.
usageTimer.cancel();