Github user d2r commented on a diff in the pull request:
https://github.com/apache/storm/pull/1194#discussion_r55431809
--- Diff: storm-core/src/jvm/org/apache/storm/messaging/netty/Client.java
---
@@ -151,10 +164,35 @@
bootstrap = createClientBootstrap(factory, bufferSize, stormConf);
dstAddress = new InetSocketAddress(host, port);
dstAddressPrefixedName = prefixedName(dstAddress);
+ launchChannelAliveThread();
scheduleConnect(NO_DELAY_MS);
batcher = new MessageBuffer(messageBatchSize);
}
+ /**
+ * This thread helps us to check for channel connection periodically.
+ * This is performed just to know whether the destination address
+ * is alive or attempts to refresh connections if not alive. This
+ * solution is better than what we have now in case of a bad channel.
+ */
+ private void launchChannelAliveThread() {
--- End diff --
Let's move the code in the static block above down here at the beginning of
`launchChannelAliveThread`, so that as @revans2 suggests, the stack trace will
not be so confusing.
```Java
if (timer == null) {
synchronized (Client.class) {
if (timer == null) {
timer = new Timer("Netty-ChannelAlive-Timer", true);
}
}
}
```
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---