This is an automated email from the ASF dual-hosted git repository. sruehl pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git
commit 067cf7a775c72449637dc99ba9567b3869a18c11 Author: Sebastian Rühl <sru...@apache.org> AuthorDate: Wed Jun 13 14:39:12 2018 +0200 try to fix wobbily test by avoid using the thread if no message is on the way --- .../plc4x/java/ads/protocol/util/SingleMessageRateLimiter.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/protocol/util/SingleMessageRateLimiter.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/protocol/util/SingleMessageRateLimiter.java index ad4a6ce..7b159a5 100644 --- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/protocol/util/SingleMessageRateLimiter.java +++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/protocol/util/SingleMessageRateLimiter.java @@ -66,21 +66,25 @@ public class SingleMessageRateLimiter extends ChannelDuplexHandler { pop.channelHandlerContext.writeAndFlush(pop.toSend, pop.promise); LOGGER.debug("Send {}", pop); } - }, 0, 10, TimeUnit.MILLISECONDS); + }, 100, 10, TimeUnit.MILLISECONDS); super.connect(ctx, remoteAddress, localAddress, promise); } @Override public void disconnect(ChannelHandlerContext ctx, ChannelPromise promise) throws Exception { LOGGER.debug("disconnect({}, {}, {}, {})", ctx, promise); - sender.cancel(true); + sender.cancel(false); super.disconnect(ctx, promise); } @Override public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) { LOGGER.trace("(<--OUT): {}, {}, {}", ctx, msg, promise); - messagesQueue.add(new ToSend(ctx, msg, promise)); + if (messageOnTheWay.compareAndSet(false, true)) { + ctx.write(msg, promise); + } else { + messagesQueue.add(new ToSend(ctx, msg, promise)); + } } @Override -- To stop receiving notification emails like this one, please contact sru...@apache.org.