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 <[email protected]> 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();
