storm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bo...@apache.org
Subject [24/50] git commit: Fix netty client reconnect issue
Date Tue, 29 Jul 2014 20:58:23 GMT
Fix netty client reconnect issue


Project: http://git-wip-us.apache.org/repos/asf/incubator-storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-storm/commit/e1e6a602
Tree: http://git-wip-us.apache.org/repos/asf/incubator-storm/tree/e1e6a602
Diff: http://git-wip-us.apache.org/repos/asf/incubator-storm/diff/e1e6a602

Branch: refs/heads/security
Commit: e1e6a602e330d71410b1876ca9fb6bfc29761f35
Parents: 7ac24b8
Author: Kishor Patil <kpatil@yahoo-inc.com>
Authored: Thu Jul 24 19:34:38 2014 +0000
Committer: Kishor Patil <kpatil@yahoo-inc.com>
Committed: Thu Jul 24 19:34:38 2014 +0000

----------------------------------------------------------------------
 .../src/jvm/backtype/storm/messaging/netty/Client.java   | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-storm/blob/e1e6a602/storm-core/src/jvm/backtype/storm/messaging/netty/Client.java
----------------------------------------------------------------------
diff --git a/storm-core/src/jvm/backtype/storm/messaging/netty/Client.java b/storm-core/src/jvm/backtype/storm/messaging/netty/Client.java
index 8d2d221..80b4537 100644
--- a/storm-core/src/jvm/backtype/storm/messaging/netty/Client.java
+++ b/storm-core/src/jvm/backtype/storm/messaging/netty/Client.java
@@ -132,12 +132,12 @@ public class Client implements IConnection {
      */
     private synchronized void connect() {
         try {
-            if (channelRef.get() != null) {
+
+            Channel channel = channelRef.get();
+            if (channel != null && channel.isConnected()) {
                 return;
             }
             
-            Channel channel = null;
-
             int tried = 0;
             while (tried <= max_retries) {
 
@@ -205,6 +205,9 @@ public class Client implements IConnection {
         }
 
         while (msgs.hasNext()) {
+            if (!channel.isConnected()) {
+                connect();
+            }
             TaskMessage message = msgs.next();
             if (null == messageBatch) {
                 messageBatch = new MessageBatch(messageBatchSize);
@@ -347,4 +350,4 @@ public class Client implements IConnection {
             }
         });
     }
-}
\ No newline at end of file
+}


Mime
View raw message