Author: phunt
Date: Thu Mar  5 21:33:10 2009
New Revision: 750599

URL: http://svn.apache.org/viewvc?rev=750599&view=rev
Log:
ZOOKEEPER-279. Allow specialization of quorum config parsing (e.g. variable 
expansion in zoo.cfg)

Modified:
    hadoop/zookeeper/trunk/CHANGES.txt
    
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeerConfig.java

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=750599&r1=750598&r2=750599&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Thu Mar  5 21:33:10 2009
@@ -9,24 +9,27 @@
 BUGFIXES: 
   ZOOKEEPER-303. Bin scripts dont work on a Mac. (tom white via mahadev)
   
-  ZOOKEEPER-330. zookeeper standalone server does not startup with just a port
-and datadir. (chris darroch and mahadev)
+  ZOOKEEPER-330. zookeeper standalone server does not startup with just a
+  port and datadir. (chris darroch and mahadev)
 
-  ZOOKEEPER-319. add locking around auth info in zhandle_t. (chris darroch via
-mahadev)
+  ZOOKEEPER-319. add locking around auth info in zhandle_t.
+  (chris darroch via mahadev)
 
-  ZOOKEEPER-320. call auth completion in free_completions(). (chris darroch
-via mahadev)
+  ZOOKEEPER-320. call auth completion in free_completions().
+  (chris darroch via mahadev)
 
-  ZOOKEEPER-334. bookkeeper benchmark (testclient.java) has compiling errros.
-(flavio and mahadev) 
+  ZOOKEEPER-334. bookkeeper benchmark (testclient.java) has compiling errors.
+  (flavio and mahadev) 
  
 IMPROVEMENTS:
-  ZOOKEEPER-308. improve the atomic broadcast performance 3x. (breed via
-mahadev)
+  ZOOKEEPER-308. improve the atomic broadcast performance 3x.
+  (breed via mahadev)
 
- ZOOKEEPER-326. standalone server ignores tickTime configuration. (chris
-darroch via mahadev)
+  ZOOKEEPER-326. standalone server ignores tickTime configuration.
+  (chris darroch via mahadev)
+
+  ZOOKEEPER-279. Allow specialization of quorum config parsing
+  (e.g. variable expansion in zoo.cfg) (Jean-Daniel Cryans via phunt)
 
 NEW FEATURES:
 

Modified: 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeerConfig.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeerConfig.java?rev=750599&r1=750598&r2=750599&view=diff
==============================================================================
--- 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeerConfig.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeerConfig.java
 Thu Mar  5 21:33:10 2009
@@ -23,14 +23,12 @@
 import java.io.FileInputStream;
 import java.io.FileReader;
 import java.net.InetSocketAddress;
+import java.util.HashMap;
 import java.util.Properties;
 import java.util.Map.Entry;
-import java.util.HashMap;
 
 import org.apache.log4j.Logger;
-
 import org.apache.zookeeper.server.ServerConfig;
-import org.apache.zookeeper.server.ZooKeeperServer;
 import org.apache.zookeeper.server.quorum.QuorumPeer.QuorumServer;
 
 public class QuorumPeerConfig extends ServerConfig {
@@ -44,7 +42,9 @@
     private HashMap<Long,QuorumServer> servers = null;
     private long serverId;
 
-    private QuorumPeerConfig(int port, String dataDir, String dataLogDir, int 
tickTime) {
+    protected QuorumPeerConfig(int port, String dataDir, String dataLogDir,
+            int tickTime)
+    {
         super(port, dataDir, dataLogDir, tickTime);
     }
 
@@ -66,6 +66,11 @@
         } finally {
             zooCfgStream.close();
         }
+
+        parseProperties(cfg);
+    }
+
+    protected static void parseProperties(Properties zkProp) throws Exception {
         HashMap<Long, QuorumServer> servers = new HashMap<Long, 
QuorumServer>();
         String dataDir = null;
         String dataLogDir = null;
@@ -75,7 +80,7 @@
         int syncLimit = 0;
         int electionAlg = 3;
         int electionPort = 2182;
-        for (Entry<Object, Object> entry : cfg.entrySet()) {
+        for (Entry<Object, Object> entry : zkProp.entrySet()) {
             String key = entry.getKey().toString();
             String value = entry.getValue().toString();
             if (key.equals("dataDir")) {


Reply via email to