You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@storm.apache.org by bo...@apache.org on 2014/06/09 15:48:21 UTC

[16/32] git commit: STORM-297: avoid duplicate Channel Null Check

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/master
Commit: baa310618ed639c312f2281bc8364d55e5977174
Parents: 44e47e8
Author: Sean Zhong <cl...@gmail.com>
Authored: Tue May 20 12:26:49 2014 +0800
Committer: Sean Zhong <cl...@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;
             }
         }