zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From si...@apache.org
Subject svn commit: r1573930 - in /zookeeper/bookkeeper/branches/branch-4.2: CHANGES.txt bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/PerChannelBookieClient.java
Date Tue, 04 Mar 2014 08:20:31 GMT
Author: sijie
Date: Tue Mar  4 08:20:31 2014
New Revision: 1573930

URL: http://svn.apache.org/r1573930
Log:
BOOKKEEPER-688: NPE exception in PerChannelBookieClient (ivank via sijie)

Modified:
    zookeeper/bookkeeper/branches/branch-4.2/CHANGES.txt
    zookeeper/bookkeeper/branches/branch-4.2/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/PerChannelBookieClient.java

Modified: zookeeper/bookkeeper/branches/branch-4.2/CHANGES.txt
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/branches/branch-4.2/CHANGES.txt?rev=1573930&r1=1573929&r2=1573930&view=diff
==============================================================================
--- zookeeper/bookkeeper/branches/branch-4.2/CHANGES.txt (original)
+++ zookeeper/bookkeeper/branches/branch-4.2/CHANGES.txt Tue Mar  4 08:20:31 2014
@@ -10,6 +10,8 @@ Release 4.2.3 - 2013-12-04
 
         BOOKKEEPER-712: bookkeeper script should use 'java' from JAVA_HOME (vinay via sijie)
 
+        BOOKKEEPER-688: NPE exception in PerChannelBookieClient (ivank via sijie)
+
 Release 4.2.2 - 2013-10-02
 
   Backward compatible changes:

Modified: zookeeper/bookkeeper/branches/branch-4.2/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/PerChannelBookieClient.java
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/branches/branch-4.2/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/PerChannelBookieClient.java?rev=1573930&r1=1573929&r2=1573930&view=diff
==============================================================================
--- zookeeper/bookkeeper/branches/branch-4.2/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/PerChannelBookieClient.java
(original)
+++ zookeeper/bookkeeper/branches/branch-4.2/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/PerChannelBookieClient.java
Tue Mar  4 08:20:31 2014
@@ -255,14 +255,19 @@ public class PerChannelBookieClient exte
 
             ChannelBuffer wrappedBuffer = ChannelBuffers.wrappedBuffer(header, toSend);
 
-            ChannelFuture future = channel.write(wrappedBuffer);
+            final Channel c = channel;
+            if (c == null) {
+                errorOutReadKey(completionKey);
+                return;
+            }
+            ChannelFuture future = c.write(wrappedBuffer);
             future.addListener(new ChannelFutureListener() {
                 @Override
                 public void operationComplete(ChannelFuture future) throws Exception {
                     if (future.isSuccess()) {
                         if (LOG.isDebugEnabled()) {
                             LOG.debug("Successfully wrote request for adding entry: " + entryId
+ " ledger-id: " + ledgerId
-                                                            + " bookie: " + channel.getRemoteAddress()
+ " entry length: " + entrySize);
+                                                            + " bookie: " + c.getRemoteAddress()
+ " entry length: " + entrySize);
                         }
                         // totalBytesOutstanding.addAndGet(entrySize);
                     } else {
@@ -298,14 +303,19 @@ public class PerChannelBookieClient exte
         tmpEntry.writeLong(entryId);
         tmpEntry.writeBytes(masterKey, 0, BookieProtocol.MASTER_KEY_LENGTH);
 
-        ChannelFuture future = channel.write(tmpEntry);
+        final Channel c = channel;
+        if (c == null) {
+            errorOutReadKey(key);
+            return;
+        }
+        ChannelFuture future = c.write(tmpEntry);
         future.addListener(new ChannelFutureListener() {
             @Override
             public void operationComplete(ChannelFuture future) throws Exception {
                 if (future.isSuccess()) {
                     if (LOG.isDebugEnabled()) {
                         LOG.debug("Successfully wrote request for reading entry: " + entryId
+ " ledger-id: "
-                                  + ledgerId + " bookie: " + channel.getRemoteAddress());
+                                  + ledgerId + " bookie: " + c.getRemoteAddress());
                     }
                 } else {
                     errorOutReadKey(key);
@@ -332,14 +342,19 @@ public class PerChannelBookieClient exte
             tmpEntry.writeLong(ledgerId);
             tmpEntry.writeLong(entryId);
 
-            ChannelFuture future = channel.write(tmpEntry);
+            final Channel c = channel;
+            if (c == null) {
+                errorOutReadKey(key);
+                return;
+            }
+            ChannelFuture future = c.write(tmpEntry);
             future.addListener(new ChannelFutureListener() {
                 @Override
                 public void operationComplete(ChannelFuture future) throws Exception {
                     if (future.isSuccess()) {
                         if (LOG.isDebugEnabled()) {
                             LOG.debug("Successfully wrote request for reading entry: " +
entryId + " ledger-id: "
-                                                            + ledgerId + " bookie: " + channel.getRemoteAddress());
+                                                            + ledgerId + " bookie: " + c.getRemoteAddress());
                         }
                     } else {
                         errorOutReadKey(key);



Mime
View raw message