Author: mahadev
Date: Thu Jan 29 23:21:37 2009
New Revision: 739079

URL: http://svn.apache.org/viewvc?rev=739079&view=rev
Log:
ZOOKEEPER-272. getchildren can fail for large number of children. (mahadev)

Modified:
    hadoop/zookeeper/trunk/CHANGES.txt
    hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/ClientCnxn.java

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=739079&r1=739078&r2=739079&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Thu Jan 29 23:21:37 2009
@@ -76,6 +76,8 @@
   ZOOKEEPER-263. document connection host:port as comma separated list in 
forrest docs (pat via breed)
   
   ZOOKEEPER-275. Bug in FastLeaderElection. (flavio via mahadev)
+
+  ZOOKEEPER-272. getchildren can fail for large number of children. (mahadev)
  
 IMPROVEMENTS:
    

Modified: 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/ClientCnxn.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/ClientCnxn.java?rev=739079&r1=739078&r2=739079&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/ClientCnxn.java 
(original)
+++ hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/ClientCnxn.java 
Thu Jan 29 23:21:37 2009
@@ -81,12 +81,15 @@
      * option allows the client to turn off this behavior by setting
      * the environment variable "zookeeper.disableAutoWatchReset" to "true" */
     public static boolean disableAutoWatchReset;
+   
+    public static int packetLen;
     static {
         // this var should not be public, but otw there is no easy way 
         // to test
         disableAutoWatchReset = 
             Boolean.getBoolean("zookeeper.disableAutoWatchReset");
         LOG.info("zookeeper.disableAutoWatchReset is " + 
disableAutoWatchReset);
+        packetLen = Integer.getInteger("jute.maxbuffer", 4096 * 1024);
     }
 
     private ArrayList<InetSocketAddress> serverAddrs = new 
ArrayList<InetSocketAddress>();
@@ -502,7 +505,7 @@
 
         void readLength() throws IOException {
             int len = incomingBuffer.getInt();
-            if (len < 0 || len >= 4096 * 1024) {
+            if (len < 0 || len >= packetLen) {
                 throw new IOException("Packet len" + len + " is out of 
range!");
             }
             incomingBuffer = ByteBuffer.allocate(len);


Reply via email to