ソースを参照

ZOOKEEPER-1216. Fix more eclipse compiler warnings, also in Tests (Thomas Koch via phunt)

git-svn-id: https://svn.apache.org/repos/asf/zookeeper/trunk@1188523 13f79535-47bb-0310-9956-ffa450edef68
Patrick D. Hunt 13 年 前
コミット
9ac5756b18
40 ファイル変更202 行追加270 行削除
  1. 3 0
      CHANGES.txt
  2. 1 1
      src/java/main/org/apache/zookeeper/JLineZNodeCompletor.java
  3. 1 7
      src/java/main/org/apache/zookeeper/Login.java
  4. 2 3
      src/java/main/org/apache/zookeeper/ZooKeeperMain.java
  5. 0 1
      src/java/main/org/apache/zookeeper/server/ByteBufferOutputStream.java
  6. 0 2
      src/java/main/org/apache/zookeeper/server/PurgeTxnLog.java
  7. 0 1
      src/java/main/org/apache/zookeeper/server/ZooKeeperServerMain.java
  8. 0 1
      src/java/main/org/apache/zookeeper/server/quorum/LearnerHandler.java
  9. 159 157
      src/java/main/org/apache/zookeeper/server/quorum/QuorumPeer.java
  10. 0 1
      src/java/main/org/apache/zookeeper/server/quorum/QuorumPeerMain.java
  11. 0 1
      src/java/systest/org/apache/zookeeper/test/system/BaseSysTest.java
  12. 0 4
      src/java/systest/org/apache/zookeeper/test/system/GenerateLoad.java
  13. 15 14
      src/java/systest/org/apache/zookeeper/test/system/InstanceContainer.java
  14. 2 14
      src/java/systest/org/apache/zookeeper/test/system/InstanceManager.java
  15. 0 2
      src/java/systest/org/apache/zookeeper/test/system/SimpleClient.java
  16. 0 1
      src/java/test/org/apache/zookeeper/TestableZooKeeper.java
  17. 1 0
      src/java/test/org/apache/zookeeper/ZKTestCase.java
  18. 0 5
      src/java/test/org/apache/zookeeper/server/InvalidSnapshotTest.java
  19. 0 1
      src/java/test/org/apache/zookeeper/server/quorum/QuorumPeerMainTest.java
  20. 0 2
      src/java/test/org/apache/zookeeper/server/quorum/QuorumPeerTestBase.java
  21. 0 3
      src/java/test/org/apache/zookeeper/server/quorum/Zab1_0Test.java
  22. 0 4
      src/java/test/org/apache/zookeeper/test/ACLRootTest.java
  23. 0 2
      src/java/test/org/apache/zookeeper/test/ClientTest.java
  24. 2 2
      src/java/test/org/apache/zookeeper/test/CreateModeTest.java
  25. 1 1
      src/java/test/org/apache/zookeeper/test/EventTypeTest.java
  26. 0 2
      src/java/test/org/apache/zookeeper/test/FLELostMessageTest.java
  27. 0 1
      src/java/test/org/apache/zookeeper/test/FLETest.java
  28. 0 2
      src/java/test/org/apache/zookeeper/test/FLEZeroWeightTest.java
  29. 3 4
      src/java/test/org/apache/zookeeper/test/FollowerResyncConcurrencyTest.java
  30. 1 1
      src/java/test/org/apache/zookeeper/test/KeeperStateTest.java
  31. 1 1
      src/java/test/org/apache/zookeeper/test/LENonTerminateTest.java
  32. 1 0
      src/java/test/org/apache/zookeeper/test/LETest.java
  33. 0 3
      src/java/test/org/apache/zookeeper/test/MultiTransactionTest.java
  34. 0 4
      src/java/test/org/apache/zookeeper/test/ObserverHierarchicalQuorumTest.java
  35. 0 4
      src/java/test/org/apache/zookeeper/test/QuorumQuotaTest.java
  36. 0 2
      src/java/test/org/apache/zookeeper/test/QuorumTest.java
  37. 5 5
      src/java/test/org/apache/zookeeper/test/RepeatStartupTest.java
  38. 4 4
      src/java/test/org/apache/zookeeper/test/SessionTest.java
  39. 0 1
      src/java/test/org/apache/zookeeper/test/WatcherTest.java
  40. 0 6
      src/java/test/org/apache/zookeeper/test/ZooKeeperQuotaTest.java

+ 3 - 0
CHANGES.txt

@@ -65,6 +65,9 @@ IMPROVEMENTS:
 
   ZOOKEEPER-1221. Provide accessors for Request.{hdr|txn} (Thomas Koch via phunt)
 
+  ZOOKEEPER-1216. Fix more eclipse compiler warnings, also in Tests
+  (Thomas Koch via phunt)
+
 Release 3.4.0 - 
 
 Non-backward compatible changes:

+ 1 - 1
src/java/main/org/apache/zookeeper/JLineZNodeCompletor.java

@@ -29,7 +29,7 @@ class JLineZNodeCompletor implements Completor {
         this.zk = zk;
     }
 
-    @SuppressWarnings("unchecked")
+    @SuppressWarnings({ "unchecked", "rawtypes" })
     public int complete(String buffer, int cursor, List candidates) {
         // Guarantee that the final token is the one we're expanding
         buffer = buffer.substring(0,cursor);

+ 1 - 7
src/java/main/org/apache/zookeeper/Login.java

@@ -18,7 +18,7 @@
 
 package org.apache.zookeeper;
 
-/** 
+/**
  * This class is responsible for refreshing Kerberos credentials for
  * logins for both Zookeeper client and server.
  * See ZooKeeperSaslServer for server-side usage.
@@ -63,14 +63,12 @@ public class Login {
     private Thread t = null;
     private boolean isKrbTicket = false;
     private boolean isUsingTicketCache = false;
-    private boolean isUsingKeytab = false;
 
     /** Random number generator */
     private static Random rng = new Random();
 
     private LoginContext login = null;
     private String loginContextName = null;
-    private String keytabFile = null;
     private String principal = null;
 
     private long lastLogin = 0;
@@ -103,10 +101,6 @@ public class Login {
                     isUsingTicketCache = true;
                 }
             }
-            if (entry.getOptions().get("keyTab") != null) {
-                keytabFile = (String)entry.getOptions().get("keyTab");
-                isUsingKeytab = true;
-            }
             if (entry.getOptions().get("principal") != null) {
                 principal = (String)entry.getOptions().get("principal");
             }

+ 2 - 3
src/java/main/org/apache/zookeeper/ZooKeeperMain.java

@@ -294,7 +294,6 @@ public class ZooKeeperMain {
       this.zk = zk;
     }
 
-    @SuppressWarnings("unchecked")
     void run() throws KeeperException, IOException, InterruptedException {
         if (cl.getCommand() == null) {
             System.out.println("Welcome to ZooKeeper!");
@@ -302,8 +301,8 @@ public class ZooKeeperMain {
             boolean jlinemissing = false;
             // only use jline if it's in the classpath
             try {
-                Class consoleC = Class.forName("jline.ConsoleReader");
-                Class completorC =
+                Class<?> consoleC = Class.forName("jline.ConsoleReader");
+                Class<?> completorC =
                     Class.forName("org.apache.zookeeper.JLineZNodeCompletor");
 
                 System.out.println("JLine support is enabled");

+ 0 - 1
src/java/main/org/apache/zookeeper/server/ByteBufferOutputStream.java

@@ -22,7 +22,6 @@ import java.io.IOException;
 import java.io.OutputStream;
 import java.nio.ByteBuffer;
 
-import org.apache.jute.BinaryInputArchive;
 import org.apache.jute.BinaryOutputArchive;
 import org.apache.jute.Record;
 

+ 0 - 2
src/java/main/org/apache/zookeeper/server/PurgeTxnLog.java

@@ -28,8 +28,6 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.apache.zookeeper.server.persistence.FileTxnSnapLog;
 import org.apache.zookeeper.server.persistence.Util;
 

+ 0 - 1
src/java/main/org/apache/zookeeper/server/ZooKeeperServerMain.java

@@ -18,7 +18,6 @@
 
 package org.apache.zookeeper.server;
 
-import java.io.File;
 import java.io.IOException;
 
 import javax.management.JMException;

+ 0 - 1
src/java/main/org/apache/zookeeper/server/quorum/LearnerHandler.java

@@ -27,7 +27,6 @@ import java.io.DataOutputStream;
 import java.io.IOException;
 import java.net.Socket;
 import java.nio.ByteBuffer;
-import java.util.LinkedList;
 import java.util.List;
 import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.locks.ReentrantReadWriteLock;

+ 159 - 157
src/java/main/org/apache/zookeeper/server/quorum/QuorumPeer.java

@@ -83,9 +83,9 @@ public class QuorumPeer extends Thread implements QuorumStats.Provider {
     LeaderElectionBean jmxLeaderElectionBean;
     QuorumCnxManager qcm;
 
-    /* ZKDatabase is a top level member of quorumpeer 
+    /* ZKDatabase is a top level member of quorumpeer
      * which will be used in all the zookeeperservers
-     * instantiated later. Also, it is created once on 
+     * instantiated later. Also, it is created once on
      * bootup and only thrown away in case of a truncate
      * message from the leader
      */
@@ -104,7 +104,7 @@ public class QuorumPeer extends Thread implements QuorumStats.Provider {
             this.addr = addr;
             this.electionAddr = null;
         }
-        
+
         public QuorumServer(long id, InetSocketAddress addr,
                     InetSocketAddress electionAddr, LearnerType type) {
             this.id = id;
@@ -112,54 +112,54 @@ public class QuorumPeer extends Thread implements QuorumStats.Provider {
             this.electionAddr = electionAddr;
             this.type = type;
         }
-        
+
         public InetSocketAddress addr;
 
         public InetSocketAddress electionAddr;
-        
+
         public long id;
-        
+
         public LearnerType type = LearnerType.PARTICIPANT;
     }
 
     public enum ServerState {
         LOOKING, FOLLOWING, LEADING, OBSERVING;
     }
-    
+
     /*
      * A peer can either be participating, which implies that it is willing to
      * both vote in instances of consensus and to elect or become a Leader, or
      * it may be observing in which case it isn't.
-     * 
-     * We need this distinction to decide which ServerState to move to when 
-     * conditions change (e.g. which state to become after LOOKING). 
+     *
+     * We need this distinction to decide which ServerState to move to when
+     * conditions change (e.g. which state to become after LOOKING).
      */
     public enum LearnerType {
         PARTICIPANT, OBSERVER;
     }
-    
+
     /*
      * To enable observers to have no identifier, we need a generic identifier
      * at least for QuorumCnxManager. We use the following constant to as the
-     * value of such a generic identifier. 
+     * value of such a generic identifier.
      */
-    
+
     static final long OBSERVER_ID = Long.MAX_VALUE;
 
     /*
      * Record leader election time
      */
     public long start_fle, end_fle;
-    
+
     /*
      * Default value of peer is participant
      */
     private LearnerType learnerType = LearnerType.PARTICIPANT;
-    
+
     public LearnerType getLearnerType() {
         return learnerType;
     }
-    
+
     /**
      * Sets the LearnerType both in the QuorumPeer and in the peerMap
      */
@@ -168,10 +168,10 @@ public class QuorumPeer extends Thread implements QuorumStats.Provider {
         if (quorumPeers.containsKey(this.myid)) {
             this.quorumPeers.get(myid).type = p;
         } else {
-            LOG.error("Setting LearnerType to " + p + " but " + myid 
+            LOG.error("Setting LearnerType to " + p + " but " + myid
                     + " not in QuorumPeers. ");
         }
-        
+
     }
     /**
      * The servers that make up the cluster
@@ -180,13 +180,13 @@ public class QuorumPeer extends Thread implements QuorumStats.Provider {
     public int getQuorumSize(){
         return getVotingView().size();
     }
-    
+
     /**
-     * QuorumVerifier implementation; default (majority). 
+     * QuorumVerifier implementation; default (majority).
      */
-    
+
     private QuorumVerifier quorumConfig;
-    
+
     /**
      * My id
      */
@@ -204,14 +204,14 @@ public class QuorumPeer extends Thread implements QuorumStats.Provider {
      * This is who I think the leader currently is.
      */
     volatile private Vote currentVote;
-        
+
     public synchronized Vote getCurrentVote(){
         return currentVote;
     }
-       
+
     public synchronized void setCurrentVote(Vote v){
         currentVote = v;
-    }    
+    }
 
     volatile boolean running = true;
 
@@ -251,8 +251,8 @@ public class QuorumPeer extends Thread implements QuorumStats.Provider {
     /**
      * @deprecated As of release 3.4.0, this class has been deprecated, since
      * it is used with one of the udp-based versions of leader election, which
-     * we are also deprecating. 
-     * 
+     * we are also deprecating.
+     *
      * This class simply responds to requests for the current leader of this
      * node.
      * <p>
@@ -270,7 +270,7 @@ public class QuorumPeer extends Thread implements QuorumStats.Provider {
         }
 
         volatile boolean running = true;
-        
+
         @Override
         public void run() {
             try {
@@ -316,7 +316,7 @@ public class QuorumPeer extends Thread implements QuorumStats.Provider {
                             break;
                         case OBSERVING:
                             // Do nothing, Observers keep themselves to
-                            // themselves. 
+                            // themselves.
                             break;
                         }
                         packet.setData(b);
@@ -360,30 +360,30 @@ public class QuorumPeer extends Thread implements QuorumStats.Provider {
     private FileTxnSnapLog logFactory = null;
 
     private final QuorumStats quorumStats;
-    
+
     public QuorumPeer() {
         super("QuorumPeer");
         quorumStats = new QuorumStats(this);
     }
-    
-   
+
+
     /**
      * For backward compatibility purposes, we instantiate QuorumMaj by default.
      */
-    
+
     public QuorumPeer(Map<Long, QuorumServer> quorumPeers, File dataDir,
             File dataLogDir, int electionType,
             long myid, int tickTime, int initLimit, int syncLimit,
             ServerCnxnFactory cnxnFactory) throws IOException {
-        this(quorumPeers, dataDir, dataLogDir, electionType, myid, tickTime, 
-        		initLimit, syncLimit, cnxnFactory, 
-        		new QuorumMaj(countParticipants(quorumPeers)));
+        this(quorumPeers, dataDir, dataLogDir, electionType, myid, tickTime,
+                initLimit, syncLimit, cnxnFactory,
+                new QuorumMaj(countParticipants(quorumPeers)));
     }
-    
+
     public QuorumPeer(Map<Long, QuorumServer> quorumPeers, File dataDir,
             File dataLogDir, int electionType,
             long myid, int tickTime, int initLimit, int syncLimit,
-            ServerCnxnFactory cnxnFactory, 
+            ServerCnxnFactory cnxnFactory,
             QuorumVerifier quorumConfig) throws IOException {
         this();
         this.cnxnFactory = cnxnFactory;
@@ -392,79 +392,79 @@ public class QuorumPeer extends Thread implements QuorumStats.Provider {
         this.myid = myid;
         this.tickTime = tickTime;
         this.initLimit = initLimit;
-        this.syncLimit = syncLimit;        
+        this.syncLimit = syncLimit;
         this.logFactory = new FileTxnSnapLog(dataLogDir, dataDir);
         this.zkDb = new ZKDatabase(this.logFactory);
         if(quorumConfig == null)
             this.quorumConfig = new QuorumMaj(countParticipants(quorumPeers));
         else this.quorumConfig = quorumConfig;
     }
-    
+
     QuorumStats quorumStats() {
         return quorumStats;
     }
-    
+
     @Override
     public synchronized void start() {
         loadDataBase();
-        cnxnFactory.start();        
+        cnxnFactory.start();
         startLeaderElection();
         super.start();
     }
 
-	private void loadDataBase() {
-		try {
+    private void loadDataBase() {
+        try {
             zkDb.loadDataBase();
 
             // load the epochs
             long lastProcessedZxid = zkDb.getDataTree().lastProcessedZxid;
-    		long epochOfZxid = ZxidUtils.getEpochFromZxid(lastProcessedZxid);
+            long epochOfZxid = ZxidUtils.getEpochFromZxid(lastProcessedZxid);
             try {
-            	currentEpoch = readLongFromFile(CURRENT_EPOCH_FILENAME);
+                currentEpoch = readLongFromFile(CURRENT_EPOCH_FILENAME);
             } catch(FileNotFoundException e) {
-            	// pick a reasonable epoch number
-            	// this should only happen once when moving to a
-            	// new code version
-            	LOG.info(CURRENT_EPOCH_FILENAME + " not found! Creating with a reasonable default. This should only happen when you are upgrading your installation");
-            	currentEpoch = epochOfZxid;
-            	writeLongToFile(CURRENT_EPOCH_FILENAME, currentEpoch);
+                // pick a reasonable epoch number
+                // this should only happen once when moving to a
+                // new code version
+                LOG.info(CURRENT_EPOCH_FILENAME + " not found! Creating with a reasonable default. This should only happen when you are upgrading your installation");
+                currentEpoch = epochOfZxid;
+                writeLongToFile(CURRENT_EPOCH_FILENAME, currentEpoch);
             }
             if (epochOfZxid > currentEpoch) {
-            	throw new IOException("The current epoch, " + ZxidUtils.zxidToString(currentEpoch) + ", is older than the last zxid, " + lastProcessedZxid);
+                throw new IOException("The current epoch, " + ZxidUtils.zxidToString(currentEpoch) + ", is older than the last zxid, " + lastProcessedZxid);
             }
             try {
-            	acceptedEpoch = readLongFromFile(ACCEPTED_EPOCH_FILENAME);
+                acceptedEpoch = readLongFromFile(ACCEPTED_EPOCH_FILENAME);
             } catch(FileNotFoundException e) {
-            	// pick a reasonable epoch number
-            	// this should only happen once when moving to a
-            	// new code version
-            	LOG.info(ACCEPTED_EPOCH_FILENAME + " not found! Creating with a reasonable default. This should only happen when you are upgrading your installation");
-            	acceptedEpoch = epochOfZxid;
-            	writeLongToFile(CURRENT_EPOCH_FILENAME, acceptedEpoch);
+                // pick a reasonable epoch number
+                // this should only happen once when moving to a
+                // new code version
+                LOG.info(ACCEPTED_EPOCH_FILENAME + " not found! Creating with a reasonable default. This should only happen when you are upgrading your installation");
+                acceptedEpoch = epochOfZxid;
+                writeLongToFile(CURRENT_EPOCH_FILENAME, acceptedEpoch);
             }
             if (acceptedEpoch < currentEpoch) {
-            	throw new IOException("The current epoch, " + ZxidUtils.zxidToString(currentEpoch) + " is less than the accepted epoch, " + ZxidUtils.zxidToString(acceptedEpoch));
+                throw new IOException("The current epoch, " + ZxidUtils.zxidToString(currentEpoch) + " is less than the accepted epoch, " + ZxidUtils.zxidToString(acceptedEpoch));
             }
         } catch(IOException ie) {
             LOG.error("Unable to load database on disk", ie);
             throw new RuntimeException("Unable to run quorum server ", ie);
         }
-	}
+    }
 
     ResponderThread responder;
-    
+
     synchronized public void stopLeaderElection() {
         responder.running = false;
         responder.interrupt();
     }
     synchronized public void startLeaderElection() {
-    	try {
-    		currentVote = new Vote(myid, getLastLoggedZxid(), getCurrentEpoch());
-    	} catch(IOException e) {
-    		RuntimeException re = new RuntimeException(e.getMessage());
-    		re.setStackTrace(e.getStackTrace());
-    		throw re;
-    	}
+        try {
+            currentVote = new Vote(myid, getLastLoggedZxid(), getCurrentEpoch());
+        } catch(IOException e) {
+            RuntimeException re = new RuntimeException(e.getMessage());
+            re.setStackTrace(e.getStackTrace());
+            throw re;
+        }
         for (QuorumServer p : getView().values()) {
             if (p.id == myid) {
                 myQuorumAddr = p.addr;
@@ -485,7 +485,7 @@ public class QuorumPeer extends Thread implements QuorumStats.Provider {
         }
         this.electionAlg = createElectionAlgorithm(electionType);
     }
-    
+
     /**
      * Count the number of nodes in the map that could be followers.
      * @param peers
@@ -500,7 +500,7 @@ public class QuorumPeer extends Thread implements QuorumStats.Provider {
       }
       return count;
     }
-    
+
     /**
      * This constructor is only used by the existing unit test code.
      * It defaults to FileLogProvider persistence provider.
@@ -515,14 +515,14 @@ public class QuorumPeer extends Thread implements QuorumStats.Provider {
                 ServerCnxnFactory.createFactory(new InetSocketAddress(clientPort), -1),
                 new QuorumMaj(countParticipants(quorumPeers)));
     }
-    
+
     /**
      * This constructor is only used by the existing unit test code.
      * It defaults to FileLogProvider persistence provider.
      */
     public QuorumPeer(Map<Long,QuorumServer> quorumPeers, File snapDir,
             File logDir, int clientPort, int electionAlg,
-            long myid, int tickTime, int initLimit, int syncLimit, 
+            long myid, int tickTime, int initLimit, int syncLimit,
             QuorumVerifier quorumConfig)
         throws IOException
     {
@@ -531,41 +531,42 @@ public class QuorumPeer extends Thread implements QuorumStats.Provider {
                 ServerCnxnFactory.createFactory(new InetSocketAddress(clientPort), -1),
                 quorumConfig);
     }
-    
+
     /**
      * returns the highest zxid that this host has seen
-     * 
+     *
      * @return the highest zxid for this host
      */
     public long getLastLoggedZxid() {
         if (!zkDb.isInitialized()) {
-        	loadDataBase();
+            loadDataBase();
         }
         return zkDb.getDataTreeLastProcessedZxid();
     }
-    
+
     public Follower follower;
     public Leader leader;
     public Observer observer;
 
     protected Follower makeFollower(FileTxnSnapLog logFactory) throws IOException {
-        return new Follower(this, new FollowerZooKeeperServer(logFactory, 
+        return new Follower(this, new FollowerZooKeeperServer(logFactory,
                 this,new ZooKeeperServer.BasicDataTreeBuilder(), this.zkDb));
     }
-     
+
     protected Leader makeLeader(FileTxnSnapLog logFactory) throws IOException {
         return new Leader(this, new LeaderZooKeeperServer(logFactory,
                 this,new ZooKeeperServer.BasicDataTreeBuilder(), this.zkDb));
     }
-    
+
     protected Observer makeObserver(FileTxnSnapLog logFactory) throws IOException {
         return new Observer(this, new ObserverZooKeeperServer(logFactory,
                 this, new ZooKeeperServer.BasicDataTreeBuilder(), this.zkDb));
     }
 
+    @SuppressWarnings("deprecation")
     protected Election createElectionAlgorithm(int electionAlgorithm){
         Election le=null;
-                
+
         //TODO: use a factory rather than a switch
         switch (electionAlgorithm) {
         case 0:
@@ -593,11 +594,12 @@ public class QuorumPeer extends Thread implements QuorumStats.Provider {
         return le;
     }
 
+    @SuppressWarnings("deprecation")
     protected Election makeLEStrategy(){
         LOG.debug("Initializing leader election protocol...");
         if (getElectionType() == 0) {
             electionAlg = new LeaderElection(this);
-        }        
+        }
         return electionAlg;
     }
 
@@ -608,7 +610,7 @@ public class QuorumPeer extends Thread implements QuorumStats.Provider {
     synchronized protected void setFollower(Follower newFollower){
         follower=newFollower;
     }
-    
+
     synchronized protected void setObserver(Observer newObserver){
         observer=newObserver;
     }
@@ -709,7 +711,7 @@ public class QuorumPeer extends Thread implements QuorumStats.Provider {
                         setObserver(makeObserver(logFactory));
                         observer.observeLeader();
                     } catch (Exception e) {
-                        LOG.warn("Unexpected exception",e );                        
+                        LOG.warn("Unexpected exception",e );
                     } finally {
                         observer.shutdown();
                         setObserver(null);
@@ -771,57 +773,57 @@ public class QuorumPeer extends Thread implements QuorumStats.Provider {
         if(udpSocket != null) {
             udpSocket.close();
         }
-        
+
         if(getElectionAlg() != null){
             this.interrupt();
-        	getElectionAlg().shutdown();
+            getElectionAlg().shutdown();
         }
         try {
             zkDb.close();
         } catch (IOException ie) {
             LOG.warn("Error closing logs ", ie);
-        }     
+        }
     }
 
     /**
      * A 'view' is a node's current opinion of the membership of the entire
-     * ensemble.    
+     * ensemble.
      */
     public Map<Long,QuorumPeer.QuorumServer> getView() {
         return Collections.unmodifiableMap(this.quorumPeers);
     }
-    
+
     /**
-     * Observers are not contained in this view, only nodes with 
-     * PeerType=PARTICIPANT.     
+     * Observers are not contained in this view, only nodes with
+     * PeerType=PARTICIPANT.
      */
     public Map<Long,QuorumPeer.QuorumServer> getVotingView() {
-        Map<Long,QuorumPeer.QuorumServer> ret = 
+        Map<Long,QuorumPeer.QuorumServer> ret =
             new HashMap<Long, QuorumPeer.QuorumServer>();
         Map<Long,QuorumPeer.QuorumServer> view = getView();
-        for (QuorumServer server : view.values()) {            
+        for (QuorumServer server : view.values()) {
             if (server.type == LearnerType.PARTICIPANT) {
                 ret.put(server.id, server);
             }
-        }        
+        }
         return ret;
     }
-    
+
     /**
      * Returns only observers, no followers.
      */
     public Map<Long,QuorumPeer.QuorumServer> getObservingView() {
-        Map<Long,QuorumPeer.QuorumServer> ret = 
+        Map<Long,QuorumPeer.QuorumServer> ret =
             new HashMap<Long, QuorumPeer.QuorumServer>();
         Map<Long,QuorumPeer.QuorumServer> view = getView();
-        for (QuorumServer server : view.values()) {            
+        for (QuorumServer server : view.values()) {
             if (server.type == LearnerType.OBSERVER) {
                 ret.put(server.id, server);
             }
-        }        
+        }
         return ret;
     }
-    
+
     /**
      * Check if a node is in the current view. With static membership, the
      * result of this check will never change; only when dynamic membership
@@ -830,7 +832,7 @@ public class QuorumPeer extends Thread implements QuorumStats.Provider {
     public boolean viewContains(Long sid) {
         return this.quorumPeers.containsKey(sid);
     }
-    
+
     /**
      * Only used by QuorumStats at the moment
      */
@@ -909,7 +911,7 @@ public class QuorumPeer extends Thread implements QuorumStats.Provider {
         }
         return fac.getMaxClientCnxnsPerHost();
     }
-    
+
     /** minimum session timeout in milliseconds */
     public int getMinSessionTimeout() {
         return minSessionTimeout == -1 ? tickTime * 2 : minSessionTimeout;
@@ -953,28 +955,28 @@ public class QuorumPeer extends Thread implements QuorumStats.Provider {
     public int getTick() {
         return tick;
     }
-    
+
     /**
      * Return QuorumVerifier object
      */
-    
+
     public QuorumVerifier getQuorumVerifier(){
         return quorumConfig;
-        
+
     }
-    
+
     public void setQuorumVerifier(QuorumVerifier quorumConfig){
        this.quorumConfig = quorumConfig;
     }
-    
+
     /**
      * Get an instance of LeaderElection
      */
-        
+
     public Election getElectionAlg(){
         return electionAlg;
     }
-        
+
     /**
      * Get the synclimit
      */
@@ -1021,11 +1023,11 @@ public class QuorumPeer extends Thread implements QuorumStats.Provider {
 
     public void setClientPortAddress(InetSocketAddress addr) {
     }
- 
+
     public void setTxnFactory(FileTxnSnapLog factory) {
         this.logFactory = factory;
     }
-    
+
     public FileTxnSnapLog getTxnFactory() {
         return this.logFactory;
     }
@@ -1053,61 +1055,61 @@ public class QuorumPeer extends Thread implements QuorumStats.Provider {
         return qcm;
     }
     private long readLongFromFile(String name) throws IOException {
-    	File file = new File(logFactory.getSnapDir(), name);
-		BufferedReader br = new BufferedReader(new FileReader(file));
-		String line = "";
-		try {
-			line = br.readLine();
-    		return Long.parseLong(line);
-    	} catch(NumberFormatException e) {
-    		throw new IOException("Found " + line + " in " + file);
-    	} finally {
-    		br.close();
-    	}
+        File file = new File(logFactory.getSnapDir(), name);
+        BufferedReader br = new BufferedReader(new FileReader(file));
+        String line = "";
+        try {
+            line = br.readLine();
+            return Long.parseLong(line);
+        } catch(NumberFormatException e) {
+            throw new IOException("Found " + line + " in " + file);
+        } finally {
+            br.close();
+        }
     }
 
     private long acceptedEpoch = -1;
     private long currentEpoch = -1;
 
-	public static final String CURRENT_EPOCH_FILENAME = "currentEpoch";
+    public static final String CURRENT_EPOCH_FILENAME = "currentEpoch";
 
-	public static final String ACCEPTED_EPOCH_FILENAME = "acceptedEpoch";
+    public static final String ACCEPTED_EPOCH_FILENAME = "acceptedEpoch";
 
     private void writeLongToFile(String name, long value) throws IOException {
-    	File file = new File(logFactory.getSnapDir(), name);
-		FileOutputStream out = new FileOutputStream(file);
-		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(out));
-    	try {
-    		bw.write(Long.toString(value));
-    		bw.flush();
-    		out.getFD().sync();
-    	} finally {
-    		bw.close();
-    	}
+        File file = new File(logFactory.getSnapDir(), name);
+        FileOutputStream out = new FileOutputStream(file);
+        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(out));
+        try {
+            bw.write(Long.toString(value));
+            bw.flush();
+            out.getFD().sync();
+        } finally {
+            bw.close();
+        }
     }
 
     public long getCurrentEpoch() throws IOException {
-		if (currentEpoch == -1) {
-			currentEpoch = readLongFromFile(CURRENT_EPOCH_FILENAME);
-		}
-		return currentEpoch;
-	}
-	
-	public long getAcceptedEpoch() throws IOException {
-		if (acceptedEpoch == -1) {
-			acceptedEpoch = readLongFromFile(ACCEPTED_EPOCH_FILENAME);
-		}
-		return acceptedEpoch;
-	}
-	
-	public void setCurrentEpoch(long e) throws IOException {
-		currentEpoch = e;
-		writeLongToFile(CURRENT_EPOCH_FILENAME, e);
-		
-	}
-	
-	public void setAcceptedEpoch(long e) throws IOException {
-		acceptedEpoch = e;
-		writeLongToFile(ACCEPTED_EPOCH_FILENAME, e);
-	}
+        if (currentEpoch == -1) {
+            currentEpoch = readLongFromFile(CURRENT_EPOCH_FILENAME);
+        }
+        return currentEpoch;
+    }
+
+    public long getAcceptedEpoch() throws IOException {
+        if (acceptedEpoch == -1) {
+            acceptedEpoch = readLongFromFile(ACCEPTED_EPOCH_FILENAME);
+        }
+        return acceptedEpoch;
+    }
+
+    public void setCurrentEpoch(long e) throws IOException {
+        currentEpoch = e;
+        writeLongToFile(CURRENT_EPOCH_FILENAME, e);
+
+    }
+
+    public void setAcceptedEpoch(long e) throws IOException {
+        acceptedEpoch = e;
+        writeLongToFile(ACCEPTED_EPOCH_FILENAME, e);
+    }
 }

+ 0 - 1
src/java/main/org/apache/zookeeper/server/quorum/QuorumPeerMain.java

@@ -17,7 +17,6 @@
  */
 package org.apache.zookeeper.server.quorum;
 
-import java.io.File;
 import java.io.IOException;
 
 import javax.management.JMException;

+ 0 - 1
src/java/systest/org/apache/zookeeper/test/system/BaseSysTest.java

@@ -52,7 +52,6 @@ public class BaseSysTest extends TestCase {
     @Override
     protected void setUp() throws Exception {
         if (!fakeMachines) {
-            String localHost = InetAddress.getLocalHost().getCanonicalHostName();
             zk = new ZooKeeper(zkHostPort, 15000, new Watcher() {public void process(WatchedEvent e){}});
             im = new InstanceManager(zk, prefix);
         }

+ 0 - 4
src/java/systest/org/apache/zookeeper/test/system/GenerateLoad.java

@@ -541,10 +541,6 @@ public class GenerateLoad {
             }
         }
 
-        public boolean isConnected() {
-            return connected;
-        }
-
         synchronized public boolean waitConnected(long timeout)
                 throws InterruptedException {
             long endTime = System.currentTimeMillis() + timeout;

+ 15 - 14
src/java/systest/org/apache/zookeeper/test/system/InstanceContainer.java

@@ -42,7 +42,7 @@ import org.apache.zookeeper.data.Stat;
 import org.apache.zookeeper.test.system.Instance.Reporter;
 
 /**
- * This class starts up, 
+ * This class starts up,
  */
 public class InstanceContainer implements Watcher, AsyncCallback.ChildrenCallback {
     private final class MyWatcher implements Watcher {
@@ -105,7 +105,7 @@ public class InstanceContainer implements Watcher, AsyncCallback.ChildrenCallbac
             }
         }
     }
-    private static final Logger LOG = LoggerFactory.getLogger(InstanceContainer.class); 
+    private static final Logger LOG = LoggerFactory.getLogger(InstanceContainer.class);
     String name;
     String zkHostPort;
     // We only run if the readyNode exists
@@ -127,7 +127,7 @@ public class InstanceContainer implements Watcher, AsyncCallback.ChildrenCallbac
         this.reportsNode = prefix + '/' + this.reportsNode;
         this.assignmentsNode = prefix + '/' + this.assignmentsNode + '/' + name;
     }
-    
+
     private void rmnod(String path) throws InterruptedException, KeeperException {
         KeeperException lastException = null;
         for(int i = 0; i < maxTries; i++) {
@@ -168,7 +168,7 @@ public class InstanceContainer implements Watcher, AsyncCallback.ChildrenCallbac
             }
         }
     }
-    
+
     private void mknod(String path, CreateMode mode) throws KeeperException, InterruptedException {
         String subpath[] = path.split("/");
         StringBuilder sb = new StringBuilder();
@@ -183,7 +183,7 @@ public class InstanceContainer implements Watcher, AsyncCallback.ChildrenCallbac
             mknod_inner(sb.toString(), m);
         }
     }
-    
+
     public void run() throws IOException, InterruptedException, KeeperException {
         zk = new ZooKeeper(zkHostPort, sessTimeout, this);
         mknod(assignmentsNode, CreateMode.PERSISTENT);
@@ -192,15 +192,15 @@ public class InstanceContainer implements Watcher, AsyncCallback.ChildrenCallbac
         // Now we just start watching the assignments directory
         zk.getChildren(assignmentsNode, true, this, null);
     }
-    
+
     /**
      * @param args the first parameter is the instance name, the second
      * is the ZooKeeper spec. if the instance name is the empty string
      * or "hostname", the hostname will be used.
-     * @throws InterruptedException 
-     * @throws IOException 
-     * @throws UnknownHostException 
-     * @throws KeeperException 
+     * @throws InterruptedException
+     * @throws IOException
+     * @throws UnknownHostException
+     * @throws KeeperException
      */
     public static void main(String[] args) throws UnknownHostException, IOException, InterruptedException, KeeperException {
         if (args.length != 3) {
@@ -226,8 +226,9 @@ public class InstanceContainer implements Watcher, AsyncCallback.ChildrenCallbac
     }
 
     HashMap<String, Instance> instances = new HashMap<String, Instance>();
-    public void processResult(int rc, String path, Object ctx,
-            List<String> children) {
+
+    @Override
+    public void processResult(int rc, String path, Object ctx, List<String> children) {
         if (rc != KeeperException.Code.OK.intValue()) {
             // try it again
             zk.getChildren(assignmentsNode, true, this, null);
@@ -268,7 +269,7 @@ public class InstanceContainer implements Watcher, AsyncCallback.ChildrenCallbac
                         conf = instanceSpec.substring(spaceIndex+1);
                     }
                     try {
-                        Class c = Class.forName(clazz);
+                        Class<?> c = Class.forName(clazz);
                         i = (Instance)c.newInstance();
                         Reporter reporter = new MyReporter(child);
                         i.setReporter(reporter);
@@ -286,7 +287,7 @@ public class InstanceContainer implements Watcher, AsyncCallback.ChildrenCallbac
                             LOG.warn("Caused by", e.getCause());
                         }
                     }
-                    
+
                 }
             } else {
                 // just move it to the new list

+ 2 - 14
src/java/systest/org/apache/zookeeper/test/system/InstanceManager.java

@@ -62,11 +62,9 @@ public class InstanceManager implements AsyncCallback.ChildrenCallback, Watcher
     private static final int maxTries = 3;
     private static final class Assigned {
         String container;
-        String instance;
         int weight;
-        Assigned(String container, String instance, int weight) {
+        Assigned(String container, int weight) {
             this.container = container;
-            this.instance = instance;
             this.weight = weight;
         }
     }
@@ -159,16 +157,6 @@ public class InstanceManager implements AsyncCallback.ChildrenCallback, Watcher
         }
         assignments = newAssignments;
     }
-    private void removeAssignmentNode(String dead) throws KeeperException, InterruptedException {
-        String deadNode = assignmentsNode + '/' + dead;
-        List<String> children = zk.getChildren(deadNode, false);
-        for(String c: children) {
-            zk.delete(deadNode + '/' + c, -1);
-        }
-        try {
-            zk.delete(deadNode, -1);
-        } catch(NoNodeException e) { /* this is ok */ }
-    }
     
     public void process(WatchedEvent event) {
         if (event.getPath().equals(statusNode)) {
@@ -213,7 +201,7 @@ public class InstanceManager implements AsyncCallback.ChildrenCallback, Watcher
         if (mostIdle == null) {
             throw new NoAvailableContainers("No available containers");
         }
-        Assigned a = new Assigned(mostIdle, name, weight);
+        Assigned a = new Assigned(mostIdle, weight);
         instanceToAssignment.put(name, a);
         HashSet<Assigned> as = assignments.get(mostIdle);
         if (as == null) {

+ 0 - 2
src/java/systest/org/apache/zookeeper/test/system/SimpleClient.java

@@ -18,8 +18,6 @@
 
 package org.apache.zookeeper.test.system;
 
-import java.io.IOException;
-
 import org.apache.zookeeper.AsyncCallback;
 import org.apache.zookeeper.CreateMode;
 import org.apache.zookeeper.WatchedEvent;

+ 0 - 1
src/java/test/org/apache/zookeeper/TestableZooKeeper.java

@@ -20,7 +20,6 @@ package org.apache.zookeeper;
 
 import java.io.IOException;
 import java.net.SocketAddress;
-import java.nio.channels.SocketChannel;
 import java.util.List;
 
 public class TestableZooKeeper extends ZooKeeper {

+ 1 - 0
src/java/test/org/apache/zookeeper/ZKTestCase.java

@@ -32,6 +32,7 @@ import org.junit.runners.model.FrameworkMethod;
  * Basic utilities shared by all tests. Also logging of various events during
  * the test execution (start/stop/success/failure/etc...)
  */
+@SuppressWarnings("deprecation")
 @RunWith(JUnit4ZKTestRunner.class)
 public class ZKTestCase {
     private static final Logger LOG = LoggerFactory.getLogger(ZKTestCase.class);

+ 0 - 5
src/java/test/org/apache/zookeeper/server/InvalidSnapshotTest.java

@@ -21,8 +21,6 @@ package org.apache.zookeeper.server;
 import java.io.File;
 import java.io.RandomAccessFile;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.apache.zookeeper.CreateMode;
 import org.apache.zookeeper.PortAssignment;
 import org.apache.zookeeper.WatchedEvent;
@@ -41,9 +39,6 @@ import org.junit.Test;
  * while generating the snapshot.
  */
 public class InvalidSnapshotTest extends ZKTestCase implements Watcher {
-    private static final Logger LOG =
-        LoggerFactory.getLogger(InvalidSnapshotTest.class);
-
     private static final String HOSTPORT =
         "127.0.0.1:" + PortAssignment.unique();
     private static final int CONNECTION_TIMEOUT = 3000;

+ 0 - 1
src/java/test/org/apache/zookeeper/server/quorum/QuorumPeerMainTest.java

@@ -385,7 +385,6 @@ public class QuorumPeerMainTest extends QuorumPeerTestBase {
 
         try {
             final int CLIENT_PORT_QP1 = PortAssignment.unique();
-            final int CLIENT_PORT_QP2 = PortAssignment.unique();
 
             String quorumCfgSection =
                     "server.1=127.0.0.1:" + PortAssignment.unique()

+ 0 - 2
src/java/test/org/apache/zookeeper/server/quorum/QuorumPeerTestBase.java

@@ -30,8 +30,6 @@ import org.slf4j.LoggerFactory;
 import org.apache.zookeeper.WatchedEvent;
 import org.apache.zookeeper.Watcher;
 import org.apache.zookeeper.ZKTestCase;
-import org.apache.zookeeper.server.ZooKeeperServer;
-import org.apache.zookeeper.server.persistence.FileTxnSnapLog;
 import org.apache.zookeeper.test.ClientBase;
 import org.apache.zookeeper.test.QuorumBase;
 

+ 0 - 3
src/java/test/org/apache/zookeeper/server/quorum/Zab1_0Test.java

@@ -26,7 +26,6 @@ import java.lang.reflect.Field;
 import java.net.InetSocketAddress;
 import java.net.ServerSocket;
 import java.net.Socket;
-import java.net.SocketAddress;
 import java.nio.ByteBuffer;
 import java.util.HashMap;
 
@@ -34,7 +33,6 @@ import org.apache.jute.BinaryInputArchive;
 import org.apache.jute.BinaryOutputArchive;
 import org.apache.jute.InputArchive;
 import org.apache.jute.OutputArchive;
-import org.apache.zookeeper.ZKUtil;
 import org.apache.zookeeper.server.ByteBufferOutputStream;
 import org.apache.zookeeper.server.DataTree;
 import org.apache.zookeeper.server.ServerCnxn;
@@ -47,7 +45,6 @@ import org.apache.zookeeper.server.quorum.Leader;
 import org.apache.zookeeper.server.quorum.LearnerInfo;
 import org.apache.zookeeper.server.quorum.QuorumPacket;
 import org.apache.zookeeper.server.quorum.QuorumPeer.QuorumServer;
-import org.apache.zookeeper.server.quorum.Zab1_0Test.LeaderConversation;
 import org.apache.zookeeper.server.quorum.flexible.QuorumMaj;
 import org.apache.zookeeper.server.util.ZxidUtils;
 import org.junit.Assert;

+ 0 - 4
src/java/test/org/apache/zookeeper/test/ACLRootTest.java

@@ -18,8 +18,6 @@
 
 package org.apache.zookeeper.test;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.apache.zookeeper.CreateMode;
 import org.apache.zookeeper.KeeperException;
 import org.apache.zookeeper.ZooKeeper;
@@ -28,8 +26,6 @@ import org.junit.Assert;
 import org.junit.Test;
 
 public class ACLRootTest extends ClientBase {
-    private static final Logger LOG = LoggerFactory.getLogger(ACLRootTest.class);
-
     @Test
     public void testRootAcl() throws Exception {
         ZooKeeper zk = createClient();

+ 0 - 2
src/java/test/org/apache/zookeeper/test/ClientTest.java

@@ -26,8 +26,6 @@ import java.util.Collections;
 import java.util.List;
 import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.TimeUnit;
-import java.util.logging.Level;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.apache.zookeeper.CreateMode;

+ 2 - 2
src/java/test/org/apache/zookeeper/test/CreateModeTest.java

@@ -65,14 +65,14 @@ public class CreateModeTest extends ZKTestCase {
     @Test
     public void testInvalidFlagConversion() throws KeeperException {
         try {
-            CreateMode cm = CreateMode.fromFlag(99);
+            CreateMode.fromFlag(99);
             Assert.fail("Shouldn't be able to convert 99 to a CreateMode.");
         } catch(KeeperException ke) {
             Assert.assertEquals(Code.BADARGUMENTS, ke.code());
         }
 
         try {
-            CreateMode cm = CreateMode.fromFlag(-1);
+            CreateMode.fromFlag(-1);
             Assert.fail("Shouldn't be able to convert -1 to a CreateMode.");
         } catch(KeeperException ke) {
             Assert.assertEquals(Code.BADARGUMENTS, ke.code());

+ 1 - 1
src/java/test/org/apache/zookeeper/test/EventTypeTest.java

@@ -40,7 +40,7 @@ public class EventTypeTest extends ZKTestCase {
     @Test
     public void testInvalidIntConversion() {
         try {
-            EventType et = EventType.fromInt(324242);
+            EventType.fromInt(324242);
             Assert.fail("Was able to create an invalid EventType via an integer");
         } catch(RuntimeException re) {
             // we're good.

+ 0 - 2
src/java/test/org/apache/zookeeper/test/FLELostMessageTest.java

@@ -28,7 +28,6 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.apache.zookeeper.PortAssignment;
 import org.apache.zookeeper.ZKTestCase;
-import org.apache.zookeeper.server.quorum.FastLeaderElection;
 import org.apache.zookeeper.server.quorum.QuorumCnxManager;
 import org.apache.zookeeper.server.quorum.QuorumPeer;
 import org.apache.zookeeper.server.quorum.Vote;
@@ -77,7 +76,6 @@ public class FLELostMessageTest extends ZKTestCase {
         }
 
         public void run(){
-            boolean flag = true;
             try{
                 Vote v = null;
                 peer.setPeerState(ServerState.LOOKING);

+ 0 - 1
src/java/test/org/apache/zookeeper/test/FLETest.java

@@ -259,7 +259,6 @@ public class FLETest extends ZKTestCase {
 
         FastLeaderElection le[] = new FastLeaderElection[count];
         leaderDies = true;
-        boolean allowOneBadLeader = leaderDies;
 
         LOG.info("TestLE: " + getTestName()+ ", " + count);
         for(int i = 0; i < count; i++) {

+ 0 - 2
src/java/test/org/apache/zookeeper/test/FLEZeroWeightTest.java

@@ -23,8 +23,6 @@ import java.net.InetSocketAddress;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Properties;
-import java.util.Random;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.apache.zookeeper.PortAssignment;

+ 3 - 4
src/java/test/org/apache/zookeeper/test/FollowerResyncConcurrencyTest.java

@@ -24,7 +24,6 @@ import static org.junit.Assert.assertTrue;
 
 import java.io.IOException;
 import java.util.Collection;
-import java.util.HashSet;
 import java.util.Set;
 import java.util.concurrent.Semaphore;
 import java.util.concurrent.TimeUnit;
@@ -366,14 +365,14 @@ public class FollowerResyncConcurrencyTest extends ZKTestCase {
         ZKDatabase lead = qu.getPeer(leaderIndex).peer.getActiveServer().getZKDatabase();
         for(Long l : sessionsRestarted) {
             assertTrue("Should have same set of sessions in both servers, did not expect: " + l, sessionsNotRestarted.contains(l));
-            Set ephemerals = restarted.getEphemerals(l);
-            Set cleanEphemerals = clean.getEphemerals(l);
+            Set<String> ephemerals = restarted.getEphemerals(l);
+            Set<String> cleanEphemerals = clean.getEphemerals(l);
             for(Object o : cleanEphemerals) {
                 if(!ephemerals.contains(o)) {
                     LOG.info("Restarted follower doesn't contain ephemeral " + o);
                 }
             }
-            Set leadEphemerals = lead.getEphemerals(l);
+            Set<String> leadEphemerals = lead.getEphemerals(l);
             for(Object o : leadEphemerals) {
                 if(!cleanEphemerals.contains(o)) {
                     LOG.info("Follower doesn't contain ephemeral from leader " + o);

+ 1 - 1
src/java/test/org/apache/zookeeper/test/KeeperStateTest.java

@@ -41,7 +41,7 @@ public class KeeperStateTest extends ZKTestCase {
     @Test
     public void testInvalidIntConversion() {
         try {
-            KeeperState ks = KeeperState.fromInt(324142);
+            KeeperState.fromInt(324142);
             Assert.fail("Was able to create an invalid KeeperState via an integer");
         } catch(RuntimeException re) {
             // we're good.

+ 1 - 1
src/java/test/org/apache/zookeeper/test/LENonTerminateTest.java

@@ -25,7 +25,6 @@ import java.net.DatagramSocket;
 import java.net.InetSocketAddress;
 import java.net.SocketException;
 import java.nio.ByteBuffer;
-import java.util.Collection;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
@@ -49,6 +48,7 @@ import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 
+@SuppressWarnings("deprecation")
 public class LENonTerminateTest extends ZKTestCase {
     public static class MockLeaderElection extends LeaderElection {
         public MockLeaderElection(QuorumPeer self) {

+ 1 - 0
src/java/test/org/apache/zookeeper/test/LETest.java

@@ -35,6 +35,7 @@ import org.apache.zookeeper.server.quorum.QuorumPeer.QuorumServer;
 import org.junit.Assert;
 import org.junit.Test;
 
+@SuppressWarnings("deprecation")
 public class LETest extends ZKTestCase {
     private static final Logger LOG = LoggerFactory.getLogger(LETest.class);
     volatile Vote votes[];

+ 0 - 3
src/java/test/org/apache/zookeeper/test/MultiTransactionTest.java

@@ -30,13 +30,10 @@ import org.junit.Before;
 import org.junit.Test;
 
 import java.io.File;
-import java.io.IOException;
 import java.util.Arrays;
 import java.util.List;
 import java.util.ArrayList;
 
-import org.apache.zookeeper.data.Stat;
-
 import static org.apache.zookeeper.test.ClientBase.CONNECTION_TIMEOUT;
 
 public class MultiTransactionTest extends ZKTestCase implements Watcher {

+ 0 - 4
src/java/test/org/apache/zookeeper/test/ObserverHierarchicalQuorumTest.java

@@ -17,14 +17,10 @@
 
 package org.apache.zookeeper.test;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.apache.zookeeper.server.quorum.QuorumPeer;
 import org.junit.Test;
 
 public class ObserverHierarchicalQuorumTest extends HierarchicalQuorumTest {
-    private static final Logger LOG = LoggerFactory.getLogger(QuorumBase.class);
-       
     /**
      * startServers(true) puts two observers into a 5 peer ensemble
      */

+ 0 - 4
src/java/test/org/apache/zookeeper/test/QuorumQuotaTest.java

@@ -18,8 +18,6 @@
 
 package org.apache.zookeeper.test;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.apache.zookeeper.CreateMode;
 import org.apache.zookeeper.Quotas;
 import org.apache.zookeeper.StatsTrack;
@@ -31,8 +29,6 @@ import org.junit.Assert;
 import org.junit.Test;
 
 public class QuorumQuotaTest extends QuorumBase {
-    private static final Logger LOG =
-        LoggerFactory.getLogger(QuorumQuotaTest.class);
 
     @Test
     public void testQuotaWithQuorum() throws Exception {

+ 0 - 2
src/java/test/org/apache/zookeeper/test/QuorumTest.java

@@ -20,7 +20,6 @@ package org.apache.zookeeper.test;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.List;
 import java.util.concurrent.Semaphore;
 import java.util.concurrent.TimeUnit;
 
@@ -28,7 +27,6 @@ import org.apache.zookeeper.AsyncCallback;
 import org.apache.zookeeper.CreateMode;
 import org.apache.zookeeper.KeeperException;
 import org.apache.zookeeper.Op;
-import org.apache.zookeeper.OpResult;
 import org.apache.zookeeper.WatchedEvent;
 import org.apache.zookeeper.Watcher;
 import org.apache.zookeeper.Watcher.Event.KeeperState;

+ 5 - 5
src/java/test/org/apache/zookeeper/test/RepeatStartupTest.java

@@ -43,11 +43,11 @@ public class RepeatStartupTest extends ZKTestCase {
         ZooKeeper zk = qb.createClient();
         zk.create("/test", null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
         zk.close();
-        qb.shutdown(qb.s1);
-        qb.shutdown(qb.s2);
-        qb.shutdown(qb.s3);
-        qb.shutdown(qb.s4);
-        qb.shutdown(qb.s5);
+        QuorumBase.shutdown(qb.s1);
+        QuorumBase.shutdown(qb.s2);
+        QuorumBase.shutdown(qb.s3);
+        QuorumBase.shutdown(qb.s4);
+        QuorumBase.shutdown(qb.s5);
         String hp = qb.hostPort.split(",")[0];
         ZooKeeperServer zks = new ZooKeeperServer(qb.s1.getTxnFactory().getSnapDir(),
                 qb.s1.getTxnFactory().getDataDir(), 3000);

+ 4 - 4
src/java/test/org/apache/zookeeper/test/SessionTest.java

@@ -47,7 +47,6 @@ import org.apache.zookeeper.server.ZooKeeperServer;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 
 public class SessionTest extends ZKTestCase {
@@ -55,7 +54,7 @@ public class SessionTest extends ZKTestCase {
 
     private static final String HOSTPORT = "127.0.0.1:" +
             PortAssignment.unique();
-    
+
     private ServerCnxnFactory serverFactory;
 
     private CountDownLatch startSignal;
@@ -217,7 +216,7 @@ public class SessionTest extends ZKTestCase {
             zk.getData("/e", false, stat);
             Assert.fail("Should have received a SessionExpiredException");
         } catch(KeeperException.SessionExpiredException e) {}
-        
+
         AsyncCallback.DataCallback cb = new AsyncCallback.DataCallback() {
             String status = "not done";
             public void processResult(int rc, String p, Object c, byte[] b, Stat s) {
@@ -231,7 +230,7 @@ public class SessionTest extends ZKTestCase {
                 cb.wait(1000);
             }
         }
-        Assert.assertEquals(KeeperException.Code.SESSIONEXPIRED.toString(), cb.toString());        
+        Assert.assertEquals(KeeperException.Code.SESSIONEXPIRED.toString(), cb.toString());
     }
 
     private List<Thread> findThreads(String name) {
@@ -250,6 +249,7 @@ public class SessionTest extends ZKTestCase {
     /**
      * Make sure ephemerals get cleaned up when a session times out.
      */
+    @SuppressWarnings("deprecation")
     @Test
     public void testSessionTimeout() throws Exception {
         final int TIMEOUT = 5000;

+ 0 - 1
src/java/test/org/apache/zookeeper/test/WatcherTest.java

@@ -30,7 +30,6 @@ import org.apache.zookeeper.CreateMode;
 import org.apache.zookeeper.KeeperException;
 import org.apache.zookeeper.TestableZooKeeper;
 import org.apache.zookeeper.WatchedEvent;
-import org.apache.zookeeper.Watcher;
 import org.apache.zookeeper.ZooKeeper;
 import org.apache.zookeeper.AsyncCallback.StatCallback;
 import org.apache.zookeeper.AsyncCallback.VoidCallback;

+ 0 - 6
src/java/test/org/apache/zookeeper/test/ZooKeeperQuotaTest.java

@@ -31,15 +31,9 @@ import org.apache.zookeeper.data.Stat;
 import org.apache.zookeeper.server.ZooKeeperServer;
 import org.junit.Assert;
 import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 public class ZooKeeperQuotaTest extends ClientBase {
 
-
-    private static final Logger LOG = LoggerFactory.getLogger(
-            ZooKeeperQuotaTest.class);
-
     @Test
     public void testQuota() throws IOException,
         InterruptedException, KeeperException, Exception {