storm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bo...@apache.org
Subject [3/5] storm git commit: Bring back removal of client from context upon closing
Date Tue, 14 Jul 2015 19:05:31 GMT
Bring back removal of client from context upon closing


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

Branch: refs/heads/master
Commit: 7af467723b5c4b0beedc40626a8c56bc7c3e0d21
Parents: 935e87a
Author: Enno Shioji <eshioji@gmail.com>
Authored: Fri Jul 3 01:02:00 2015 +0100
Committer: Enno Shioji <eshioji@gmail.com>
Committed: Fri Jul 3 01:09:26 2015 +0100

----------------------------------------------------------------------
 storm-core/src/jvm/backtype/storm/messaging/netty/Client.java  | 6 +++++-
 storm-core/src/jvm/backtype/storm/messaging/netty/Context.java | 2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/storm/blob/7af46772/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 9be2b06..5b130fa 100644
--- a/storm-core/src/jvm/backtype/storm/messaging/netty/Client.java
+++ b/storm-core/src/jvm/backtype/storm/messaging/netty/Client.java
@@ -116,15 +116,18 @@ public class Client extends ConnectionWithStatus implements IStatefulObject
{
      */
     private volatile boolean closing = false;
 
+    private final Context context;
+
     private final HashedWheelTimer scheduler;
 
     private final MessageBuffer batcher;
 
     @SuppressWarnings("rawtypes")
-    Client(Map stormConf, ChannelFactory factory, HashedWheelTimer scheduler, String host,
int port) {
+    Client(Map stormConf, ChannelFactory factory, HashedWheelTimer scheduler, String host,
int port, Context context) {
         this.stormConf = stormConf;
         closing = false;
         this.scheduler = scheduler;
+        this.context = context;
         int bufferSize = Utils.getInt(stormConf.get(Config.STORM_MESSAGING_NETTY_BUFFER_SIZE));
         LOG.info("creating Netty Client, connecting to {}:{}, bufferSize: {}", host, port,
bufferSize);
         int messageBatchSize = Utils.getInt(stormConf.get(Config.STORM_NETTY_MESSAGE_BATCH_SIZE),
262144);
@@ -359,6 +362,7 @@ public class Client extends ConnectionWithStatus implements IStatefulObject
{
     public void close() {
         if (!closing) {
             LOG.info("closing Netty Client {}", dstAddressPrefixedName);
+            context.removeClient(dstAddress.getHostName(),dstAddress.getPort());
             // Set closing to true to prevent any further reconnection attempts.
             closing = true;
             waitForPendingMessagesToBeSent();

http://git-wip-us.apache.org/repos/asf/storm/blob/7af46772/storm-core/src/jvm/backtype/storm/messaging/netty/Context.java
----------------------------------------------------------------------
diff --git a/storm-core/src/jvm/backtype/storm/messaging/netty/Context.java b/storm-core/src/jvm/backtype/storm/messaging/netty/Context.java
index 884f115..5d27a16 100644
--- a/storm-core/src/jvm/backtype/storm/messaging/netty/Context.java
+++ b/storm-core/src/jvm/backtype/storm/messaging/netty/Context.java
@@ -85,7 +85,7 @@ public class Context implements IContext {
             return connection;
         }
         IConnection client =  new Client(storm_conf, clientChannelFactory, 
-                clientScheduleService, host, port);
+                clientScheduleService, host, port, this);
         connections.put(key(host, port), client);
         return client;
     }


Mime
View raw message