You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by jf...@apache.org on 2020/03/03 16:17:29 UTC
[plc4x] branch rel/0.6 updated: Added explizit channel close to ADS.
This is an automated email from the ASF dual-hosted git repository.
jfeinauer pushed a commit to branch rel/0.6
in repository https://gitbox.apache.org/repos/asf/plc4x.git
The following commit(s) were added to refs/heads/rel/0.6 by this push:
new 9b1a8f3 Added explizit channel close to ADS.
9b1a8f3 is described below
commit 9b1a8f33ef2522a340594cd1600c546f0a07c0e6
Author: Julian Feinauer <j....@pragmaticminds.de>
AuthorDate: Tue Mar 3 17:17:16 2020 +0100
Added explizit channel close to ADS.
---
.../plc4x/java/ads/connection/AdsAbstractPlcConnection.java | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/plc4j/drivers/ads/src/main/java/org/apache/plc4x/java/ads/connection/AdsAbstractPlcConnection.java b/plc4j/drivers/ads/src/main/java/org/apache/plc4x/java/ads/connection/AdsAbstractPlcConnection.java
index bce172e..122b3b5 100644
--- a/plc4j/drivers/ads/src/main/java/org/apache/plc4x/java/ads/connection/AdsAbstractPlcConnection.java
+++ b/plc4j/drivers/ads/src/main/java/org/apache/plc4x/java/ads/connection/AdsAbstractPlcConnection.java
@@ -214,7 +214,16 @@ public abstract class AdsAbstractPlcConnection extends NettyPlcConnection implem
.map(adsWriteRequest -> new PlcRequestContainer<>(new DefaultPlcProprietaryRequest<>(adsWriteRequest), new CompletableFuture<>()))
// We don't need a response so we just supply a throw away future.
.forEach(channel::write);
+ // Flush Channel
channel.flush();
+ // Close Channel
+ channel.close().syncUninterruptibly();
+ // Do some additional cleanup operations ...
+ // In normal operation, the channels event loop has a parent, however when running with
+ // the embedded channel for unit tests, parent is null.
+ if (channel.eventLoop().parent() != null) {
+ channel.eventLoop().parent().shutdownGracefully();
+ }
super.close();
}