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 2021/08/12 07:50:28 UTC

[plc4x] 02/02: - Streamlined the default implementation of PlcConnection.ping()

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 3b51e81d65f16c6d60d690a86df93d855a5e34d0
Author: cdutz <ch...@c-ware.de>
AuthorDate: Thu Aug 12 09:50:16 2021 +0200

    - Streamlined the default implementation of PlcConnection.ping()
---
 .../apache/plc4x/java/utils/connectionpool2/CachedPlcConnection.java | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/plc4j/tools/connection-cache/src/main/java/org/apache/plc4x/java/utils/connectionpool2/CachedPlcConnection.java b/plc4j/tools/connection-cache/src/main/java/org/apache/plc4x/java/utils/connectionpool2/CachedPlcConnection.java
index 591db96..401c6c6 100644
--- a/plc4j/tools/connection-cache/src/main/java/org/apache/plc4x/java/utils/connectionpool2/CachedPlcConnection.java
+++ b/plc4j/tools/connection-cache/src/main/java/org/apache/plc4x/java/utils/connectionpool2/CachedPlcConnection.java
@@ -21,6 +21,7 @@ package org.apache.plc4x.java.utils.connectionpool2;
 import org.apache.plc4x.java.api.PlcConnection;
 import org.apache.plc4x.java.api.exceptions.PlcConnectionException;
 import org.apache.plc4x.java.api.exceptions.PlcRuntimeException;
+import org.apache.plc4x.java.api.exceptions.PlcUnsupportedOperationException;
 import org.apache.plc4x.java.api.messages.PlcReadRequest;
 import org.apache.plc4x.java.api.messages.PlcReadResponse;
 import org.apache.plc4x.java.api.messages.PlcSubscriptionRequest;
@@ -171,7 +172,9 @@ public class CachedPlcConnection implements PlcConnection, PlcConnectionMetadata
 
     @Override
     public CompletableFuture<Void> ping() {
-        throw new UnsupportedOperationException();
+        CompletableFuture<Void> future = new CompletableFuture<>();
+        future.completeExceptionally(new PlcUnsupportedOperationException("The connection does not support pinging"));
+        return future;
     }
 
     @Override