hadoop-zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r692164 - in /hadoop/zookeeper/trunk/src/java: jmx/org/apache/zookeeper/jmx/server/ jmx/org/apache/zookeeper/server/ jmx/org/apache/zookeeper/server/quorum/ main/org/apache/zookeeper/ main/org/apache/zookeeper/server/ main/org/apache/zookee...
Date Thu, 04 Sep 2008 17:02:11 GMT
Author: breed
Date: Thu Sep  4 10:02:09 2008
New Revision: 692164

URL: http://svn.apache.org/viewvc?rev=692164&view=rev
Log:
ZOOKEEPER-134 findbugs cleanup

Modified:
    hadoop/zookeeper/trunk/src/java/jmx/org/apache/zookeeper/jmx/server/ConnectionBean.java
    hadoop/zookeeper/trunk/src/java/jmx/org/apache/zookeeper/jmx/server/DataTreeBean.java
    hadoop/zookeeper/trunk/src/java/jmx/org/apache/zookeeper/server/ManagedZooKeeperServer.java
    hadoop/zookeeper/trunk/src/java/jmx/org/apache/zookeeper/server/ManagedZooKeeperServerMain.java
    hadoop/zookeeper/trunk/src/java/jmx/org/apache/zookeeper/server/ObservableZooKeeperServer.java
    hadoop/zookeeper/trunk/src/java/jmx/org/apache/zookeeper/server/quorum/ManagedQuorumPeer.java
    hadoop/zookeeper/trunk/src/java/jmx/org/apache/zookeeper/server/quorum/ManagedQuorumPeerMain.java
    hadoop/zookeeper/trunk/src/java/jmx/org/apache/zookeeper/server/quorum/ObservableQuorumPeer.java
    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/server/DataNode.java
    hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/DataTree.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/Request.java
    hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ServerStats.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/quorum/AuthFastLeaderElection.java
    hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/CommitProcessor.java
    hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/FastLeaderElection.java
    hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/Follower.java
    hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/FollowerHandler.java
    hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/FollowerRequestProcessor.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/Leader.java
    hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/LeaderElection.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/QuorumCnxManager.java
    hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeer.java
    hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeerConfig.java
    hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumStats.java
    hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/version/util/VerGen.java
    hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ClientBase.java
    hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ClientTest.java
    hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/SessionTest.java
    hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ZooKeeperTestClient.java

Modified: hadoop/zookeeper/trunk/src/java/jmx/org/apache/zookeeper/jmx/server/ConnectionBean.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/jmx/org/apache/zookeeper/jmx/server/ConnectionBean.java?rev=692164&r1=692163&r2=692164&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/jmx/org/apache/zookeeper/jmx/server/ConnectionBean.java (original)
+++ hadoop/zookeeper/trunk/src/java/jmx/org/apache/zookeeper/jmx/server/ConnectionBean.java Thu Sep  4 10:02:09 2008
@@ -88,6 +88,7 @@
         connection.close();
     }
     
+    @Override
     public String toString() {
         return "ConnectionBean{ClientIP="+getSourceIP()+",SessionId=0x"+getSessionId()+"}";
     }

Modified: hadoop/zookeeper/trunk/src/java/jmx/org/apache/zookeeper/jmx/server/DataTreeBean.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/jmx/org/apache/zookeeper/jmx/server/DataTreeBean.java?rev=692164&r1=692163&r2=692164&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/jmx/org/apache/zookeeper/jmx/server/DataTreeBean.java (original)
+++ hadoop/zookeeper/trunk/src/java/jmx/org/apache/zookeeper/jmx/server/DataTreeBean.java Thu Sep  4 10:02:09 2008
@@ -18,11 +18,7 @@
 
 package org.apache.zookeeper.jmx.server;
 
-import java.io.ByteArrayOutputStream;
-
 import org.apache.log4j.Logger;
-
-import org.apache.jute.BinaryOutputArchive;
 import org.apache.zookeeper.jmx.ZKMBeanInfo;
 
 /**

Modified: hadoop/zookeeper/trunk/src/java/jmx/org/apache/zookeeper/server/ManagedZooKeeperServer.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/jmx/org/apache/zookeeper/server/ManagedZooKeeperServer.java?rev=692164&r1=692163&r2=692164&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/jmx/org/apache/zookeeper/server/ManagedZooKeeperServer.java (original)
+++ hadoop/zookeeper/trunk/src/java/jmx/org/apache/zookeeper/server/ManagedZooKeeperServer.java Thu Sep  4 10:02:09 2008
@@ -23,18 +23,16 @@
 import java.util.concurrent.ConcurrentHashMap;
 
 import org.apache.log4j.Logger;
-
 import org.apache.zookeeper.jmx.MBeanRegistry;
 import org.apache.zookeeper.jmx.server.ConnectionBean;
+import org.apache.zookeeper.jmx.server.ConnectionMXBean;
 import org.apache.zookeeper.jmx.server.DataTreeBean;
+import org.apache.zookeeper.jmx.server.DataTreeMXBean;
 import org.apache.zookeeper.jmx.server.ZooKeeperServerBean;
-import org.apache.zookeeper.server.ZooKeeperServer.DataTreeBuilder;
+import org.apache.zookeeper.jmx.server.ZooKeeperServerMXBean;
 import org.apache.zookeeper.server.util.ConnectionObserver;
 import org.apache.zookeeper.server.util.ObserverManager;
 import org.apache.zookeeper.server.util.ServerObserver;
-import org.apache.zookeeper.server.util.ZooKeeperObserverManager;
-
-import static org.apache.zookeeper.server.ServerConfig.getClientPort;
 
 /**
  * This class launches a standalone zookeeper server with JMX support

Modified: hadoop/zookeeper/trunk/src/java/jmx/org/apache/zookeeper/server/ManagedZooKeeperServerMain.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/jmx/org/apache/zookeeper/server/ManagedZooKeeperServerMain.java?rev=692164&r1=692163&r2=692164&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/jmx/org/apache/zookeeper/server/ManagedZooKeeperServerMain.java (original)
+++ hadoop/zookeeper/trunk/src/java/jmx/org/apache/zookeeper/server/ManagedZooKeeperServerMain.java Thu Sep  4 10:02:09 2008
@@ -23,7 +23,6 @@
 import java.io.File;
 import java.io.IOException;
 
-import org.apache.log4j.Logger;
 import org.apache.zookeeper.jmx.server.ConnectionMXBean;
 import org.apache.zookeeper.jmx.server.DataTreeMXBean;
 import org.apache.zookeeper.jmx.server.ZooKeeperServerMXBean;

Modified: hadoop/zookeeper/trunk/src/java/jmx/org/apache/zookeeper/server/ObservableZooKeeperServer.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/jmx/org/apache/zookeeper/server/ObservableZooKeeperServer.java?rev=692164&r1=692163&r2=692164&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/jmx/org/apache/zookeeper/server/ObservableZooKeeperServer.java (original)
+++ hadoop/zookeeper/trunk/src/java/jmx/org/apache/zookeeper/server/ObservableZooKeeperServer.java Thu Sep  4 10:02:09 2008
@@ -21,7 +21,8 @@
 import java.io.File;
 import java.io.IOException;
 
-import org.apache.zookeeper.server.ZooKeeperServer.DataTreeBuilder;
+import org.apache.zookeeper.server.util.ObserverManager;
+import org.apache.zookeeper.server.util.ServerObserver;
 /**
  * The observable server broadcast notifications when its state changes. 
  * 

Modified: hadoop/zookeeper/trunk/src/java/jmx/org/apache/zookeeper/server/quorum/ManagedQuorumPeer.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/jmx/org/apache/zookeeper/server/quorum/ManagedQuorumPeer.java?rev=692164&r1=692163&r2=692164&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/jmx/org/apache/zookeeper/server/quorum/ManagedQuorumPeer.java (original)
+++ hadoop/zookeeper/trunk/src/java/jmx/org/apache/zookeeper/server/quorum/ManagedQuorumPeer.java Thu Sep  4 10:02:09 2008
@@ -18,38 +18,38 @@
 
 package org.apache.zookeeper.server.quorum;
 
-import static org.apache.zookeeper.server.ServerConfig.getClientPort;
-
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.concurrent.ConcurrentHashMap;
 
 import org.apache.log4j.Logger;
-
 import org.apache.zookeeper.jmx.MBeanRegistry;
 import org.apache.zookeeper.jmx.ZKMBeanInfo;
 import org.apache.zookeeper.jmx.server.ConnectionBean;
+import org.apache.zookeeper.jmx.server.ConnectionMXBean;
 import org.apache.zookeeper.jmx.server.DataTreeBean;
+import org.apache.zookeeper.jmx.server.DataTreeMXBean;
+import org.apache.zookeeper.jmx.server.ZooKeeperServerMXBean;
 import org.apache.zookeeper.jmx.server.quorum.FollowerBean;
 import org.apache.zookeeper.jmx.server.quorum.LeaderBean;
 import org.apache.zookeeper.jmx.server.quorum.LeaderElectionBean;
+import org.apache.zookeeper.jmx.server.quorum.LeaderElectionMXBean;
 import org.apache.zookeeper.jmx.server.quorum.LocalPeerBean;
+import org.apache.zookeeper.jmx.server.quorum.LocalPeerMXBean;
 import org.apache.zookeeper.jmx.server.quorum.QuorumBean;
+import org.apache.zookeeper.jmx.server.quorum.QuorumMXBean;
 import org.apache.zookeeper.jmx.server.quorum.RemotePeerBean;
+import org.apache.zookeeper.jmx.server.quorum.RemotePeerMXBean;
 import org.apache.zookeeper.jmx.server.quorum.ServerBean;
-import org.apache.zookeeper.server.ManagedZooKeeperServer;
 import org.apache.zookeeper.server.NIOServerCnxn;
-import org.apache.zookeeper.server.ObservableNIOServerCnxn;
 import org.apache.zookeeper.server.ServerCnxn;
 import org.apache.zookeeper.server.ZooKeeperServer;
 import org.apache.zookeeper.server.ZooTrace;
-import org.apache.zookeeper.server.quorum.QuorumPeer.QuorumServer;
 import org.apache.zookeeper.server.util.ConnectionObserver;
 import org.apache.zookeeper.server.util.ObserverManager;
 import org.apache.zookeeper.server.util.QuorumPeerObserver;
 import org.apache.zookeeper.server.util.ServerObserver;
-import org.apache.zookeeper.server.util.ZooKeeperObserverManager;
 
 /**
  * This class launches a replicated zookeeper server with JMX support

Modified: hadoop/zookeeper/trunk/src/java/jmx/org/apache/zookeeper/server/quorum/ManagedQuorumPeerMain.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/jmx/org/apache/zookeeper/server/quorum/ManagedQuorumPeerMain.java?rev=692164&r1=692163&r2=692164&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/jmx/org/apache/zookeeper/server/quorum/ManagedQuorumPeerMain.java (original)
+++ hadoop/zookeeper/trunk/src/java/jmx/org/apache/zookeeper/server/quorum/ManagedQuorumPeerMain.java Thu Sep  4 10:02:09 2008
@@ -19,40 +19,22 @@
 package org.apache.zookeeper.server.quorum;
 
 import static org.apache.zookeeper.server.ServerConfig.getClientPort;
-import static org.apache.zookeeper.server.quorum.QuorumPeerConfig.getElectionAlg;
-import static org.apache.zookeeper.server.quorum.QuorumPeerConfig.getServerId;
-import static org.apache.zookeeper.server.quorum.QuorumPeerConfig.getServers;
 
 import java.io.File;
 import java.io.IOException;
-import java.util.ArrayList;
-import java.util.concurrent.ConcurrentHashMap;
 
 import org.apache.log4j.Logger;
-
-import org.apache.zookeeper.jmx.MBeanRegistry;
-import org.apache.zookeeper.jmx.ZKMBeanInfo;
-import org.apache.zookeeper.jmx.server.ConnectionBean;
-import org.apache.zookeeper.jmx.server.DataTreeBean;
-import org.apache.zookeeper.jmx.server.quorum.FollowerBean;
-import org.apache.zookeeper.jmx.server.quorum.LeaderBean;
-import org.apache.zookeeper.jmx.server.quorum.LeaderElectionBean;
-import org.apache.zookeeper.jmx.server.quorum.LocalPeerBean;
-import org.apache.zookeeper.jmx.server.quorum.QuorumBean;
-import org.apache.zookeeper.jmx.server.quorum.RemotePeerBean;
-import org.apache.zookeeper.jmx.server.quorum.ServerBean;
+import org.apache.zookeeper.jmx.server.ConnectionMXBean;
+import org.apache.zookeeper.jmx.server.DataTreeMXBean;
+import org.apache.zookeeper.jmx.server.ZooKeeperServerMXBean;
+import org.apache.zookeeper.jmx.server.quorum.LeaderElectionMXBean;
+import org.apache.zookeeper.jmx.server.quorum.LocalPeerMXBean;
+import org.apache.zookeeper.jmx.server.quorum.QuorumMXBean;
+import org.apache.zookeeper.jmx.server.quorum.RemotePeerMXBean;
 import org.apache.zookeeper.server.ManagedZooKeeperServerMain;
-import org.apache.zookeeper.server.ManagedZooKeeperServer;
 import org.apache.zookeeper.server.NIOServerCnxn;
 import org.apache.zookeeper.server.ObservableNIOServerCnxn;
-import org.apache.zookeeper.server.ServerCnxn;
 import org.apache.zookeeper.server.ServerConfig;
-import org.apache.zookeeper.server.ZooKeeperServer;
-import org.apache.zookeeper.server.ZooTrace;
-import org.apache.zookeeper.server.util.ConnectionObserver;
-import org.apache.zookeeper.server.util.ObserverManager;
-import org.apache.zookeeper.server.util.QuorumPeerObserver;
-import org.apache.zookeeper.server.util.ServerObserver;
 import org.apache.zookeeper.server.util.ZooKeeperObserverManager;
 
 /**

Modified: hadoop/zookeeper/trunk/src/java/jmx/org/apache/zookeeper/server/quorum/ObservableQuorumPeer.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/jmx/org/apache/zookeeper/server/quorum/ObservableQuorumPeer.java?rev=692164&r1=692163&r2=692164&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/jmx/org/apache/zookeeper/server/quorum/ObservableQuorumPeer.java (original)
+++ hadoop/zookeeper/trunk/src/java/jmx/org/apache/zookeeper/server/quorum/ObservableQuorumPeer.java Thu Sep  4 10:02:09 2008
@@ -24,8 +24,6 @@
 
 import org.apache.zookeeper.server.NIOServerCnxn;
 import org.apache.zookeeper.server.ZooKeeperServer;
-import org.apache.zookeeper.server.NIOServerCnxn.Factory;
-import org.apache.zookeeper.server.quorum.QuorumPeer.QuorumServer;
 import org.apache.zookeeper.server.util.EventInfo;
 import org.apache.zookeeper.server.util.ObservableComponent;
 import org.apache.zookeeper.server.util.ObserverManager;

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=692164&r1=692163&r2=692164&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 Sep  4 10:02:09 2008
@@ -136,6 +136,7 @@
         return sessionPasswd;
     }
 
+    @Override
     public String toString() {
         StringBuffer sb = new StringBuffer();
         sb.append("sessionId: 0x").append(Long.toHexString(getSessionId())).append("\n");
@@ -263,6 +264,7 @@
             setDaemon(true);
         }
 
+        @Override
         public void run() {
             try {
                 while (true) {
@@ -359,12 +361,13 @@
             p.watchRegistration.register(p.replyHeader.getErr());
         }
 
-        p.finished = true;
         if (p.cb == null) {
             synchronized (p) {
+                p.finished = true;
                 p.notifyAll();
             }
         } else {
+            p.finished = true;
             waitingEvents.add(p);
         }
     }
@@ -525,7 +528,7 @@
             if (sockKey.isWritable()) {
                 synchronized (outgoingQueue) {
                     if (outgoingQueue.size() > 0) {
-                        int rc = sock.write(outgoingQueue.getFirst().bb);
+                        sock.write(outgoingQueue.getFirst().bb);
                         if (outgoingQueue.getFirst().bb.remaining() == 0) {
                             Packet p = outgoingQueue.removeFirst();
                             if (p.header != null
@@ -581,8 +584,7 @@
         }
 
         private void primeConnection(SelectionKey k) throws IOException {
-            LOG.info("Priming connection to "
-                    + ((SocketChannel) sockKey.channel()));
+            LOG.info("Priming connection to " + sockKey.channel());
             lastConnectIndex = currentConnectIndex;
             ConnectRequest conReq = new ConnectRequest(0, lastZxid,
                     sessionTimeout, sessionId, sessionPasswd);
@@ -833,6 +835,7 @@
      * method is primarily here to allow the tests to verify disconnection
      * behavior.
      */
+    @SuppressWarnings("unchecked")
     public void disconnect() {
         LOG.info("Disconnecting ClientCnxn for session: 0x" 
                 + Long.toHexString(getSessionId()));

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=692164&r1=692163&r2=692164&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 Thu Sep  4 10:02:09 2008
@@ -241,6 +241,7 @@
         {
             super(watches, watcher, path);
         }
+        @Override
         protected boolean shouldAddWatch(int rc) {
             return rc == 0 || rc == KeeperException.Code.NoNode;
         }

Modified: hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/DataNode.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/DataNode.java?rev=692164&r1=692163&r2=692164&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/DataNode.java (original)
+++ hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/DataNode.java Thu Sep  4 10:02:09 2008
@@ -39,6 +39,7 @@
  */
 public class DataNode implements Record {
     DataNode() {
+        // default rather than public constructor
     }
 
     DataNode(DataNode parent, byte data[], List<ACL> acl, Stat stat) {

Modified: hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/DataTree.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/DataTree.java?rev=692164&r1=692163&r2=692164&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/DataTree.java (original)
+++ hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/DataTree.java Thu Sep  4 10:02:09 2008
@@ -74,6 +74,7 @@
     /** A debug string * */
     private String debug = "debug";
 
+    @SuppressWarnings("unchecked")
     public HashSet<String> getEphemerals(long sessionId) {
         HashSet<String> retv = ephemerals.get(sessionId);
         if (retv == null) {

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=692164&r1=692163&r2=692164&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 Thu Sep  4 10:02:09 2008
@@ -242,6 +242,8 @@
     }
 
     public void shutdown() {
+        // we are the final link in the chain
+        LOG.info("shutdown of request processor complete");
     }
 
 }

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=692164&r1=692163&r2=692164&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 Thu Sep  4 10:02:09 2008
@@ -646,6 +646,7 @@
         sk.interestOps(SelectionKey.OP_READ);
     }
 
+    @Override
     public String toString() {
         return "NIOServerCnxn object with sock = " + sock + " and sk = " + sk;
     }
@@ -685,11 +686,12 @@
         try {
             sock.socket().shutdownInput();
         } catch (IOException e) {
+            LOG.warn("ignoring exception during input shutdown", e);
         }
         try {
             sock.socket().close();
         } catch (IOException e) {
-            LOG.error("FIXMSG",e);
+            LOG.warn("ignoring exception during socket close", e);
         }
         try {
             sock.close();
@@ -698,7 +700,7 @@
             // this section arise.
             // factory.selector.wakeup();
         } catch (IOException e) {
-            LOG.error("FIXMSG",e);
+            LOG.warn("ignoring exception during socketchannel close", e);
         }
         sock = null;
         if (sk != null) {
@@ -706,6 +708,7 @@
                 // need to cancel this selection key from the selector
                 sk.cancel();
             } catch (Exception e) {
+                LOG.warn("ignoring exception during selectionkey cancel", e);
             }
         }
     }
@@ -833,6 +836,7 @@
         public long getPacketsSent() {
             return packetsSent;
         }
+        @Override
         public String toString(){
             StringBuilder sb=new StringBuilder();
             Channel channel = sk.channel();

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=692164&r1=692163&r2=692164&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 Thu Sep  4 10:02:09 2008
@@ -83,6 +83,7 @@
         start();
     }
 
+    @Override
     public void run() {
         try {
             while (true) {
@@ -404,6 +405,7 @@
             ACL a = it.next();
             Id id = a.getId();
             if (id.getScheme().equals("world") && id.getId().equals("anyone")) {
+                // wide open
             } else if (id.getScheme().equals("auth")) {
                 // This is the "auth" id, so we have to expand it to the
                 // authenticated ids of the requestor

Modified: hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/Request.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/Request.java?rev=692164&r1=692163&r2=692164&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/Request.java (original)
+++ hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/Request.java Thu Sep  4 10:02:09 2008
@@ -22,6 +22,7 @@
 import java.util.List;
 
 import org.apache.jute.Record;
+import org.apache.log4j.Logger;
 import org.apache.zookeeper.ZooDefs.OpCode;
 import org.apache.zookeeper.data.Id;
 import org.apache.zookeeper.txn.TxnHeader;
@@ -32,6 +33,8 @@
  * onto the request as it is processed.
  */
 public class Request {
+    private static final Logger LOG = Logger.getLogger(Request.class);
+
     public final static Request requestOfDeath = new Request(null, 0, 0, 0,
             null, null);
 
@@ -157,6 +160,7 @@
         }
     }
 
+    @Override
     public String toString() {
         StringBuffer sb = new StringBuffer();
         sb.append("session 0x").append(Long.toHexString(sessionId));
@@ -180,7 +184,7 @@
                 path = new String(b);
                 request.clear();
             } catch (Exception e) {
-
+                LOG.warn("Ignoring exception during toString", e);
             }
         }
         sb.append(path).append(" ");

Modified: hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ServerStats.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ServerStats.java?rev=692164&r1=692163&r2=692164&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ServerStats.java (original)
+++ hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/ServerStats.java Thu Sep  4 10:02:09 2008
@@ -48,7 +48,9 @@
         assert instance==null;
         instance = newInstance;
     }
-    protected ServerStats(){}
+    protected ServerStats() {
+        // protected constructor
+    }
     
     // getters
     synchronized public long getMinLatency() {
@@ -87,6 +89,7 @@
         return "standalone";
     }
     
+    @Override
     public String toString(){
         StringBuilder sb = new StringBuilder();
         sb.append("Latency min/avg/max: " + getMinLatency() + "/"

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=692164&r1=692163&r2=692164&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 Thu Sep  4 10:02:09 2008
@@ -95,15 +95,11 @@
         start();
     }
 
-    boolean running = true;
-
-    synchronized public void finish() {
-        running = false;
-        this.notifyAll();
-    }
+    volatile boolean running = true;
 
     volatile long currentTime;
 
+    @Override
     synchronized public String toString() {
         StringBuffer sb = new StringBuffer("Session Sets ("
                 + sessionSets.size() + "):\n");
@@ -119,6 +115,7 @@
         return sb.toString();
     }
 
+    @Override
     synchronized public void run() {
         try {
             while (running) {

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=692164&r1=692163&r2=692164&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 Thu Sep  4 10:02:09 2008
@@ -135,6 +135,7 @@
         return fileSize;
     }
 
+    @Override
     public void run() {
         try {
             long fileSize = 0;
@@ -238,6 +239,7 @@
                                      "SyncRequestProcessor exiyed!");
     }
 
+    @SuppressWarnings("unchecked")
     private void flush(LinkedList<Request> toFlush) throws IOException {
         if (toFlush.size() == 0) {
             return;
@@ -251,7 +253,7 @@
         for (FileOutputStream fos : streamsToFlushNow) {
             fos.flush();
             if (forceSync) {
-                ((FileChannel) fos.getChannel()).force(false);
+                fos.getChannel().force(false);
             }
         }
         while (streamsToFlushNow.size() > 1) {

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=692164&r1=692163&r2=692164&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 Thu Sep  4 10:02:09 2008
@@ -121,7 +121,7 @@
     final public static Exception ok = new Exception("No prob");
     protected RequestProcessor firstProcessor;
     LinkedBlockingQueue<Long> sessionsToDie = new LinkedBlockingQueue<Long>();
-    protected boolean running;
+    protected volatile boolean running;
     /**
      * This is the secret that we use to generate passwords, for the moment it
      * is more of a sanity check.
@@ -195,6 +195,8 @@
             try {
                 zxid = Long.parseLong(nameParts[1], 16);
             } catch (NumberFormatException e) {
+                LOG.warn("unable to parse zxid string into long: "
+                        + nameParts[1]);
             }
         }
         return zxid;
@@ -317,10 +319,17 @@
 
             LOG.warn("Processing snapshot: " + f);
 
-            InputStream snapIS =
-                new BufferedInputStream(new FileInputStream(f));
-            loadData(BinaryInputArchive.getArchive(snapIS));
-            snapIS.close();
+            FileInputStream snapFIS = new FileInputStream(f);
+            try {
+                InputStream snapIS = new BufferedInputStream(snapFIS);
+                try {
+                    loadData(BinaryInputArchive.getArchive(snapIS));
+                } finally {
+                    snapIS.close();
+                }
+            } finally {
+                snapFIS.close();
+            }
 
             dataTree.lastProcessedZxid = zxid;
 
@@ -601,12 +610,15 @@
         ZooTrace.logTraceMessage(LOG, ZooTrace.getTextTraceLevel(),
                 "Snapshotting: zxid 0x" + Long.toHexString(lastZxid));
         try {
-            File f =new File(dataDir, "snapshot." + Long.toHexString(lastZxid));
+            File f = new File(dataDir, "snapshot." + Long.toHexString(lastZxid));
             OutputStream sessOS = new BufferedOutputStream(new FileOutputStream(f));
-            BinaryOutputArchive oa = BinaryOutputArchive.getArchive(sessOS);
-            snapshot(oa);
-            sessOS.flush();
-            sessOS.close();
+            try {
+                BinaryOutputArchive oa = BinaryOutputArchive.getArchive(sessOS);
+                snapshot(oa);
+                sessOS.flush();
+            } finally {
+                sessOS.close();
+            }
             ZooTrace.logTraceMessage(LOG, ZooTrace.getTextTraceLevel(),
                     "Snapshotting finished: zxid 0x" + Long.toHexString(lastZxid));
         } catch (IOException e) {
@@ -692,8 +704,8 @@
         }
         createSessionTracker();
         setupRequestProcessors();
-        running = true;
         synchronized (this) {
+            running = true;
             notifyAll();
         }
     }

Modified: hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/AuthFastLeaderElection.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/AuthFastLeaderElection.java?rev=692164&r1=692163&r2=692164&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/AuthFastLeaderElection.java (original)
+++ hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/AuthFastLeaderElection.java Thu Sep  4 10:02:09 2008
@@ -95,7 +95,7 @@
     static public class ToSend {
         static enum mType {
             crequest, challenge, notification, ack
-        };
+        }
 
         ToSend(mType type, long tag, long leader, long zxid, long epoch,
                 ServerState state, InetSocketAddress addr) {
@@ -238,7 +238,7 @@
                     }
                     // Receive new message
                     if (responsePacket.getLength() != responseBytes.length) {
-                        LOG.error("Got a short response: "
+                        LOG.warn("Got a short response: "
                                 + responsePacket.getLength() + " "
                                 + responsePacket.toString());
                         continue;
@@ -246,7 +246,7 @@
                     responseBuffer.clear();
                     int type = responseBuffer.getInt();
                     if ((type > 3) || (type < 0)) {
-                        LOG.error("Got bad Msg type: " + type);
+                        LOG.warn("Got bad Msg type: " + type);
                         continue;
                     }
                     long tag = responseBuffer.getLong();
@@ -314,7 +314,7 @@
                                             tag, current.id,
                                             current.zxid,
                                             logicalclock, self.getPeerState(),
-                                            (InetSocketAddress) addr);
+                                            addr);
 
                                     sendqueue.offer(a);
                                 } else {
@@ -351,8 +351,7 @@
                         acksqueue.offer(tag);
 
                         if (authEnabled) {
-                            addrChallengeMap.get(
-                                    (InetSocketAddress) responsePacket
+                            addrChallengeMap.get(responsePacket
                                             .getSocketAddress()).remove(tag);
                         }
 
@@ -381,7 +380,6 @@
         class WorkerSender implements Runnable {
 
             Random rand;
-            boolean processing;
             int maxAttempts;
             int ackWait = finalizeWait;
 

Modified: hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/CommitProcessor.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/CommitProcessor.java?rev=692164&r1=692163&r2=692164&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/CommitProcessor.java (original)
+++ hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/CommitProcessor.java Thu Sep  4 10:02:09 2008
@@ -54,8 +54,9 @@
         start();
     }
 
-    boolean finished = false;
+    volatile boolean finished = false;
 
+    @Override
     public void run() {
         try {
             Request nextPending = null;
@@ -162,9 +163,9 @@
     }
 
     public void shutdown() {
-        finished = true;
-        queuedRequests.clear();
         synchronized (this) {
+            finished = true;
+            queuedRequests.clear();
             notifyAll();
         }
         nextProcessor.shutdown();

Modified: hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/FastLeaderElection.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/FastLeaderElection.java?rev=692164&r1=692163&r2=692164&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/FastLeaderElection.java (original)
+++ hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/FastLeaderElection.java Thu Sep  4 10:02:09 2008
@@ -112,7 +112,7 @@
      * of reception of notification.
      */
     static public class ToSend {
-    	static enum mType {crequest, challenge, notification, ack};
+    	static enum mType {crequest, challenge, notification, ack}
         
         ToSend(mType type, 
         		long leader, 

Modified: hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/Follower.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/Follower.java?rev=692164&r1=692163&r2=692164&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/Follower.java (original)
+++ hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/Follower.java Thu Sep  4 10:02:09 2008
@@ -205,7 +205,7 @@
                     // Send back the ping with our session data
                     ByteArrayOutputStream bos = new ByteArrayOutputStream();
                     DataOutputStream dos = new DataOutputStream(bos);
-                    HashMap<Long, Integer> touchTable = ((FollowerZooKeeperServer) zk)
+                    HashMap<Long, Integer> touchTable = zk
                             .getTouchSnapshot();
                     for (Entry<Long, Integer> entry : touchTable.entrySet()) {
                         dos.writeLong(entry.getKey());

Modified: hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/FollowerHandler.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/FollowerHandler.java?rev=692164&r1=692163&r2=692164&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/FollowerHandler.java (original)
+++ hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/FollowerHandler.java Thu Sep  4 10:02:09 2008
@@ -176,6 +176,7 @@
      * This thread will receive packets from the follower and process them and
      * also listen to new connections from new followers.
      */
+    @Override
     public void run() {
         try {
 

Modified: hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/FollowerRequestProcessor.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/FollowerRequestProcessor.java?rev=692164&r1=692163&r2=692164&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/FollowerRequestProcessor.java (original)
+++ hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/FollowerRequestProcessor.java Thu Sep  4 10:02:09 2008
@@ -50,6 +50,7 @@
         start();
     }
 
+    @Override
     public void run() {
         try {
             while (!finished) {

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=692164&r1=692163&r2=692164&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 Thu Sep  4 10:02:09 2008
@@ -72,11 +72,13 @@
         return self.follower;
     }
     
+    @Override
     protected void createSessionTracker() {
         sessionTracker = new FollowerSessionTracker(this, sessionsWithTimeouts,
                 self.getId());
     }
 
+    @Override
     protected void setupRequestProcessors() {
         RequestProcessor finalProcessor = new FinalRequestProcessor(this);
         commitProcessor = new CommitProcessor(finalProcessor);
@@ -160,6 +162,7 @@
         //do nothing
     }
     
+    @Override
     public void shutdown() {
         try {
             super.shutdown();

Modified: hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/Leader.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/Leader.java?rev=692164&r1=692163&r2=692164&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/Leader.java (original)
+++ hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/Leader.java Thu Sep  4 10:02:09 2008
@@ -49,6 +49,7 @@
 
         public Request request;
 
+        @Override
         public String toString() {
             return packet.getType() + ", " + packet.getZxid() + ", " + request;
         }
@@ -217,6 +218,7 @@
         }
         outstandingProposals.add(newLeaderProposal);
         new Thread() {
+            @Override
             public void run() {
                 try {
                     while (true) {
@@ -226,7 +228,7 @@
                         new FollowerHandler(s, Leader.this);
                     }
                 } catch (Exception e) {
-                    // 
+                    LOG.warn("Exception while accepting follower", e);
                 }
             }
         }.start();

Modified: hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/LeaderElection.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/LeaderElection.java?rev=692164&r1=692163&r2=692164&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/LeaderElection.java (original)
+++ hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/LeaderElection.java Thu Sep  4 10:02:09 2008
@@ -76,7 +76,7 @@
         for (Vote v : votesCast) {
             Integer count = countTable.get(v);
             if (count == null) {
-                count = new Integer(0);
+                count = Integer.valueOf(0);
             }
             countTable.put(v, count + 1);
             if (v.id == result.vote.id) {

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=692164&r1=692163&r2=692164&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 Thu Sep  4 10:02:09 2008
@@ -54,6 +54,7 @@
         return self.leader;
     }
     
+    @Override
     protected void setupRequestProcessors() {
         RequestProcessor finalProcessor = new FinalRequestProcessor(this);
         RequestProcessor toBeAppliedProcessor = new Leader.ToBeAppliedRequestProcessor(
@@ -69,6 +70,7 @@
         return super.getGlobalOutstandingLimit() / (self.getQuorumSize() - 1);
     }
     
+    @Override
     protected void createSessionTracker() {
         sessionTracker = new SessionTrackerImpl(this, sessionsWithTimeouts,
                 tickTime, self.getId());

Modified: hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java?rev=692164&r1=692163&r2=692164&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java (original)
+++ hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java Thu Sep  4 10:02:09 2008
@@ -51,7 +51,7 @@
  * 
  */
 
-class QuorumCnxManager extends Thread {
+class QuorumCnxManager {
     private static final Logger LOG = Logger.getLogger(QuorumCnxManager.class);
 
     /*
@@ -108,7 +108,7 @@
      */
     Listener listener;
 
-    class Message {
+    static class Message {
         Message(ByteBuffer buffer, InetAddress addr) {
             this.buffer = buffer;
             this.addr = addr;
@@ -441,6 +441,7 @@
         /**
          * Sleeps on accept().
          */
+        @Override
         public void run() {
             ServerSocketChannel ss = null;
             try {
@@ -511,6 +512,7 @@
             return running;
         }
 
+        @Override
         public void run() {
 
             while (running && !shutdown) {
@@ -563,7 +565,6 @@
      * Thread to receive messages. Instance waits on a socket read. If the
      * channel breaks, then removes itself from the pool of receivers.
      */
-
     class RecvWorker extends Thread {
         InetAddress addr;
         SocketChannel channel;
@@ -580,6 +581,7 @@
             return running;
         }
 
+        @Override
         public void run() {
             try {
                 byte[] size = new byte[4];

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=692164&r1=692163&r2=692164&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 Thu Sep  4 10:02:09 2008
@@ -161,6 +161,7 @@
             super("ResponderThread");
         }
 
+        @Override
         public void run() {
             try {
                 byte b[] = new byte[36];
@@ -289,7 +290,7 @@
                 udpSocket = new DatagramSocket(myQuorumAddr.getPort());
                 new ResponderThread().start();
             } catch (SocketException e) {
-                new RuntimeException(e);
+                throw new RuntimeException(e);
             }
         }
         this.electionAlg = createElectionAlgorithm(electionType);
@@ -368,6 +369,7 @@
         return null;
     }
 
+    @Override
     public void run() {
         /*
          * Main loop

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=692164&r1=692163&r2=692164&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 Sep  4 10:02:09 2008
@@ -62,7 +62,12 @@
                 System.exit(2);
             }
             Properties cfg = new Properties();
-            cfg.load(new FileInputStream(zooCfgFile));
+            FileInputStream zooCfgStream = new FileInputStream(zooCfgFile);
+            try {
+                cfg.load(zooCfgStream);
+            } finally {
+                zooCfgStream.close();
+            }
             ArrayList<QuorumServer> servers = new ArrayList<QuorumServer>();
             String dataDir = null;
             String dataLogDir = null;
@@ -149,7 +154,12 @@
                     System.exit(2);
                 }
                 BufferedReader br = new BufferedReader(new FileReader(myIdFile));
-                String myIdString = br.readLine();
+                String myIdString;
+                try {
+                    myIdString = br.readLine();
+                } finally {
+                    br.close();
+                }
                 try {
                     conf.serverId = Long.parseLong(myIdString);
                 } catch (NumberFormatException e) {
@@ -164,6 +174,7 @@
         }
     }
 
+    @Override
     protected boolean isStandaloneServer(){
         return QuorumPeerConfig.getServers().size() <= 1;
     }

Modified: hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumStats.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumStats.java?rev=692164&r1=692163&r2=692164&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumStats.java (original)
+++ hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumStats.java Thu Sep  4 10:02:09 2008
@@ -48,6 +48,7 @@
         qprovider=newProvider;
     }
     
+    @Override
     public String getServerState(){
         return (qprovider!=null)?qprovider.getServerState():Provider.UNKNOWN_STATE;
     }
@@ -55,6 +56,8 @@
     public String[] getQuorumPeers(){
         return (qprovider!=null)?qprovider.getQuorumPeers():new String[0];
     }
+
+    @Override
     public String toString(){
         StringBuilder sb=new StringBuilder(super.toString());
         String state=getServerState();

Modified: hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/version/util/VerGen.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/version/util/VerGen.java?rev=692164&r1=692163&r2=692164&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/version/util/VerGen.java (original)
+++ hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/version/util/VerGen.java Thu Sep  4 10:02:09 2008
@@ -49,8 +49,9 @@
             System.exit(1);
         }
         File file = new File(pkgdir, TYPE_NAME + ".java");
+        FileWriter w = null;
         try {
-            FileWriter w = new FileWriter(file);
+            w = new FileWriter(file);
             w.write("// Do not edit!\n// File generated by org.apache.zookeeper"
                     + ".version.util.VerGen.\n");
             w.write("package " + PACKAGE_NAME + ";\n\n");
@@ -62,11 +63,19 @@
             w.write("    public static final String BUILD_DATE=\"" + buildDate
                     + "\";\n");
             w.write("}\n");
-            w.close();
         } catch (IOException e) {
             System.out.println("Unable to generate version.Info file: "
                     + e.getMessage());
             System.exit(1);
+        } finally {
+            if (w != null) {
+                try {
+                    w.close();
+                } catch (IOException e) {
+                    System.out.println("Unable to close file writer"
+                            + e.getMessage());
+                }
+            }
         }
     }
 

Modified: hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ClientBase.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ClientBase.java?rev=692164&r1=692163&r2=692164&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ClientBase.java (original)
+++ hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ClientBase.java Thu Sep  4 10:02:09 2008
@@ -333,4 +333,4 @@
             assertEquals("node count not consistent", counts[i-1], counts[i]);
         }
     }
-}
\ No newline at end of file
+}

Modified: hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ClientTest.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ClientTest.java?rev=692164&r1=692163&r2=692164&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ClientTest.java (original)
+++ hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ClientTest.java Thu Sep  4 10:02:09 2008
@@ -40,7 +40,6 @@
 import org.apache.zookeeper.data.Stat;
 import org.apache.zookeeper.proto.WatcherEvent;
 import org.junit.Test;
-
 public class ClientTest extends ClientBase {
     protected static final Logger LOG = Logger.getLogger(ClientTest.class);
 

Modified: hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/SessionTest.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/SessionTest.java?rev=692164&r1=692163&r2=692164&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/SessionTest.java (original)
+++ hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/SessionTest.java Thu Sep  4 10:02:09 2008
@@ -44,7 +44,6 @@
     protected static final Logger LOG = Logger.getLogger(SessionTest.class);
 
     private static final String HOSTPORT = "127.0.0.1:33299";
-
     private NIOServerCnxn.Factory serverFactory;
     
     private CountDownLatch startSignal;

Modified: hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ZooKeeperTestClient.java
URL: http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ZooKeeperTestClient.java?rev=692164&r1=692163&r2=692164&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ZooKeeperTestClient.java (original)
+++ hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ZooKeeperTestClient.java Thu Sep  4 10:02:09 2008
@@ -40,7 +40,7 @@
 public class ZooKeeperTestClient extends TestCase implements Watcher {
   protected String hostPort = "127.0.0.1:22801";
 
-  protected static String dirOnZK = "/test_dir";
+  protected static final String dirOnZK = "/test_dir";
 
   protected String testDirOnZK = dirOnZK + "/" + System.currentTimeMillis();
 



Mime
View raw message