You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by sr...@apache.org on 2018/09/26 16:08:00 UTC

[incubator-plc4x] branch feature/TopLevelItemSpliting updated: [General] SingleItemToSingleRequestProtocol implemented ErrorHandler

This is an automated email from the ASF dual-hosted git repository.

sruehl pushed a commit to branch feature/TopLevelItemSpliting
in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git


The following commit(s) were added to refs/heads/feature/TopLevelItemSpliting by this push:
     new 9bcf6c1  [General] SingleItemToSingleRequestProtocol implemented ErrorHandler
9bcf6c1 is described below

commit 9bcf6c18b8cb332915dc3ec8b6e5ee45d018bcd1
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Wed Sep 26 18:07:56 2018 +0200

    [General] SingleItemToSingleRequestProtocol implemented ErrorHandler
---
 .../plc4x/java/base/protocol/SingleItemToSingleRequestProtocol.java | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/protocol/SingleItemToSingleRequestProtocol.java b/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/protocol/SingleItemToSingleRequestProtocol.java
index 267f9a8..0fdebf5 100644
--- a/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/protocol/SingleItemToSingleRequestProtocol.java
+++ b/plc4j/protocols/driver-bases/base/src/main/java/org/apache/plc4x/java/base/protocol/SingleItemToSingleRequestProtocol.java
@@ -118,7 +118,11 @@ public class SingleItemToSingleRequestProtocol extends ChannelDuplexHandler {
     }
 
     private void errored(int correlationId, Throwable throwable) {
-
+        PlcRequestContainer<InternalPlcRequest, InternalPlcResponse<?>> plcRequestContainer = sentButUnacknowledgedRequestItems.remove(correlationId);
+        if (plcRequestContainer == null) {
+            throw new PlcRuntimeException("Unrelated error received ", throwable);
+        }
+        plcRequestContainer.getResponseFuture().completeExceptionally(throwable);
     }
 
     ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////