Github user d2r commented on a diff in the pull request:
https://github.com/apache/storm/pull/1194#discussion_r55432071
--- 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() {
+ // netty TimerTask is already defined and hence a fully
+ // qualified name
+ timer.schedule(new java.util.TimerTask() {
+ public void run() {
+ try {
+ LOG.debug("running timer task, address {}",
dstAddress);
+ if(closing) {
+ this.cancel();
--- End diff --
Just to be cleaner and avoid a possible race, let's return here so we don't
call `getConnectedChannel`.
---
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.
---