storm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bo...@apache.org
Subject [01/50] [abbrv] git commit: STORM-297: avoid duplicate Channel Null Check
Date Wed, 11 Jun 2014 16:09:33 GMT
Repository: incubator-storm
Updated Branches:
  refs/heads/security 6592b8209 -> 0a98bee21


STORM-297: avoid duplicate Channel Null Check


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

Branch: refs/heads/security
Commit: baa310618ed639c312f2281bc8364d55e5977174
Parents: 44e47e8
Author: Sean Zhong <clockfly@gmail.com>
Authored: Tue May 20 12:26:49 2014 +0800
Committer: Sean Zhong <clockfly@gmail.com>
Committed: Tue May 20 12:26:49 2014 +0800

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


http://git-wip-us.apache.org/repos/asf/incubator-storm/blob/baa31061/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 d3980d4..59a8a5c 100644
--- a/storm-core/src/jvm/backtype/storm/messaging/netty/Client.java
+++ b/storm-core/src/jvm/backtype/storm/messaging/netty/Client.java
@@ -104,7 +104,7 @@ public class Client implements IConnection {
                     if (now > flushCheckTime) {
                         Channel channel = channelRef.get();
                         if (null != channel && channel.isWritable()) {
-                            flush();
+                            flush(channel);
                         }
                     }
                     try {
@@ -237,15 +237,12 @@ public class Client implements IConnection {
         return "";
     }
 
-    private synchronized void flush() {
+    private synchronized void flush(Channel channel) {
         if (!closing) {
             if (null != messageBatch && !messageBatch.isEmpty()) {
                 MessageBatch toBeFlushed = messageBatch;
-                Channel channel = channelRef.get();
-                if (channel != null) {
-                    flushCheckTimer.set(Long.MAX_VALUE);
-                    flushRequest(channel, toBeFlushed);
-                }
+                flushCheckTimer.set(Long.MAX_VALUE);
+                flushRequest(channel, toBeFlushed);
                 messageBatch = null;
             }
         }


Mime
View raw message