Author: breed
Date: Wed May 20 18:48:00 2009
New Revision: 776806

URL: http://svn.apache.org/viewvc?rev=776806&view=rev
Log:
ZOOKEEPER-410. address all findbugs warnings in client/server classes.

Modified:
    hadoop/zookeeper/trunk/CHANGES.txt
    hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/ClientCnxn.java
    hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeper.java
    hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeperMain.java
    
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/FinalRequestProcessor.java
    
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java
    
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/PrepRequestProcessor.java
    
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/SessionTrackerImpl.java
    
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/SyncRequestProcessor.java
    
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ZooKeeperServer.java
    
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ZooKeeperServerMain.java
    
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/FollowerZooKeeperServer.java
    
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/LeaderZooKeeperServer.java
    
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/ProposalRequestProcessor.java
    
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeer.java
    hadoop/zookeeper/trunk/src/java/test/config/findbugsExcludeFile.xml

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=776806&r1=776805&r2=776806&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Wed May 20 18:48:00 2009
@@ -76,6 +76,8 @@
 
   ZOOKEEPER-405. nullpointer exception in zookeeper java shell. (mahadev via 
breed)
 
+  ZOOKEEPER-410. address all findbugs warnings in client/server classes. 
(phunt via breed)
+
 IMPROVEMENTS:
   ZOOKEEPER-308. improve the atomic broadcast performance 3x.
   (breed via mahadev)

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=776806&r1=776805&r2=776806&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 
Wed May 20 18:48:00 2009
@@ -240,6 +240,20 @@
     }
 
 
+    /**
+     * Creates a connection object. The actual network connect doesn't get
+     * established until needed. The start() instance method must be called
+     * subsequent to construction.
+     *
+     * @param hosts
+     *                a comma separated list of hosts that can be connected to.
+     * @param sessionTimeout
+     *                the timeout for connections.
+     * @param zooKeeper
+     *                the zookeeper object that this connection is related to.
+     * @param watcher watcher for this connection
+     * @throws IOException
+     */
     public ClientCnxn(String hosts, int sessionTimeout, ZooKeeper zooKeeper,
             ClientWatchManager watcher)
         throws IOException
@@ -249,7 +263,8 @@
 
     /**
      * Creates a connection object. The actual network connect doesn't get
-     * established until needed.
+     * established until needed. The start() instance method must be called
+     * subsequent to construction.
      *
      * @param hosts
      *                a comma separated list of hosts that can be connected to.
@@ -257,12 +272,15 @@
      *                the timeout for connections.
      * @param zooKeeper
      *                the zookeeper object that this connection is related to.
-     * @throws KeeperException
+     * @param watcher watcher for this connection
+     * @param sessionId session id if re-establishing session
+     * @param sessionPasswd session passwd if re-establishing session
      * @throws IOException
      */
     public ClientCnxn(String hosts, int sessionTimeout, ZooKeeper zooKeeper,
             ClientWatchManager watcher, long sessionId, byte[] sessionPasswd)
-        throws IOException {
+        throws IOException
+    {
         this.zooKeeper = zooKeeper;
         this.watcher = watcher;
         this.sessionId = sessionId;
@@ -286,10 +304,13 @@
         Collections.shuffle(serverAddrs);
         sendThread = new SendThread();
         eventThread = new EventThread();
+    }
+
+    public void start() {
         sendThread.start();
         eventThread.start();
     }
-    
+
     Object eventOfDeath = new Object();
 
     final static UncaughtExceptionHandler uncaughtExceptionHandler = new 
UncaughtExceptionHandler() {
@@ -298,7 +319,7 @@
         }
     };
 
-    private class WatcherSetEventPair {
+    private static class WatcherSetEventPair {
         private final Set<Watcher> watchers;
         private final WatchedEvent event;
         

Modified: 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeper.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeper.java?rev=776806&r1=776805&r2=776806&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeper.java 
(original)
+++ hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeper.java 
Wed May 20 18:48:00 2009
@@ -344,6 +344,7 @@
 
         watchManager.defaultWatcher = watcher;
         cnxn = new ClientCnxn(host, sessionTimeout, this, watchManager);
+        cnxn.start();
     }
 
     /**
@@ -388,6 +389,7 @@
         watchManager.defaultWatcher = watcher;
         cnxn = new ClientCnxn(host, sessionTimeout, this, watchManager,
                 sessionId, sessionPasswd);
+        cnxn.start();
     }
 
     /**

Modified: 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeperMain.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeperMain.java?rev=776806&r1=776805&r2=776806&view=diff
==============================================================================
--- 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeperMain.java 
(original)
+++ 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeperMain.java 
Wed May 20 18:48:00 2009
@@ -447,6 +447,7 @@
             try {
                 children = zk.getChildren(quotaPath, false);
             } catch(KeeperException.NoNodeException ne) {
+                LOG.debug("child removed during quota check", ne);
                 return;
             }
             if (children.size() == 0) {

Modified: 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/FinalRequestProcessor.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/FinalRequestProcessor.java?rev=776806&r1=776805&r2=776806&view=diff
==============================================================================
--- 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/FinalRequestProcessor.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/FinalRequestProcessor.java
 Wed May 20 18:48:00 2009
@@ -22,9 +22,8 @@
 import java.nio.ByteBuffer;
 import java.util.List;
 
-import org.apache.log4j.Logger;
-
 import org.apache.jute.Record;
+import org.apache.log4j.Logger;
 import org.apache.zookeeper.KeeperException;
 import org.apache.zookeeper.ZooDefs;
 import org.apache.zookeeper.KeeperException.Code;
@@ -48,6 +47,7 @@
 import org.apache.zookeeper.proto.SyncResponse;
 import org.apache.zookeeper.server.DataTree.ProcessTxnResult;
 import org.apache.zookeeper.server.NIOServerCnxn.Factory;
+import org.apache.zookeeper.server.ZooKeeperServer.ChangeRecord;
 import org.apache.zookeeper.txn.CreateSessionTxn;
 import org.apache.zookeeper.txn.ErrorTxn;
 
@@ -83,12 +83,12 @@
         synchronized (zks.outstandingChanges) {
             while (!zks.outstandingChanges.isEmpty()
                     && zks.outstandingChanges.get(0).zxid <= request.zxid) {
-                if (zks.outstandingChanges.get(0).zxid < request.zxid) {
+                ChangeRecord cr = zks.outstandingChanges.remove(0);
+                if (cr.zxid < request.zxid) {
                     LOG.warn("Zxid outstanding "
-                            + zks.outstandingChanges.get(0).zxid
+                            + cr.zxid
                             + " is less than current " + request.zxid);
                 }
-                ZooKeeperServer.ChangeRecord cr = 
zks.outstandingChanges.remove(0);
                 if (zks.outstandingChangesForPath.get(cr.path) == cr) {
                     zks.outstandingChangesForPath.remove(cr.path);
                 }

Modified: 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java?rev=776806&r1=776805&r2=776806&view=diff
==============================================================================
--- 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/NIOServerCnxn.java
 Wed May 20 18:48:00 2009
@@ -87,6 +87,10 @@
 
         int outstandingLimit = 1;
 
+        /** Create the factory, startup(zks) must be called subsequently.
+         * @param port listener port
+         * @throws IOException
+         */
         public Factory(int port) throws IOException {
             super("NIOServerCxn.Factory:" + port);
             setDaemon(true);
@@ -95,11 +99,20 @@
             ss.socket().bind(new InetSocketAddress(port));
             ss.configureBlocking(false);
             ss.register(selector, SelectionKey.OP_ACCEPT);
-            start();
         }
 
-        public void startup(ZooKeeperServer zks) throws IOException,
-                InterruptedException {
+        @Override
+        public void start() {
+            // ensure thread is started once and only once
+            if (getState() == Thread.State.NEW) {
+                super.start();
+            }
+        }
+
+        public void startup(ZooKeeperServer zks)
+            throws IOException, InterruptedException
+        {
+            start();
             zks.startup();
             setZooKeeperServer(zks);
         }
@@ -482,15 +495,17 @@
         }
         if (h.getXid() >= 0) {
             synchronized (this) {
-                outstandingRequests++;
-                // check throttling
-                if (zk.getInProcess() > factory.outstandingLimit) {
-                    LOG.debug("Throttling recv " + zk.getInProcess());
-                    disableRecv();
-                    // following lines should not be needed since we are 
already
-                    // reading
-                    // } else {
-                    // enableRecv();
+                synchronized (this.factory) {
+                    outstandingRequests++;
+                    // check throttling
+                    if (zk.getInProcess() > factory.outstandingLimit) {
+                        LOG.debug("Throttling recv " + zk.getInProcess());
+                        disableRecv();
+                        // following lines should not be needed since we are
+                        // already reading
+                        // } else {
+                        // enableRecv();
+                    }
                 }
             }
         }
@@ -934,7 +949,11 @@
          * The number of requests that have been submitted but not yet 
responded to.
          */
         public long getOutstandingRequests() {
-            return outstandingRequests;
+            synchronized (NIOServerCnxn.this) {
+                synchronized (NIOServerCnxn.this.factory) {
+                    return outstandingRequests;
+                }
+            }
         }
 
         public long getPacketsReceived() {

Modified: 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/PrepRequestProcessor.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/PrepRequestProcessor.java?rev=776806&r1=776805&r2=776806&view=diff
==============================================================================
--- 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/PrepRequestProcessor.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/PrepRequestProcessor.java
 Wed May 20 18:48:00 2009
@@ -86,8 +86,6 @@
         super("ProcessThread:" + zks.getClientPort());
         this.nextProcessor = nextProcessor;
         this.zks = zks;
-
-        start();
     }
 
     @Override

Modified: 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/SessionTrackerImpl.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/SessionTrackerImpl.java?rev=776806&r1=776805&r2=776806&view=diff
==============================================================================
--- 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/SessionTrackerImpl.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/SessionTrackerImpl.java
 Wed May 20 18:48:00 2009
@@ -23,10 +23,10 @@
 import java.util.Date;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.Map.Entry;
 import java.util.concurrent.ConcurrentHashMap;
 
 import org.apache.log4j.Logger;
-
 import org.apache.zookeeper.KeeperException;
 
 /**
@@ -68,8 +68,6 @@
     }
 
     static class SessionSet {
-        long expireTime;
-
         HashSet<Session> sessions = new HashSet<Session>();
     }
 
@@ -81,7 +79,9 @@
     }
 
     public SessionTrackerImpl(SessionExpirer expirer,
-            ConcurrentHashMap<Long, Integer> sessionsWithTimeout, int 
tickTime, long sid) {
+            ConcurrentHashMap<Long, Integer> sessionsWithTimeout, int tickTime,
+            long sid)
+    {
         super("SessionTracker");
         this.expirer = expirer;
         this.expirationInterval = tickTime;
@@ -89,10 +89,9 @@
         nextExpirationTime = roundToInterval(System.currentTimeMillis());
         this.serverId = sid;
         this.nextSessionId = initializeNextSession(sid);
-        for (long id : sessionsWithTimeout.keySet()) {
-            addSession(id, sessionsWithTimeout.get(id));
+        for (Entry<Long, Integer> e : sessionsWithTimeout.entrySet()) {
+            addSession(e.getKey(), e.getValue());
         }
-        start();
     }
 
     volatile boolean running = true;
@@ -164,7 +163,6 @@
         set = sessionSets.get(s.tickTime);
         if (set == null) {
             set = new SessionSet();
-            set.expireTime = expireTime;
             sessionSets.put(expireTime, set);
         }
         set.sessions.add(s);

Modified: 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/SyncRequestProcessor.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/SyncRequestProcessor.java?rev=776806&r1=776805&r2=776806&view=diff
==============================================================================
--- 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/SyncRequestProcessor.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/SyncRequestProcessor.java
 Wed May 20 18:48:00 2009
@@ -60,7 +60,6 @@
         super("SyncThread:" + zks.getServerId());
         this.zks = zks;
         this.nextProcessor = nextProcessor;
-        start();
     }
 
     @Override

Modified: 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ZooKeeperServer.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ZooKeeperServer.java?rev=776806&r1=776805&r2=776806&view=diff
==============================================================================
--- 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ZooKeeperServer.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ZooKeeperServer.java
 Wed May 20 18:48:00 2009
@@ -200,8 +200,7 @@
         };
         sessionsWithTimeouts = new ConcurrentHashMap<Long, Integer>();
         dataTree = treeBuilder.build();
-        long zxid = 
txnLogFactory.restore(dataTree,sessionsWithTimeouts,listener);
-        this.hzxid = zxid;
+        setZxid(txnLogFactory.restore(dataTree,sessionsWithTimeouts,listener));
         // Clean up dead sessions
         LinkedList<Long> deadSessions = new LinkedList<Long>();
         for (long session : dataTree.getSessions()) {
@@ -283,7 +282,7 @@
     /**
      * This should be called from a synchronized block on this!
      */
-    public long getZxid() {
+    synchronized public long getZxid() {
         return hzxid;
     }
 
@@ -291,6 +290,10 @@
         return ++hzxid;
     }
 
+    synchronized public void setZxid(long zxid) {
+        hzxid = zxid;
+    }
+
     long getTime() {
         return System.currentTimeMillis();
     }
@@ -371,12 +374,15 @@
         RequestProcessor finalProcessor = new FinalRequestProcessor(this);
         RequestProcessor syncProcessor = new SyncRequestProcessor(this,
                 finalProcessor);
+        ((SyncRequestProcessor)syncProcessor).start();
         firstProcessor = new PrepRequestProcessor(this, syncProcessor);
+        ((PrepRequestProcessor)firstProcessor).start();
     }
 
     protected void createSessionTracker() {
         sessionTracker = new SessionTrackerImpl(this, sessionsWithTimeouts,
                 tickTime, 1);
+        ((SessionTrackerImpl)sessionTracker).start();
     }
 
     public boolean isRunning() {

Modified: 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ZooKeeperServerMain.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ZooKeeperServerMain.java?rev=776806&r1=776805&r2=776806&view=diff
==============================================================================
--- 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ZooKeeperServerMain.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ZooKeeperServerMain.java
 Wed May 20 18:48:00 2009
@@ -94,9 +94,8 @@
                    File(config.dataLogDir), new File(config.dataDir));
             zkServer.setTxnLogFactory(ftxn);
             zkServer.setTickTime(config.tickTime);
-            zkServer.startup();
             cnxnFactory = new NIOServerCnxn.Factory(config.clientPort);
-            cnxnFactory.setZooKeeperServer(zkServer);
+            cnxnFactory.startup(zkServer);
             cnxnFactory.join();
             if (zkServer.isRunning()) {
                 zkServer.shutdown();

Modified: 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/FollowerZooKeeperServer.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/FollowerZooKeeperServer.java?rev=776806&r1=776805&r2=776806&view=diff
==============================================================================
--- 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/FollowerZooKeeperServer.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/FollowerZooKeeperServer.java
 Wed May 20 18:48:00 2009
@@ -87,6 +87,7 @@
         firstProcessor = new FollowerRequestProcessor(this, commitProcessor);
         syncProcessor = new SyncRequestProcessor(this,
                 new SendAckRequestProcessor(getFollower()));
+        syncProcessor.start();
     }
 
     @Override

Modified: 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/LeaderZooKeeperServer.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/LeaderZooKeeperServer.java?rev=776806&r1=776805&r2=776806&view=diff
==============================================================================
--- 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/LeaderZooKeeperServer.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/LeaderZooKeeperServer.java
 Wed May 20 18:48:00 2009
@@ -66,6 +66,7 @@
         RequestProcessor proposalProcessor = new ProposalRequestProcessor(this,
                 commitProcessor);
         firstProcessor = new PrepRequestProcessor(this, proposalProcessor);
+        ((PrepRequestProcessor)firstProcessor).start();
     }
 
     @Override
@@ -77,6 +78,7 @@
     protected void createSessionTracker() {
         sessionTracker = new SessionTrackerImpl(this, sessionsWithTimeouts,
                 tickTime, self.getId());
+        ((SessionTrackerImpl)sessionTracker).start();
     }
 
 
@@ -84,10 +86,6 @@
         return sessionTracker.touchSession(sess, to);
     }
 
-    public void setZxid(long zxid) {
-        hzxid = zxid;
-    }
-
     @Override
     protected void registerJMX() {
         // register with JMX

Modified: 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/ProposalRequestProcessor.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/ProposalRequestProcessor.java?rev=776806&r1=776805&r2=776806&view=diff
==============================================================================
--- 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/ProposalRequestProcessor.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/ProposalRequestProcessor.java
 Wed May 20 18:48:00 2009
@@ -39,6 +39,7 @@
         this.nextProcessor = nextProcessor;
         AckRequestProcessor ackProcessor = new 
AckRequestProcessor(zks.getLeader());
         syncProcessor = new SyncRequestProcessor(zks, ackProcessor);
+        syncProcessor.start();
     }
 
     public void processRequest(Request request) {

Modified: 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeer.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeer.java?rev=776806&r1=776805&r2=776806&view=diff
==============================================================================
--- 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeer.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeer.java
 Wed May 20 18:48:00 2009
@@ -306,6 +306,7 @@
     
     @Override
     public synchronized void start() {
+        cnxnFactory.start();
         startLeaderElection();
         super.start();
     }

Modified: hadoop/zookeeper/trunk/src/java/test/config/findbugsExcludeFile.xml
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/test/config/findbugsExcludeFile.xml?rev=776806&r1=776805&r2=776806&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/test/config/findbugsExcludeFile.xml 
(original)
+++ hadoop/zookeeper/trunk/src/java/test/config/findbugsExcludeFile.xml Wed May 
20 18:48:00 2009
@@ -1,5 +1,40 @@
 <FindBugsFilter>
-     <Match>
-       <Package name="org.apache.jute.compiler.generated" />
-     </Match>
+  <!-- Allow command line utilities, which follow pattern *Main.java, to call
+       system exit -->
+  <Match>
+    <Class name="~org\.apache\.zookeeper\..*Main" />
+    <Bug pattern="DM_EXIT" />
+  </Match>
+
+  <!-- This is too complicated to resolve/ingrained into the architecture
+       In particular we want to make sure we exit if this occurs
+       Also notice logged as fatal error -->
+  <Match>
+    <Class name="org.apache.zookeeper.server.SyncRequestProcessor" />
+    <Method name="run" />
+    <Bug pattern="DM_EXIT" />
+  </Match>
+
+  <!-- In particular we want to make sure we exit if this occurs, 
unrecoverable.
+       Also notice logged as fatal error -->
+  <Match>
+    <Class name="org.apache.zookeeper.server.ZooKeeperServer" />
+    <Method name="takeSnapshot" />
+    <Bug pattern="DM_EXIT" />
+  </Match>
+
+
+  <!-- We want to catch all exceptions and cleanup, regardless of source
+       (incl runtime) -->
+  <Match>
+    <Class name="org.apache.zookeeper.ClientCnxn$SendThread" />
+    <Method name="run" />
+    <Bug pattern="REC_CATCH_EXCEPTION" />
+  </Match>
+
+
+  <Match>
+    <Package name="org.apache.jute.compiler.generated" />
+  </Match>
+
 </FindBugsFilter>


Reply via email to