zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From iv...@apache.org
Subject svn commit: r1241404 - in /zookeeper/bookkeeper/trunk: CHANGES.txt bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/PerChannelBookieClient.java
Date Tue, 07 Feb 2012 10:03:17 GMT
Author: ivank
Date: Tue Feb  7 10:03:17 2012
New Revision: 1241404

URL: http://svn.apache.org/viewvc?rev=1241404&view=rev
Log:
BOOKKEEPER-161: PerChannelBookieClient tries to reuse HashedWheelTimer, throws Exception (ivank)

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

Modified: zookeeper/bookkeeper/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/CHANGES.txt?rev=1241404&r1=1241403&r2=1241404&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/CHANGES.txt (original)
+++ zookeeper/bookkeeper/trunk/CHANGES.txt Tue Feb  7 10:03:17 2012
@@ -26,6 +26,8 @@ Trunk (unreleased changes)
 
         BOOKKEEPER-23: Timeout requests (ivank)
 
+        BOOKKEEPER-161: PerChannelBookieClient tries to reuse HashedWheelTimer, throws Exception
(ivank)
+
       hedwig-server/
       
         BOOKKEEPER-140: Hub server doesn't subscribe remote region correctly when a region
is down. (Sijie Gou via ivank)

Modified: zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/PerChannelBookieClient.java
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/PerChannelBookieClient.java?rev=1241404&r1=1241403&r2=1241404&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/PerChannelBookieClient.java
(original)
+++ zookeeper/bookkeeper/trunk/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/PerChannelBookieClient.java
Tue Feb  7 10:03:17 2012
@@ -112,7 +112,7 @@ public class PerChannelBookieClient exte
         this.totalBytesOutstanding = totalBytesOutstanding;
         this.channelFactory = channelFactory;
         this.state = ConnectionState.DISCONNECTED;
-        this.readTimeoutTimer = new HashedWheelTimer();
+        this.readTimeoutTimer = null;
     }
 
     synchronized private void connect() {
@@ -302,6 +302,10 @@ public class PerChannelBookieClient exte
         if (channel != null) {
             channel.close().awaitUninterruptibly();
         }
+        if (readTimeoutTimer != null) {
+            readTimeoutTimer.stop();
+            readTimeoutTimer = null;
+        }
     }
 
     void errorOutReadKey(final CompletionKey key) {
@@ -382,6 +386,10 @@ public class PerChannelBookieClient exte
     public ChannelPipeline getPipeline() throws Exception {
         ChannelPipeline pipeline = Channels.pipeline();
 
+        if (readTimeoutTimer == null) {
+            readTimeoutTimer = new HashedWheelTimer();
+        }
+
         pipeline.addLast("readTimeout", new ReadTimeoutHandler(readTimeoutTimer, 
                                                                conf.getReadTimeout()));
         pipeline.addLast("lengthbasedframedecoder", new LengthFieldBasedFrameDecoder(MAX_FRAME_LENGTH,
0, 4, 0, 4));
@@ -397,7 +405,6 @@ public class PerChannelBookieClient exte
         LOG.info("Disconnected from bookie: " + addr);
         errorOutOutstandingEntries();
         channel.close();
-        readTimeoutTimer.stop();
 
         state = ConnectionState.DISCONNECTED;
 



Mime
View raw message