zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From h...@apache.org
Subject [zookeeper] branch master updated: ZOOKEEPER-3475: Enable Checkstyle configuration on zookeeper-server
Date Sat, 17 Aug 2019 15:13:30 GMT
This is an automated email from the ASF dual-hosted git repository.

hanm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/zookeeper.git


The following commit(s) were added to refs/heads/master by this push:
     new fe940cd  ZOOKEEPER-3475: Enable Checkstyle configuration on zookeeper-server
fe940cd is described below

commit fe940cdd8fb23ba09684cefb73233d570f4a20fa
Author: tison <wander4096@gmail.com>
AuthorDate: Sat Aug 17 08:13:15 2019 -0700

    ZOOKEEPER-3475: Enable Checkstyle configuration on zookeeper-server
    
    - [x] org/apache/zookeeper
    - [x] org/apache/zookeeper/admin
    - [x] org/apache/zookeeper/cli
    - [x] org/apache/zookeeper/client
    - [x] org/apache/zookeeper/common
    - [x] org/apache/zookeeper/jmx
    - [x] org/apache/zookeeper/metrics
    - [x] org/apache/zookeeper/metrics/impl
    - [x] org/apache/zookeeper/server
    - [x] org/apache/zookeeper/server/admin
    - [x] org/apache/zookeeper/server/auth
    - [x] org/apache/zookeeper/server/command
    - [x] org/apache/zookeeper/server/metric
    - [x] org/apache/zookeeper/server/persistence
    - [x] org/apache/zookeeper/server/quorum
    - [x] org/apache/zookeeper/server/quorum/auth
    - [x] org/apache/zookeeper/server/quorum/flexible
    - [x] org/apache/zookeeper/server/util
    - [x] org/apache/zookeeper/server/watch
    - [x] org/apache/zookeeper/test
    - [x] org/apache/zookeeper/util
    - [x] org/apache/zookeeper/version/util
    
    Author: tison <wander4096@gmail.com>
    
    Reviewers: Brian Nixon <nixon@fb.com>, Enrico Olivelli <eolivelli@gmail.com>, Michael Han <hanm@apache.org>
    
    Closes #1049 from TisonKun/ZOOKEEPER-3475
---
 checkstyleSuppressions.xml                         |   9 +
 .../apache/zookeeper/test/system/GenerateLoad.java |  13 +-
 .../zookeeper/test/system/InstanceContainer.java   |   2 +-
 .../zookeeper/test/system/InstanceManager.java     |  30 +-
 .../apache/zookeeper/test/system/SimpleClient.java |  16 +-
 .../zookeeper/test/system/SimpleSysTest.java       |  20 +-
 .../recipes/queue/DistributedQueueTest.java        |  42 +-
 zookeeper-server/pom.xml                           |  32 +
 .../java/org/apache/zookeeper/AsyncCallback.java   |  61 +-
 .../main/java/org/apache/zookeeper/ClientCnxn.java | 894 ++++++++++----------
 .../org/apache/zookeeper/ClientCnxnSocket.java     |  40 +-
 .../org/apache/zookeeper/ClientCnxnSocketNIO.java  |  77 +-
 .../apache/zookeeper/ClientCnxnSocketNetty.java    |  83 +-
 .../org/apache/zookeeper/ClientWatchManager.java   |  17 +-
 .../main/java/org/apache/zookeeper/CreateMode.java |  92 +-
 .../java/org/apache/zookeeper/DigestWatcher.java   |   5 +-
 .../java/org/apache/zookeeper/Environment.java     |  72 +-
 .../org/apache/zookeeper/JLineZNodeCompleter.java  |  36 +-
 .../java/org/apache/zookeeper/KeeperException.java | 440 +++++-----
 .../src/main/java/org/apache/zookeeper/Login.java  | 119 ++-
 .../org/apache/zookeeper/MultiOperationRecord.java | 138 +--
 .../java/org/apache/zookeeper/MultiResponse.java   | 172 ++--
 .../src/main/java/org/apache/zookeeper/Op.java     | 108 ++-
 .../main/java/org/apache/zookeeper/OpResult.java   |  97 ++-
 .../src/main/java/org/apache/zookeeper/Quotas.java |   9 +-
 .../zookeeper/SaslClientCallbackHandler.java       |  55 +-
 .../org/apache/zookeeper/SaslServerPrincipal.java  |  21 +-
 .../org/apache/zookeeper/ServerAdminClient.java    |  19 +-
 .../src/main/java/org/apache/zookeeper/Shell.java  | 807 +++++++++---------
 .../main/java/org/apache/zookeeper/StatsTrack.java |   8 +-
 .../main/java/org/apache/zookeeper/Testable.java   |   4 +-
 .../java/org/apache/zookeeper/Transaction.java     |  11 +-
 .../main/java/org/apache/zookeeper/Version.java    |  25 +-
 .../org/apache/zookeeper/WatchDeregistration.java  |  24 +-
 .../java/org/apache/zookeeper/WatchedEvent.java    |  28 +-
 .../main/java/org/apache/zookeeper/Watcher.java    | 136 +--
 .../src/main/java/org/apache/zookeeper/ZKUtil.java |  63 +-
 .../main/java/org/apache/zookeeper/ZooDefs.java    |  98 +--
 .../main/java/org/apache/zookeeper/ZooKeeper.java  | 848 ++++++++++---------
 .../java/org/apache/zookeeper/ZooKeeperMain.java   | 137 ++-
 .../org/apache/zookeeper/ZooKeeperTestable.java    |  11 +-
 .../java/org/apache/zookeeper/ZookeeperBanner.java |  24 +-
 .../org/apache/zookeeper/admin/ZooKeeperAdmin.java | 103 ++-
 .../java/org/apache/zookeeper/cli/AclParser.java   |  47 +-
 .../org/apache/zookeeper/cli/AddAuthCommand.java   |   4 +-
 .../java/org/apache/zookeeper/cli/CliCommand.java  |  31 +-
 .../org/apache/zookeeper/cli/CliException.java     |   4 +-
 .../apache/zookeeper/cli/CliParseException.java    |   5 +-
 .../apache/zookeeper/cli/CliWrapperException.java  |  18 +-
 .../org/apache/zookeeper/cli/CloseCommand.java     |  10 +-
 .../zookeeper/cli/CommandNotFoundException.java    |   4 +-
 .../org/apache/zookeeper/cli/CreateCommand.java    |  27 +-
 .../org/apache/zookeeper/cli/DelQuotaCommand.java  |  30 +-
 .../org/apache/zookeeper/cli/DeleteAllCommand.java |  15 +-
 .../org/apache/zookeeper/cli/DeleteCommand.java    |  18 +-
 .../org/apache/zookeeper/cli/GetAclCommand.java    |  13 +-
 .../zookeeper/cli/GetAllChildrenNumberCommand.java |   5 +-
 .../java/org/apache/zookeeper/cli/GetCommand.java  |  19 +-
 .../org/apache/zookeeper/cli/GetConfigCommand.java |  24 +-
 .../apache/zookeeper/cli/GetEphemeralsCommand.java |   8 +-
 .../org/apache/zookeeper/cli/ListQuotaCommand.java |  34 +-
 .../java/org/apache/zookeeper/cli/Ls2Command.java  |  23 +-
 .../java/org/apache/zookeeper/cli/LsCommand.java   |  18 +-
 .../zookeeper/cli/MalformedCommandException.java   |   5 +-
 .../zookeeper/cli/MalformedPathException.java      |   5 +-
 .../org/apache/zookeeper/cli/ReconfigCommand.java  |  59 +-
 .../apache/zookeeper/cli/RemoveWatchesCommand.java |   9 +-
 .../org/apache/zookeeper/cli/SetAclCommand.java    |  12 +-
 .../java/org/apache/zookeeper/cli/SetCommand.java  |  12 +-
 .../org/apache/zookeeper/cli/SetQuotaCommand.java  |  61 +-
 .../java/org/apache/zookeeper/cli/StatCommand.java |  26 +-
 .../java/org/apache/zookeeper/cli/StatPrinter.java |   7 +-
 .../java/org/apache/zookeeper/cli/SyncCommand.java |   7 +-
 .../org/apache/zookeeper/cli/VersionCommand.java   |   4 +-
 .../zookeeper/client/ConnectStringParser.java      |  24 +-
 .../zookeeper/client/FourLetterWordMain.java       |  43 +-
 .../org/apache/zookeeper/client/HostProvider.java  |  40 +-
 .../zookeeper/client/StaticHostProvider.java       |  93 +--
 .../apache/zookeeper/client/ZKClientConfig.java    |  13 +-
 .../zookeeper/client/ZooKeeperSaslClient.java      | 191 ++---
 .../zookeeper/common/AtomicFileOutputStream.java   |  21 +-
 .../zookeeper/common/AtomicFileWritingIdiom.java   |  22 +-
 .../apache/zookeeper/common/ClientX509Util.java    |   3 +-
 .../apache/zookeeper/common/FileChangeWatcher.java |  35 +-
 .../zookeeper/common/FileKeyStoreLoader.java       |  16 +-
 .../common/FileKeyStoreLoaderBuilderProvider.java  |  23 +-
 .../java/org/apache/zookeeper/common/IOUtils.java  |  21 +-
 .../org/apache/zookeeper/common/JKSFileLoader.java |  15 +-
 .../apache/zookeeper/common/KeyStoreFileType.java  |  12 +-
 .../apache/zookeeper/common/KeyStoreLoader.java    |   4 +-
 .../java/org/apache/zookeeper/common/NetUtils.java |   3 +-
 .../org/apache/zookeeper/common/NettyUtils.java    |  23 +-
 .../org/apache/zookeeper/common/PEMFileLoader.java |  17 +-
 .../apache/zookeeper/common/PKCS12FileLoader.java  |  15 +-
 .../java/org/apache/zookeeper/common/PathTrie.java | 691 +++++++--------
 .../org/apache/zookeeper/common/PathUtils.java     | 216 +++--
 .../apache/zookeeper/common/QuorumX509Util.java    |   3 +-
 .../zookeeper/common/SSLContextAndOptions.java     |  75 +-
 .../common/StandardTypeFileKeyStoreLoader.java     |  13 +-
 .../org/apache/zookeeper/common/StringUtils.java   |  20 +-
 .../java/org/apache/zookeeper/common/Time.java     |   8 +-
 .../org/apache/zookeeper/common/X509Exception.java |  11 +-
 .../java/org/apache/zookeeper/common/X509Util.java | 168 ++--
 .../java/org/apache/zookeeper/common/ZKConfig.java |  62 +-
 .../zookeeper/common/ZKHostnameVerifier.java       | 103 +--
 .../apache/zookeeper/common/ZKTrustManager.java    |  55 +-
 .../org/apache/zookeeper/jmx/MBeanRegistry.java    |  97 +--
 .../java/org/apache/zookeeper/jmx/ManagedUtil.java |  32 +-
 .../java/org/apache/zookeeper/jmx/ZKMBeanInfo.java |  10 +-
 .../java/org/apache/zookeeper/metrics/Counter.java |   3 +-
 .../java/org/apache/zookeeper/metrics/Gauge.java   |   3 +-
 .../apache/zookeeper/metrics/MetricsContext.java   |   5 +-
 .../apache/zookeeper/metrics/MetricsProvider.java  |   7 +-
 .../metrics/MetricsProviderLifeCycleException.java |   2 +-
 .../java/org/apache/zookeeper/metrics/Summary.java |  16 +-
 .../org/apache/zookeeper/metrics/SummarySet.java   |  18 +-
 .../metrics/impl/DefaultMetricsProvider.java       |  10 +-
 .../metrics/impl/MetricsProviderBootstrap.java     |  26 +-
 .../metrics/impl/NullMetricsProvider.java          |   6 +-
 .../org/apache/zookeeper/server/BlueThrottle.java  |  35 +-
 .../zookeeper/server/ByteBufferInputStream.java    |   7 +-
 .../zookeeper/server/ByteBufferOutputStream.java   |  10 +-
 .../zookeeper/server/ClientCnxnLimitException.java |   4 +-
 .../apache/zookeeper/server/ConnectionBean.java    |  55 +-
 .../apache/zookeeper/server/ConnectionMXBean.java  |  29 +-
 .../apache/zookeeper/server/ContainerManager.java  |  45 +-
 .../java/org/apache/zookeeper/server/DataNode.java |  34 +-
 .../java/org/apache/zookeeper/server/DataTree.java | 630 +++++++-------
 .../org/apache/zookeeper/server/DataTreeBean.java  |   5 +-
 .../apache/zookeeper/server/DataTreeMXBean.java    |  18 +-
 .../zookeeper/server/DatadirCleanupManager.java    |  27 +-
 .../org/apache/zookeeper/server/DumbWatcher.java   |  68 +-
 .../org/apache/zookeeper/server/EphemeralType.java |  18 +-
 .../zookeeper/server/EphemeralTypeEmulate353.java  |   2 +-
 .../java/org/apache/zookeeper/server/ExitCode.java |   3 +-
 .../org/apache/zookeeper/server/ExpiryQueue.java   |  23 +-
 .../zookeeper/server/FinalRequestProcessor.java    | 270 +++---
 .../org/apache/zookeeper/server/LogFormatter.java  |  37 +-
 .../org/apache/zookeeper/server/NIOServerCnxn.java | 161 ++--
 .../zookeeper/server/NIOServerCnxnFactory.java     | 184 ++--
 .../apache/zookeeper/server/NettyServerCnxn.java   | 139 ++--
 .../zookeeper/server/NettyServerCnxnFactory.java   | 256 +++---
 .../org/apache/zookeeper/server/NodeHashMap.java   |  29 +-
 .../apache/zookeeper/server/NodeHashMapImpl.java   |   9 +-
 .../org/apache/zookeeper/server/ObserverBean.java  |  11 +-
 .../zookeeper/server/PrepRequestProcessor.java     | 644 +++++++-------
 .../org/apache/zookeeper/server/PurgeTxnLog.java   |  56 +-
 .../org/apache/zookeeper/server/RateLogger.java    |   4 +-
 .../zookeeper/server/ReferenceCountedACLCache.java |  46 +-
 .../java/org/apache/zookeeper/server/Request.java  |  53 +-
 .../apache/zookeeper/server/RequestProcessor.java  |  12 +-
 .../apache/zookeeper/server/RequestThrottler.java  |  26 +-
 .../org/apache/zookeeper/server/ResponseCache.java |  14 +-
 .../org/apache/zookeeper/server/ServerCnxn.java    |  44 +-
 .../apache/zookeeper/server/ServerCnxnFactory.java |  77 +-
 .../org/apache/zookeeper/server/ServerConfig.java  |  41 +-
 .../org/apache/zookeeper/server/ServerMetrics.java |  12 +-
 .../org/apache/zookeeper/server/ServerStats.java   |  46 +-
 .../apache/zookeeper/server/SessionTracker.java    |  26 +-
 .../zookeeper/server/SessionTrackerImpl.java       |  86 +-
 .../apache/zookeeper/server/SnapshotFormatter.java |  54 +-
 .../java/org/apache/zookeeper/server/Stats.java    |   4 +-
 .../zookeeper/server/SyncRequestProcessor.java     |  80 +-
 .../apache/zookeeper/server/TraceFormatter.java    |  35 +-
 .../zookeeper/server/TxnLogProposalIterator.java   |  12 +-
 .../server/UnimplementedRequestProcessor.java      |   4 +-
 .../org/apache/zookeeper/server/WorkerService.java |  55 +-
 .../org/apache/zookeeper/server/ZKDatabase.java    |  74 +-
 .../zookeeper/server/ZooKeeperCriticalThread.java  |   8 +-
 .../zookeeper/server/ZooKeeperSaslServer.java      |   7 +-
 .../apache/zookeeper/server/ZooKeeperServer.java   | 525 ++++++------
 .../zookeeper/server/ZooKeeperServerBean.java      |  59 +-
 .../zookeeper/server/ZooKeeperServerConf.java      |  10 +-
 .../zookeeper/server/ZooKeeperServerListener.java  |   4 +-
 .../server/ZooKeeperServerListenerImpl.java        |   8 +-
 .../zookeeper/server/ZooKeeperServerMXBean.java    | 146 ++--
 .../zookeeper/server/ZooKeeperServerMain.java      |  53 +-
 .../server/ZooKeeperServerShutdownHandler.java     |   6 +-
 .../apache/zookeeper/server/ZooKeeperThread.java   |   9 +-
 .../java/org/apache/zookeeper/server/ZooTrace.java |  45 +-
 .../apache/zookeeper/server/admin/AdminServer.java |  16 +-
 .../zookeeper/server/admin/AdminServerFactory.java |   5 +-
 .../org/apache/zookeeper/server/admin/Command.java |   5 +-
 .../apache/zookeeper/server/admin/CommandBase.java |   4 +-
 .../zookeeper/server/admin/CommandOutputter.java   |   5 +-
 .../zookeeper/server/admin/CommandResponse.java    |   3 +-
 .../apache/zookeeper/server/admin/Commands.java    | 123 ++-
 .../zookeeper/server/admin/DummyAdminServer.java   |  13 +-
 .../zookeeper/server/admin/JettyAdminServer.java   |  86 +-
 .../zookeeper/server/admin/JsonOutputter.java      |   8 +-
 .../zookeeper/server/admin/ReadAheadEndpoint.java  | 137 ++-
 .../server/admin/UnifiedConnectionFactory.java     |  31 +-
 .../server/auth/AuthenticationProvider.java        |  16 +-
 .../server/auth/DigestAuthenticationProvider.java  |  43 +-
 .../zookeeper/server/auth/DigestLoginModule.java   |  19 +-
 .../auth/EnsembleAuthenticationProvider.java       |  25 +-
 .../server/auth/IPAuthenticationProvider.java      |  25 +-
 .../apache/zookeeper/server/auth/KerberosName.java | 705 ++++++++--------
 .../server/auth/KeyAuthenticationProvider.java     |  37 +-
 .../zookeeper/server/auth/ProviderRegistry.java    |  24 +-
 .../server/auth/SASLAuthenticationProvider.java    |  21 +-
 .../server/auth/SaslServerCallbackHandler.java     |  36 +-
 .../server/auth/ServerAuthenticationProvider.java  |  13 +-
 .../server/auth/WrappedAuthenticationProvider.java |   9 +-
 .../server/auth/X509AuthenticationProvider.java    |  54 +-
 .../server/command/AbstractFourLetterCommand.java  |   8 +-
 .../server/command/CnxnStatResetCommand.java       |   5 +-
 .../zookeeper/server/command/CommandExecutor.java  |  27 +-
 .../zookeeper/server/command/ConfCommand.java      |   7 +-
 .../zookeeper/server/command/ConsCommand.java      |   5 +-
 .../zookeeper/server/command/DigestCommand.java    |  10 +-
 .../zookeeper/server/command/DirsCommand.java      |   4 +-
 .../zookeeper/server/command/DumpCommand.java      |   7 +-
 .../zookeeper/server/command/EnvCommand.java       |   5 +-
 .../server/command/FourLetterCommands.java         |  72 +-
 .../zookeeper/server/command/IsroCommand.java      |   4 +-
 .../zookeeper/server/command/MonitorCommand.java   |  12 +-
 .../zookeeper/server/command/NopCommand.java       |   5 +-
 .../zookeeper/server/command/RuokCommand.java      |   5 +-
 .../server/command/SetTraceMaskCommand.java        |   5 +-
 .../zookeeper/server/command/StatCommand.java      |  14 +-
 .../zookeeper/server/command/StatResetCommand.java |   7 +-
 .../zookeeper/server/command/TraceMaskCommand.java |   5 +-
 .../zookeeper/server/command/WatchCommand.java     |   5 +-
 .../zookeeper/server/metric/AvgMinMaxCounter.java  |  26 +-
 .../server/metric/AvgMinMaxCounterSet.java         |   6 +-
 .../server/metric/AvgMinMaxPercentileCounter.java  |  10 +-
 .../metric/AvgMinMaxPercentileCounterSet.java      |   6 +-
 .../org/apache/zookeeper/server/metric/Metric.java |  18 +-
 .../zookeeper/server/metric/SimpleCounter.java     |   8 +-
 .../zookeeper/server/persistence/FilePadding.java  |   9 +-
 .../zookeeper/server/persistence/FileSnap.java     |  66 +-
 .../zookeeper/server/persistence/FileTxnLog.java   | 188 +++--
 .../server/persistence/FileTxnSnapLog.java         | 172 ++--
 .../zookeeper/server/persistence/SnapShot.java     |  24 +-
 .../zookeeper/server/persistence/SnapStream.java   |  89 +-
 .../zookeeper/server/persistence/SnapshotInfo.java |   4 +-
 .../zookeeper/server/persistence/TxnLog.java       |  38 +-
 .../server/persistence/TxnLogToolkit.java          | 119 +--
 .../apache/zookeeper/server/persistence/Util.java  |  78 +-
 .../server/quorum/AckRequestProcessor.java         |  14 +-
 .../server/quorum/AuthFastLeaderElection.java      | 421 +++++-----
 .../zookeeper/server/quorum/BufferStats.java       |   4 +-
 .../zookeeper/server/quorum/CommitProcessor.java   | 202 ++---
 .../apache/zookeeper/server/quorum/Election.java   |   9 +-
 .../server/quorum/FastLeaderElection.java          | 498 ++++++-----
 .../apache/zookeeper/server/quorum/Follower.java   | 104 ++-
 .../zookeeper/server/quorum/FollowerBean.java      |  10 +-
 .../zookeeper/server/quorum/FollowerMXBean.java    |  28 +-
 .../server/quorum/FollowerRequestProcessor.java    |  16 +-
 .../server/quorum/FollowerZooKeeperServer.java     |  62 +-
 .../org/apache/zookeeper/server/quorum/Leader.java | 543 ++++++------
 .../apache/zookeeper/server/quorum/LeaderBean.java |   8 +-
 .../server/quorum/LeaderElectionBean.java          |   5 +-
 .../server/quorum/LeaderElectionMXBean.java        |  11 +-
 .../zookeeper/server/quorum/LeaderMXBean.java      |  28 +-
 .../server/quorum/LeaderRequestProcessor.java      |  13 +-
 .../server/quorum/LeaderSessionTracker.java        |  54 +-
 .../server/quorum/LeaderZooKeeperServer.java       |  66 +-
 .../apache/zookeeper/server/quorum/Learner.java    | 337 ++++----
 .../zookeeper/server/quorum/LearnerHandler.java    | 271 +++---
 .../server/quorum/LearnerHandlerBean.java          |  19 +-
 .../server/quorum/LearnerHandlerMXBean.java        |   7 +-
 .../zookeeper/server/quorum/LearnerMaster.java     |  21 +-
 .../server/quorum/LearnerSessionTracker.java       |  29 +-
 .../server/quorum/LearnerSyncRequest.java          |  17 +-
 .../server/quorum/LearnerSyncThrottler.java        |  17 +-
 .../server/quorum/LearnerZooKeeperServer.java      |  36 +-
 .../zookeeper/server/quorum/LocalPeerBean.java     |  26 +-
 .../zookeeper/server/quorum/LocalPeerMXBean.java   |  60 +-
 .../server/quorum/LocalSessionTracker.java         |  10 +-
 .../apache/zookeeper/server/quorum/Observer.java   |  94 +--
 .../zookeeper/server/quorum/ObserverMXBean.java    |  14 +-
 .../zookeeper/server/quorum/ObserverMaster.java    | 112 +--
 .../server/quorum/ObserverRequestProcessor.java    |  25 +-
 .../server/quorum/ObserverZooKeeperServer.java     |  62 +-
 .../zookeeper/server/quorum/PrependableSocket.java |  60 +-
 .../server/quorum/ProposalRequestProcessor.java    |  13 +-
 .../apache/zookeeper/server/quorum/QuorumBean.java |   9 +-
 .../zookeeper/server/quorum/QuorumCnxManager.java  | 279 +++----
 .../zookeeper/server/quorum/QuorumMXBean.java      |  26 +-
 .../apache/zookeeper/server/quorum/QuorumPeer.java | 924 +++++++++++----------
 .../zookeeper/server/quorum/QuorumPeerConfig.java  | 460 +++++-----
 .../zookeeper/server/quorum/QuorumPeerMain.java    | 231 +++---
 .../zookeeper/server/quorum/QuorumStats.java       |  54 +-
 .../server/quorum/QuorumZooKeeperServer.java       |  37 +-
 .../zookeeper/server/quorum/ReadOnlyBean.java      |   2 +-
 .../server/quorum/ReadOnlyRequestProcessor.java    |  18 +-
 .../server/quorum/ReadOnlyZooKeeperServer.java     |  17 +-
 .../zookeeper/server/quorum/RemotePeerBean.java    |  20 +-
 .../zookeeper/server/quorum/RemotePeerMXBean.java  |  18 +-
 .../server/quorum/SendAckRequestProcessor.java     |  22 +-
 .../apache/zookeeper/server/quorum/ServerBean.java |   9 +-
 .../zookeeper/server/quorum/ServerMXBean.java      |  10 +-
 .../zookeeper/server/quorum/StateSummary.java      |  66 +-
 .../server/quorum/SyncThrottleException.java       |  14 +-
 .../server/quorum/SyncedLearnerTracker.java        |  19 +-
 .../server/quorum/UnifiedServerSocket.java         |  35 +-
 .../server/quorum/UpgradeableSessionTracker.java   |  32 +-
 .../org/apache/zookeeper/server/quorum/Vote.java   |  97 +--
 .../server/quorum/auth/NullQuorumAuthLearner.java  |   3 +-
 .../server/quorum/auth/NullQuorumAuthServer.java   |   5 +-
 .../zookeeper/server/quorum/auth/QuorumAuth.java   |  21 +-
 .../server/quorum/auth/QuorumAuthLearner.java      |   5 +-
 .../server/quorum/auth/QuorumAuthServer.java       |   6 +-
 .../server/quorum/auth/SaslQuorumAuthLearner.java  | 132 ++-
 .../server/quorum/auth/SaslQuorumAuthServer.java   |  71 +-
 .../auth/SaslQuorumServerCallbackHandler.java      |  35 +-
 .../server/quorum/flexible/QuorumHierarchical.java | 344 ++++----
 .../server/quorum/flexible/QuorumMaj.java          |  34 +-
 .../server/quorum/flexible/QuorumVerifier.java     |   9 +-
 .../org/apache/zookeeper/server/util/AdHash.java   |   5 +-
 .../apache/zookeeper/server/util/BitHashSet.java   |  12 +-
 .../org/apache/zookeeper/server/util/BitMap.java   |  12 +-
 .../apache/zookeeper/server/util/ConfigUtils.java  |  70 +-
 .../zookeeper/server/util/DigestCalculator.java    |  10 +-
 .../zookeeper/server/util/JvmPauseMonitor.java     |  39 +-
 .../apache/zookeeper/server/util/KerberosUtil.java |   8 +-
 .../apache/zookeeper/server/util/LogChopper.java   |  47 +-
 .../org/apache/zookeeper/server/util/OSMXBean.java |  82 +-
 .../server/util/RequestPathMetricsCollector.java   | 164 ++--
 .../zookeeper/server/util/SerializeUtils.java      |  45 +-
 .../server/util/VerifyingFileFactory.java          |  36 +-
 .../apache/zookeeper/server/util/ZxidUtils.java    |  28 +-
 .../server/watch/IDeadWatcherListener.java         |   5 +-
 .../zookeeper/server/watch/IWatchManager.java      |  29 +-
 .../zookeeper/server/watch/WatchManager.java       |  44 +-
 .../server/watch/WatchManagerFactory.java          |  13 +-
 .../server/watch/WatchManagerOptimized.java        |  93 +--
 .../zookeeper/server/watch/WatcherCleaner.java     |  65 +-
 .../zookeeper/server/watch/WatcherOrBitSet.java    |   3 +-
 .../zookeeper/server/watch/WatchesPathReport.java  |   1 +
 .../zookeeper/server/watch/WatchesReport.java      |   1 +
 .../zookeeper/server/watch/WatchesSummary.java     |   1 +
 .../java/org/apache/zookeeper/util/PemReader.java  | 104 +--
 .../org/apache/zookeeper/util/SecurityUtils.java   | 161 ++--
 .../org/apache/zookeeper/version/util/VerGen.java  |  45 +-
 .../apache/zookeeper/ClientCanonicalizeTest.java   |  20 +-
 .../org/apache/zookeeper/ClientCnxnSocketTest.java |   8 +-
 .../org/apache/zookeeper/ClientReconnectTest.java  |  27 +-
 .../apache/zookeeper/ClientRequestTimeoutTest.java |  79 +-
 .../apache/zookeeper/CustomHostProviderTest.java   |  38 +-
 .../apache/zookeeper/GetAllChildrenNumberTest.java |  42 +-
 .../org/apache/zookeeper/GetEphemeralsTest.java    | 111 +--
 .../org/apache/zookeeper/JUnit4ZKTestRunner.java   |  27 +-
 .../org/apache/zookeeper/JaasConfiguration.java    |  12 +-
 .../test/java/org/apache/zookeeper/MockPacket.java |  27 +-
 .../apache/zookeeper/MultiOperationRecordTest.java |  21 +-
 .../org/apache/zookeeper/MultiResponseTest.java    |  18 +-
 .../java/org/apache/zookeeper/PortAssignment.java  |  34 +-
 .../org/apache/zookeeper/PortAssignmentTest.java   |  50 +-
 .../org/apache/zookeeper/RemoveWatchesCmdTest.java | 122 +--
 .../org/apache/zookeeper/RemoveWatchesTest.java    | 645 ++++++--------
 .../java/org/apache/zookeeper/SaslAuthTest.java    |  58 +-
 .../org/apache/zookeeper/ServerConfigTest.java     |  19 +-
 .../org/apache/zookeeper/TestableZooKeeper.java    |  72 +-
 .../test/java/org/apache/zookeeper/VerGenTest.java |  26 +-
 .../java/org/apache/zookeeper/ZKParameterized.java |  14 +-
 .../test/java/org/apache/zookeeper/ZKTestCase.java |  21 +-
 .../test/java/org/apache/zookeeper/ZKUtilTest.java |   8 +-
 .../java/org/apache/zookeeper/ZooKeeperTest.java   | 360 ++++----
 .../zookeeper/client/ZKClientConfigTest.java       |  11 +-
 .../common/AtomicFileWritingIdiomTest.java         |  22 +-
 .../common/BaseX509ParameterizedTestCase.java      |   8 +-
 .../zookeeper/common/FileChangeWatcherTest.java    | 152 ++--
 .../FileKeyStoreLoaderBuilderProviderTest.java     |  24 +-
 .../apache/zookeeper/common/JKSFileLoaderTest.java | 107 +--
 .../zookeeper/common/KeyStoreFileTypeTest.java     |  66 +-
 .../org/apache/zookeeper/common/NetUtilsTest.java  |  24 +-
 .../apache/zookeeper/common/PEMFileLoaderTest.java | 121 ++-
 .../zookeeper/common/PKCS12FileLoaderTest.java     |  46 +-
 .../org/apache/zookeeper/common/PathTrieTest.java  |  62 +-
 .../org/apache/zookeeper/common/PathUtilsTest.java |  63 +-
 .../java/org/apache/zookeeper/common/TimeTest.java |  29 +-
 .../org/apache/zookeeper/common/X509KeyType.java   |   5 +-
 .../apache/zookeeper/common/X509TestContext.java   | 130 +--
 .../apache/zookeeper/common/X509TestHelpers.java   | 176 ++--
 .../org/apache/zookeeper/common/X509UtilTest.java  | 253 +++---
 .../zookeeper/common/ZKTrustManagerTest.java       |  52 +-
 .../zookeeper/metrics/BaseTestMetricsProvider.java |   5 +-
 .../org/apache/zookeeper/metrics/MetricsUtils.java |   6 +-
 .../apache/zookeeper/server/BlueThrottleTest.java  |  62 +-
 .../server/ByteBufferInputStreamTest.java          |  70 +-
 .../java/org/apache/zookeeper/server/CRCTest.java  |  42 +-
 .../zookeeper/server/ConnectionMetricsTest.java    |  69 +-
 .../zookeeper/server/CreateContainerTest.java      | 174 ++--
 .../org/apache/zookeeper/server/CreateTTLTest.java | 129 ++-
 .../org/apache/zookeeper/server/DataNodeTest.java  |  10 +-
 .../org/apache/zookeeper/server/DataTreeTest.java  | 220 +++--
 .../server/DatadirCleanupManagerTest.java          |  34 +-
 .../zookeeper/server/DeserializationPerfTest.java  |  56 +-
 .../apache/zookeeper/server/Emulate353TTLTest.java |  42 +-
 .../apache/zookeeper/server/EphemeralTypeTest.java |  35 +-
 .../server/FinalRequestProcessorTest.java          |  51 +-
 .../zookeeper/server/InvalidSnapCountTest.java     |  37 +-
 .../zookeeper/server/InvalidSnapshotTest.java      |  17 +-
 .../apache/zookeeper/server/MockNIOServerCnxn.java |  10 +-
 .../zookeeper/server/MockSelectorThread.java       |   4 +-
 .../apache/zookeeper/server/MockServerCnxn.java    |  10 +-
 .../server/MultiOpSessionUpgradeTest.java          |  61 +-
 .../zookeeper/server/NIOServerCnxnFactoryTest.java |  13 +-
 .../apache/zookeeper/server/NIOServerCnxnTest.java |  48 +-
 .../zookeeper/server/NettyServerCnxnTest.java      |  94 +--
 .../zookeeper/server/NodeHashMapImplTest.java      |  36 +-
 .../server/PrepRequestProcessorMetricsTest.java    |  92 +-
 .../zookeeper/server/PrepRequestProcessorTest.java | 104 ++-
 .../org/apache/zookeeper/server/PurgeTxnTest.java  | 173 ++--
 .../server/ReferenceCountedACLCacheTest.java       |  32 +-
 .../zookeeper/server/RequestThrottlerTest.java     |  71 +-
 .../zookeeper/server/SerializationPerfTest.java    |  57 +-
 .../org/apache/zookeeper/server/ServerIdTest.java  |  27 +-
 .../apache/zookeeper/server/ServerMetricsTest.java |  35 +-
 .../apache/zookeeper/server/ServerStatsTest.java   |  39 +-
 .../zookeeper/server/SessionTrackerTest.java       |  49 +-
 .../zookeeper/server/SnapshotDigestTest.java       |  70 +-
 .../org/apache/zookeeper/server/ToStringTest.java  |  10 +-
 .../server/ZooKeeperCriticalThreadMetricsTest.java |  27 +-
 .../zookeeper/server/ZooKeeperServerBeanTest.java  |  12 +-
 .../zookeeper/server/ZooKeeperServerConfTest.java  |  14 +-
 .../zookeeper/server/ZooKeeperServerMainTest.java  | 359 ++++----
 .../server/ZooKeeperServerStartupTest.java         | 107 +--
 .../zookeeper/server/ZooKeeperServerTest.java      |  56 +-
 .../zookeeper/server/ZooKeeperThreadTest.java      |  17 +-
 .../apache/zookeeper/server/ZxidRolloverTest.java  |  91 +-
 .../server/admin/CommandResponseTest.java          |  13 +-
 .../zookeeper/server/admin/CommandsTest.java       | 161 +---
 .../server/admin/JettyAdminServerTest.java         | 130 +--
 .../server/metric/AvgMinMaxCounterSetTest.java     |  56 +-
 .../metric/AvgMinMaxPercentileCounterSetTest.java  |  94 ++-
 .../metric/AvgMinMaxPercentileCounterTest.java     |  52 +-
 .../server/persistence/EmptySnapshotTest.java      |  46 +-
 .../server/persistence/FileTxnLogTest.java         | 442 +++++-----
 .../persistence/FileTxnSnapLogMetricsTest.java     |  43 +-
 .../server/persistence/FileTxnSnapLogTest.java     | 117 +--
 .../server/persistence/SnapStreamTest.java         |  56 +-
 .../server/persistence/TxnLogToolkitTest.java      |  28 +-
 .../zookeeper/server/quorum/BufferStatsTest.java   |   7 +-
 .../zookeeper/server/quorum/CnxManagerTest.java    | 259 +++---
 .../quorum/CommitProcessorConcurrencyTest.java     | 390 +++++----
 .../server/quorum/CommitProcessorMetricsTest.java  | 204 ++---
 .../server/quorum/CommitProcessorTest.java         | 222 +++--
 .../server/quorum/DelayRequestProcessor.java       |   6 +-
 .../server/quorum/EagerACLFilterTest.java          | 102 +--
 .../server/quorum/EphemeralNodeDeletionTest.java   |  95 +--
 .../quorum/FLEBackwardElectionRoundTest.java       |  44 +-
 .../server/quorum/FLELostMessageTest.java          |  33 +-
 .../server/quorum/FLEOutOfElectionTest.java        |  45 +-
 .../zookeeper/server/quorum/FLETestUtils.java      |  22 +-
 .../server/quorum/FuzzySnapshotRelatedTest.java    | 124 ++-
 .../zookeeper/server/quorum/LeaderBeanTest.java    |  46 +-
 .../zookeeper/server/quorum/LeaderMetricsTest.java |  44 +-
 .../server/quorum/LeaderWithObserverTest.java      | 100 ++-
 .../server/quorum/LearnerHandlerMetricsTest.java   |  52 +-
 .../server/quorum/LearnerHandlerTest.java          |  68 +-
 .../server/quorum/LearnerMetricsTest.java          |  43 +-
 .../server/quorum/LearnerSyncThrottlerTest.java    |  51 +-
 .../zookeeper/server/quorum/LearnerTest.java       |  82 +-
 .../zookeeper/server/quorum/LocalPeerBeanTest.java |   5 +-
 .../zookeeper/server/quorum/QuorumBeanTest.java    |   7 +-
 .../server/quorum/QuorumPeerConfigTest.java        |  38 +-
 .../server/quorum/QuorumPeerMainTest.java          | 852 +++++++++----------
 .../zookeeper/server/quorum/QuorumPeerTest.java    |  24 +-
 .../server/quorum/QuorumPeerTestBase.java          | 135 ++-
 .../server/quorum/QuorumRequestPipelineTest.java   |  87 +-
 .../zookeeper/server/quorum/QuorumSSLTest.java     | 386 +++++----
 .../zookeeper/server/quorum/QuorumServerTest.java  |  62 +-
 .../zookeeper/server/quorum/RaceConditionTest.java |  52 +-
 .../server/quorum/ReconfigBackupTest.java          | 168 ++--
 .../quorum/ReconfigDuringLeaderSyncTest.java       |  61 +-
 .../server/quorum/ReconfigFailureCasesTest.java    |  61 +-
 .../server/quorum/ReconfigLegacyTest.java          | 114 ++-
 .../server/quorum/ReconfigRecoveryTest.java        | 269 +++---
 .../ReconfigRollingRestartCompatibilityTest.java   |  92 +-
 .../server/quorum/RemotePeerBeanTest.java          |   6 +-
 .../server/quorum/SessionUpgradeQuorumTest.java    | 102 +--
 .../server/quorum/StandaloneDisabledTest.java      |  96 ++-
 .../zookeeper/server/quorum/StatCommandTest.java   |  22 +-
 .../server/quorum/StatResetCommandTest.java        |  22 +-
 .../quorum/SyncRequestProcessorMetricTest.java     |  66 +-
 .../UnifiedServerSocketModeDetectionTest.java      | 107 ++-
 .../server/quorum/UnifiedServerSocketTest.java     | 161 ++--
 .../zookeeper/server/quorum/WatchLeakTest.java     |  53 +-
 .../apache/zookeeper/server/quorum/Zab1_0Test.java | 750 ++++++++---------
 .../apache/zookeeper/server/quorum/ZabUtils.java   |  58 +-
 .../quorum/auth/KerberosSecurityTestcase.java      |  24 +-
 .../server/quorum/auth/KerberosTestUtils.java      |  16 +-
 .../zookeeper/server/quorum/auth/MiniKdc.java      |  82 +-
 .../zookeeper/server/quorum/auth/MiniKdcTest.java  | 102 +--
 .../server/quorum/auth/QuorumAuthTestBase.java     |  57 +-
 .../server/quorum/auth/QuorumAuthUpgradeTest.java  |  78 +-
 .../server/quorum/auth/QuorumDigestAuthTest.java   |  97 +--
 .../server/quorum/auth/QuorumKerberosAuthTest.java |  52 +-
 .../auth/QuorumKerberosHostBasedAuthTest.java      |  91 +-
 .../apache/zookeeper/server/util/AdHashTest.java   |  28 +-
 .../zookeeper/server/util/BitHashSetTest.java      |  74 +-
 .../apache/zookeeper/server/util/BitMapTest.java   |  41 +-
 .../zookeeper/server/util/ConfigUtilsTest.java     |  26 +-
 .../zookeeper/server/util/JvmPauseMonitorTest.java |  26 +-
 .../zookeeper/server/util/PortForwarder.java       |  91 +-
 .../util/RequestPathMetricsCollectorTest.java      | 397 +++++----
 .../zookeeper/server/util/SerializeUtilsTest.java  |  27 +-
 .../server/util/VerifyingFileFactoryTest.java      |  20 +-
 .../zookeeper/server/watch/WatchManagerTest.java   | 143 ++--
 .../zookeeper/server/watch/WatcherCleanerTest.java |  69 +-
 .../server/watch/WatcherOrBitSetTest.java          |  34 +-
 .../server/watch/WatchesPathReportTest.java        |  20 +-
 .../zookeeper/server/watch/WatchesReportTest.java  |  20 +-
 .../zookeeper/server/watch/WatchesSummaryTest.java |  14 +-
 .../org/apache/zookeeper/test/ACLCountTest.java    |  58 +-
 .../org/apache/zookeeper/test/ACLRootTest.java     |  34 +-
 .../java/org/apache/zookeeper/test/ACLTest.java    | 104 +--
 .../org/apache/zookeeper/test/AsyncHammerTest.java |  78 +-
 .../java/org/apache/zookeeper/test/AsyncOps.java   | 337 ++++----
 .../org/apache/zookeeper/test/AsyncOpsTest.java    |  17 +-
 .../java/org/apache/zookeeper/test/AsyncTest.java  |  52 +-
 .../zookeeper/test/AtomicFileOutputStreamTest.java |  10 +-
 .../java/org/apache/zookeeper/test/AuthTest.java   | 109 ++-
 .../org/apache/zookeeper/test/BufferSizeTest.java  |  43 +-
 .../org/apache/zookeeper/test/ChrootAsyncTest.java |  13 +-
 .../apache/zookeeper/test/ChrootClientTest.java    |  15 +-
 .../java/org/apache/zookeeper/test/ChrootTest.java |  77 +-
 .../java/org/apache/zookeeper/test/ClientBase.java | 221 +++--
 .../apache/zookeeper/test/ClientHammerTest.java    |  82 +-
 .../apache/zookeeper/test/ClientPortBindTest.java  |  54 +-
 .../org/apache/zookeeper/test/ClientRetryTest.java |  15 +-
 .../org/apache/zookeeper/test/ClientSSLTest.java   |  19 +-
 .../apache/zookeeper/test/ClientSkipACLTest.java   |  10 +-
 .../java/org/apache/zookeeper/test/ClientTest.java | 458 +++++-----
 .../zookeeper/test/ConnectStringParserTest.java    |  76 +-
 .../org/apache/zookeeper/test/CreateModeTest.java  |  71 +-
 .../java/org/apache/zookeeper/test/CreateTest.java | 170 ++--
 .../zookeeper/test/DisconnectableZooKeeper.java    |  17 +-
 .../zookeeper/test/DisconnectedWatcherTest.java    | 133 ++-
 .../test/DuplicateLocalSessionUpgradeTest.java     |  30 +-
 .../test/EmptiedSnapshotRecoveryTest.java          |  42 +-
 .../apache/zookeeper/test/EnsembleAuthTest.java    |  11 +-
 .../org/apache/zookeeper/test/EventTypeTest.java   |  19 +-
 .../org/apache/zookeeper/test/FLENewEpochTest.java | 126 ++-
 .../apache/zookeeper/test/FLEPredicateTest.java    |  79 +-
 .../org/apache/zookeeper/test/FLERestartTest.java  |  66 +-
 .../java/org/apache/zookeeper/test/FLETest.java    | 287 +++----
 .../apache/zookeeper/test/FLEZeroWeightTest.java   |  90 +-
 .../test/FollowerResyncConcurrencyTest.java        | 288 +++----
 .../zookeeper/test/FourLetterWordsQuorumTest.java  |  31 +-
 .../apache/zookeeper/test/FourLetterWordsTest.java |  66 +-
 .../test/FourLetterWordsWhiteListTest.java         |  48 +-
 .../apache/zookeeper/test/GetChildren2Test.java    |  95 +--
 .../zookeeper/test/GetProposalFromTxnTest.java     |  30 +-
 .../zookeeper/test/HierarchicalQuorumTest.java     | 165 ++--
 .../org/apache/zookeeper/test/IntegrityCheck.java  |  78 +-
 .../apache/zookeeper/test/InvalidSnapshotTest.java |  31 +-
 .../java/org/apache/zookeeper/test/JMXEnv.java     | 117 +--
 .../org/apache/zookeeper/test/KeeperStateTest.java |  24 +-
 .../apache/zookeeper/test/KeyAuthClientTest.java   |  18 +-
 .../zookeeper/test/LeaderSessionTrackerTest.java   |  39 +-
 .../zookeeper/test/LoadFromLogNoServerTest.java    |  92 +-
 .../org/apache/zookeeper/test/LoadFromLogTest.java | 124 ++-
 .../zookeeper/test/LocalSessionRequestTest.java    |  33 +-
 .../zookeeper/test/LocalSessionsOnlyTest.java      |  44 +-
 .../org/apache/zookeeper/test/LogChopperTest.java  |  41 +-
 .../org/apache/zookeeper/test/MaxCnxnsTest.java    |  38 +-
 .../zookeeper/test/MultiAsyncTransactionTest.java  |  40 +-
 .../apache/zookeeper/test/MultiOperationTest.java  | 546 ++++++------
 .../test/NIOConnectionFactoryFdLeakTest.java       |  19 +-
 .../apache/zookeeper/test/NettyNettySuiteBase.java |  10 +-
 .../zookeeper/test/NettyNettySuiteHammerTest.java  |   7 +-
 .../apache/zookeeper/test/NettyNettySuiteTest.java |  15 +-
 .../apache/zookeeper/test/NioNettySuiteBase.java   |   7 +-
 .../zookeeper/test/NioNettySuiteHammerTest.java    |   7 +-
 .../apache/zookeeper/test/NioNettySuiteTest.java   |  15 +-
 .../zookeeper/test/NonRecoverableErrorTest.java    |  62 +-
 .../org/apache/zookeeper/test/NullDataTest.java    |  31 +-
 .../java/org/apache/zookeeper/test/OOMTest.java    |  90 +-
 .../org/apache/zookeeper/test/OSMXBeanTest.java    |  30 +-
 .../test/ObserverHierarchicalQuorumTest.java       |   4 +-
 .../org/apache/zookeeper/test/ObserverLETest.java  |  25 +-
 .../apache/zookeeper/test/ObserverMasterTest.java  | 441 +++++-----
 .../zookeeper/test/ObserverQuorumHammerTest.java   |   8 +-
 .../org/apache/zookeeper/test/ObserverTest.java    |  39 +-
 .../java/org/apache/zookeeper/test/QuorumBase.java | 185 ++---
 .../apache/zookeeper/test/QuorumHammerTest.java    |   5 +-
 .../apache/zookeeper/test/QuorumMajorityTest.java  |  81 +-
 .../org/apache/zookeeper/test/QuorumQuotaTest.java |  31 +-
 .../java/org/apache/zookeeper/test/QuorumTest.java | 219 +++--
 .../java/org/apache/zookeeper/test/QuorumUtil.java |  80 +-
 .../org/apache/zookeeper/test/QuorumUtilTest.java  |  20 +-
 .../apache/zookeeper/test/QuorumZxidSyncTest.java  |  42 +-
 .../apache/zookeeper/test/ReadOnlyModeTest.java    | 129 ++-
 .../zookeeper/test/ReconfigExceptionTest.java      |  69 +-
 .../zookeeper/test/ReconfigMisconfigTest.java      |  45 +-
 .../org/apache/zookeeper/test/ReconfigTest.java    | 659 ++++++++-------
 .../org/apache/zookeeper/test/RecoveryTest.java    |  89 +-
 .../apache/zookeeper/test/RepeatStartupTest.java   |  22 +-
 .../apache/zookeeper/test/ResponseCacheTest.java   |  39 +-
 .../zookeeper/test/RestoreCommittedLogTest.java    |  33 +-
 .../org/apache/zookeeper/test/SSLAuthTest.java     |  22 +-
 .../test/SaslAuthDesignatedClientTest.java         | 175 ++--
 .../test/SaslAuthDesignatedServerTest.java         |  39 +-
 .../test/SaslAuthFailDesignatedClientTest.java     |  65 +-
 .../apache/zookeeper/test/SaslAuthFailTest.java    |  55 +-
 .../test/SaslAuthMissingClientConfigTest.java      |  43 +-
 .../test/SaslAuthRequiredFailNoSASLTest.java       |  64 +-
 .../test/SaslAuthRequiredFailWrongSASLTest.java    |  68 +-
 .../zookeeper/test/SaslAuthRequiredTest.java       |  60 +-
 .../org/apache/zookeeper/test/SaslClientTest.java  |  30 +-
 .../apache/zookeeper/test/SaslSuperUserTest.java   |  71 +-
 .../org/apache/zookeeper/test/SaslTestUtil.java    |  74 +-
 .../org/apache/zookeeper/test/ServerCnxnTest.java  |  33 +-
 .../zookeeper/test/SessionInvalidationTest.java    |  25 +-
 .../org/apache/zookeeper/test/SessionTest.java     | 230 +++--
 .../apache/zookeeper/test/SessionTimeoutTest.java  |  51 +-
 .../zookeeper/test/SessionTrackerCheckTest.java    |  58 +-
 .../apache/zookeeper/test/SessionUpgradeTest.java  |  95 +--
 .../org/apache/zookeeper/test/SledgeHammer.java    |  29 +-
 .../org/apache/zookeeper/test/StandaloneTest.java  |  61 +-
 .../java/org/apache/zookeeper/test/StatTest.java   | 156 ++--
 .../zookeeper/test/StaticHostProviderTest.java     | 185 ++---
 .../org/apache/zookeeper/test/StringUtilTest.java  |  10 +-
 .../org/apache/zookeeper/test/SyncCallTest.java    |  91 +-
 .../zookeeper/test/TestByteBufAllocator.java       |  44 +-
 .../test/TestByteBufAllocatorTestHelper.java       |  15 +-
 .../java/org/apache/zookeeper/test/TestHammer.java |  40 +-
 .../java/org/apache/zookeeper/test/TestUtils.java  |  18 +-
 .../org/apache/zookeeper/test/TruncateTest.java    |  82 +-
 .../test/WatchEventWhenAutoResetTest.java          |  54 +-
 .../apache/zookeeper/test/WatchedEventTest.java    |  81 +-
 .../org/apache/zookeeper/test/WatcherFuncTest.java | 253 +++---
 .../org/apache/zookeeper/test/WatcherTest.java     | 238 +++---
 .../org/apache/zookeeper/test/X509AuthTest.java    |  76 +-
 .../zookeeper/test/ZkDatabaseCorruptionTest.java   |  91 +-
 .../apache/zookeeper/test/ZooKeeperQuotaTest.java  |  80 +-
 .../apache/zookeeper/test/ZooKeeperTestClient.java | 773 +++++++++--------
 .../org/apache/zookeeper/util/PemReaderTest.java   |  48 +-
 633 files changed, 23496 insertions(+), 24952 deletions(-)

diff --git a/checkstyleSuppressions.xml b/checkstyleSuppressions.xml
index 9f9fbd0..53d92eb 100644
--- a/checkstyleSuppressions.xml
+++ b/checkstyleSuppressions.xml
@@ -23,4 +23,13 @@
     <suppress checks=".*" files=".+[\\/]generated-sources[\\/].+\.java" />
     <suppress checks=".*" files=".+[\\/]generated-test-sources[\\/].+\.java" />
     <suppress checks="LineLength" files=".+[\\/]jute[\\/].+\.java"/>
+
+    <!-- TODO ZOOKEEPER-3508 -->
+    <suppress checks="LineLength" files=".+[\\/]zookeeper-server[\\/].+\.java"/>
+
+    <!-- TODO ZOOKEEPER-3507 -->
+    <suppress checks=".*Name.*" files=".+[\\/]zookeeper-server[\\/].+\.java"/>
+
+    <!-- TODO ZOOKEEPER-3469 -->
+    <suppress checks="Javadoc.+" files=".+[\\/]zookeeper-server[\\/].+\.java"/>
 </suppressions>
diff --git a/zookeeper-it/src/test/java/org/apache/zookeeper/test/system/GenerateLoad.java b/zookeeper-it/src/test/java/org/apache/zookeeper/test/system/GenerateLoad.java
index 1de66d6..afcffc8 100644
--- a/zookeeper-it/src/test/java/org/apache/zookeeper/test/system/GenerateLoad.java
+++ b/zookeeper-it/src/test/java/org/apache/zookeeper/test/system/GenerateLoad.java
@@ -70,7 +70,7 @@ public class GenerateLoad {
     volatile static long currentInterval;
 
     static long lastChange;
-    
+
     static PrintStream sf;
     static PrintStream tf;
     static {
@@ -86,7 +86,8 @@ public class GenerateLoad {
     synchronized static void add(long time, int count, Socket s) {
         long interval = time / INTERVAL;
         if (currentInterval == 0 || currentInterval > interval) {
-            System.out.println("Dropping " + count + " for " + new Date(time)
+            System.out.println(
+                "Dropping " + count + " for " + new Date(time)
                     + " " + currentInterval + ">" + interval);
             return;
         }
@@ -269,7 +270,7 @@ public class GenerateLoad {
     static public class GeneratorInstance implements Instance {
 
         byte bytes[];
-        
+
         int percentage = -1;
 
         int errors;
@@ -287,7 +288,7 @@ public class GenerateLoad {
         int wlatency;
 
         int outstanding;
-        
+
         volatile boolean alive;
 
         class ZooKeeperThread extends Thread implements Watcher, DataCallback,
@@ -556,7 +557,7 @@ public class GenerateLoad {
 
     private static boolean leaderOnly;
     private static boolean leaderServes;
-    
+
     private static String []processOptions(String args[]) {
         ArrayList<String> newArgs = new ArrayList<String>();
         for(String a: args) {
@@ -571,7 +572,7 @@ public class GenerateLoad {
         }
         return newArgs.toArray(new String[0]);
     }
-    
+
     /**
      * @param args
      * @throws InterruptedException
diff --git a/zookeeper-it/src/test/java/org/apache/zookeeper/test/system/InstanceContainer.java b/zookeeper-it/src/test/java/org/apache/zookeeper/test/system/InstanceContainer.java
index 83caaf4..1cb7bc0 100644
--- a/zookeeper-it/src/test/java/org/apache/zookeeper/test/system/InstanceContainer.java
+++ b/zookeeper-it/src/test/java/org/apache/zookeeper/test/system/InstanceContainer.java
@@ -242,7 +242,7 @@ public class InstanceContainer implements Watcher, AsyncCallback.ChildrenCallbac
             Instance i = instances.remove(child);
             if (i == null) {
                 // Start up a new instance
-                byte data[] = null;
+                byte[] data = null;
                 String myNode = assignmentsNode + '/' + child;
                 while(true) {
                     try {
diff --git a/zookeeper-it/src/test/java/org/apache/zookeeper/test/system/InstanceManager.java b/zookeeper-it/src/test/java/org/apache/zookeeper/test/system/InstanceManager.java
index 55d9500..12c94e9 100644
--- a/zookeeper-it/src/test/java/org/apache/zookeeper/test/system/InstanceManager.java
+++ b/zookeeper-it/src/test/java/org/apache/zookeeper/test/system/InstanceManager.java
@@ -47,7 +47,7 @@ import org.apache.zookeeper.common.Time;
  *    * ready: this znode indicates that the InstanceManager is running
  *    * available: the children of this znode are ephemeral nodes representing
  *                 running InstanceContainers
- *    * assignments: there will be a child under this znode for each available 
+ *    * assignments: there will be a child under this znode for each available
  *                   InstanceContainer. those znodes will have a child for each
  *                   assigned instance
  *    * reports: there will be a child under this znode for each instance that is
@@ -114,21 +114,21 @@ public class InstanceManager implements AsyncCallback.ChildrenCallback, Watcher
             InterruptedException {
         try {
             zk.create(prefixNode, new byte[0], Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
-        } catch(NodeExistsException e) { /* this is ok */ } 
+        } catch(NodeExistsException e) { /* this is ok */ }
         try {
             zk.create(assignmentsNode, new byte[0], Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
-        } catch(NodeExistsException e) { /* this is ok */ } 
-        try { 
+        } catch(NodeExistsException e) { /* this is ok */ }
+        try {
             zk.create(statusNode, new byte[0], Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
-        } catch(NodeExistsException e) { /* this is ok */ } 
-        try { 
+        } catch(NodeExistsException e) { /* this is ok */ }
+        try {
             zk.create(reportsNode, new byte[0], Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
-        } catch(NodeExistsException e) { /* this is ok */ } 
+        } catch(NodeExistsException e) { /* this is ok */ }
         try {
             zk.create(readyNode, new byte[0], Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
-        } catch(NodeExistsException e) { /* this is ok */ } 
+        } catch(NodeExistsException e) { /* this is ok */ }
     }
-    
+
     synchronized public void processResult(int rc, String path, Object ctx,
             List<String> children) {
         if (rc != KeeperException.Code.OK.intValue()) {
@@ -159,7 +159,7 @@ public class InstanceManager implements AsyncCallback.ChildrenCallback, Watcher
         }
         assignments = newAssignments;
     }
-    
+
     public void process(WatchedEvent event) {
         if (event.getPath().equals(statusNode)) {
             zk.getChildren(statusNode, this, this, null);
@@ -224,7 +224,7 @@ public class InstanceManager implements AsyncCallback.ChildrenCallback, Watcher
         }
         throw lastException;
     }
-    
+
     public void reconfigureInstance(String name, String params) throws NoAssignmentException, InterruptedException, KeeperException {
         if (LOG.isDebugEnabled()) {
             LOG.debug("Reconfiguring " + name + " with " + params);
@@ -246,7 +246,7 @@ public class InstanceManager implements AsyncCallback.ChildrenCallback, Watcher
             throw lastException;
         }
     }
-    
+
     private void doDelete(String path) throws InterruptedException, KeeperException {
         KeeperException lastException = null;
         for(int i = 0; i < maxTries; i++) {
@@ -270,11 +270,11 @@ public class InstanceManager implements AsyncCallback.ChildrenCallback, Watcher
         doDelete(assignmentsNode + '/' + assigned.container + '/' + name);
         doDelete(reportsNode + '/' + name);
     }
-    
+
     synchronized boolean isAlive(String name) {
         return instanceToAssignment.get(name) != null;
     }
-    
+
     public void resetStatus(String name) throws InterruptedException, KeeperException {
         KeeperException lastException = null;
         for(int i = 0; i < maxTries; i++) {
@@ -295,7 +295,7 @@ public class InstanceManager implements AsyncCallback.ChildrenCallback, Watcher
 
     public String getStatus(String name, long timeout) throws KeeperException, InterruptedException {
         Stat stat = new Stat();
-        byte data[] = null;
+        byte[] data = null;
         long endTime = Time.currentElapsedTime() + timeout;
         KeeperException lastException = null;
         for(int i = 0; i < maxTries && endTime > Time.currentElapsedTime(); i++) {
diff --git a/zookeeper-it/src/test/java/org/apache/zookeeper/test/system/SimpleClient.java b/zookeeper-it/src/test/java/org/apache/zookeeper/test/system/SimpleClient.java
index 6ca5cc3..2dc80ba 100644
--- a/zookeeper-it/src/test/java/org/apache/zookeeper/test/system/SimpleClient.java
+++ b/zookeeper-it/src/test/java/org/apache/zookeeper/test/system/SimpleClient.java
@@ -29,7 +29,7 @@ import org.apache.zookeeper.ZooDefs.Ids;
 import org.apache.zookeeper.data.Stat;
 
 /**
- * The client that gets spawned for the SimpleSysTest 
+ * The client that gets spawned for the SimpleSysTest
  *
  */
 public class SimpleClient implements Instance, Watcher, AsyncCallback.DataCallback, StringCallback, StatCallback {
@@ -38,7 +38,7 @@ public class SimpleClient implements Instance, Watcher, AsyncCallback.DataCallba
     ZooKeeper zk;
     transient int index;
     transient String myPath;
-    byte data[];
+    byte[] data;
     boolean createdEphemeral;
     public void configure(String params) {
         String parts[] = params.split(" ");
@@ -46,7 +46,7 @@ public class SimpleClient implements Instance, Watcher, AsyncCallback.DataCallba
         this.index = Integer.parseInt(parts[0]);
         myPath = "/simpleCase/" + index;
     }
-    
+
     public void start() {
         try {
             zk = new ZooKeeper(hostPort, 15000, this);
@@ -58,7 +58,7 @@ public class SimpleClient implements Instance, Watcher, AsyncCallback.DataCallba
             e.printStackTrace();
         }
     }
-    
+
     public void stop() {
         try {
             if (zk != null) {
@@ -73,7 +73,7 @@ public class SimpleClient implements Instance, Watcher, AsyncCallback.DataCallba
             zk.getData("/simpleCase", true, this, null);
         }
     }
-    
+
     public void processResult(int rc, String path, Object ctx, byte[] data,
             Stat stat) {
         if (rc != 0) {
@@ -91,9 +91,9 @@ public class SimpleClient implements Instance, Watcher, AsyncCallback.DataCallba
             } else {
                 zk.setData(myPath, data, -1, this, null);
             }
-        }            
+        }
     }
-    
+
     public void processResult(int rc, String path, Object ctx, String name) {
         if (rc != 0) {
             zk.create(myPath, data, Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL, this, null);
@@ -108,7 +108,7 @@ public class SimpleClient implements Instance, Watcher, AsyncCallback.DataCallba
     public String toString() {
         return SimpleClient.class.getName() + "[" + index + "] using " + hostPort;
     }
-    
+
     Reporter r;
     public void setReporter(Reporter r) {
         this.r = r;
diff --git a/zookeeper-it/src/test/java/org/apache/zookeeper/test/system/SimpleSysTest.java b/zookeeper-it/src/test/java/org/apache/zookeeper/test/system/SimpleSysTest.java
index cf42d39..d35521b 100644
--- a/zookeeper-it/src/test/java/org/apache/zookeeper/test/system/SimpleSysTest.java
+++ b/zookeeper-it/src/test/java/org/apache/zookeeper/test/system/SimpleSysTest.java
@@ -45,7 +45,7 @@ public class SimpleSysTest extends BaseSysTest implements Watcher {
     int maxTries = 10;
     boolean connected;
     final private static Logger LOG = LoggerFactory.getLogger(SimpleSysTest.class);
-    
+
     synchronized private boolean waitForConnect(ZooKeeper zk, long timeout) throws InterruptedException {
         connected = (zk.getState() == States.CONNECTED);
         long end = Time.currentElapsedTime() + timeout;
@@ -55,7 +55,7 @@ public class SimpleSysTest extends BaseSysTest implements Watcher {
         }
         return connected;
     }
-    
+
     /**
      * This test checks the following:
      * 1) All clients connect successfully
@@ -63,7 +63,7 @@ public class SimpleSysTest extends BaseSysTest implements Watcher {
      * 3) All servers are restarted and cluster stays alive
      * 4) Clients see a change by the server
      * 5) Clients' ephemeral nodes are cleaned up
-     * 
+     *
      * @throws Exception
      */
     @Test
@@ -77,7 +77,7 @@ public class SimpleSysTest extends BaseSysTest implements Watcher {
         waitForConnect(zk, 10000);
         zk.create("/simpleCase", "orig".getBytes(), Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
         startClients();
-        
+
         // Check that all clients connect properly
         for(int i = 0; i < getClientCount(); i++) {
             for(int j = 0; j < maxTries; j++) {
@@ -92,7 +92,7 @@ public class SimpleSysTest extends BaseSysTest implements Watcher {
                 }
             }
         }
-        
+
         // Kill half the servers, make a change, restart the dead
         // servers, and then bounce the other servers one by one
         for(int i = 0; i < getServerCount(); i++) {
@@ -120,11 +120,11 @@ public class SimpleSysTest extends BaseSysTest implements Watcher {
         } catch(ConnectionLossException e) {
             Assert.assertTrue("Servers didn't bounce", waitForConnect(zk, 15000));
         }
-        
+
         // check that the change has propagated to everyone
         for(int i = 0; i < getClientCount(); i++) {
             for(int j = 0; j < maxTries; j++) {
-                byte data[] = zk.getData("/simpleCase/" + i, false, stat);
+                byte[] data = zk.getData("/simpleCase/" + i, false, stat);
                 if (new String(data).equals("new")) {
                     break;
                 }
@@ -134,10 +134,10 @@ public class SimpleSysTest extends BaseSysTest implements Watcher {
                 Thread.sleep(1000);
             }
         }
-        
+
         // send out the kill signal
         zk.setData("/simpleCase", "die".getBytes(), -1);
-        
+
         // watch for everyone to die
         for(int i = 0; i < getClientCount(); i++) {
             try {
@@ -152,7 +152,7 @@ public class SimpleSysTest extends BaseSysTest implements Watcher {
                 // Great this is what we were hoping for!
             }
         }
-        
+
         stopClients();
         stopServers();
     }
diff --git a/zookeeper-recipes/zookeeper-recipes-queue/src/test/java/org/apache/zookeeper/recipes/queue/DistributedQueueTest.java b/zookeeper-recipes/zookeeper-recipes-queue/src/test/java/org/apache/zookeeper/recipes/queue/DistributedQueueTest.java
index c6cfae2..1663d03 100644
--- a/zookeeper-recipes/zookeeper-recipes-queue/src/test/java/org/apache/zookeeper/recipes/queue/DistributedQueueTest.java
+++ b/zookeeper-recipes/zookeeper-recipes-queue/src/test/java/org/apache/zookeeper/recipes/queue/DistributedQueueTest.java
@@ -42,8 +42,8 @@ public class DistributedQueueTest extends ClientBase {
         String dir = "/testOffer1";
         String testString = "Hello World";
         final int num_clients = 1;
-        ZooKeeper clients[] = new ZooKeeper[num_clients];
-        DistributedQueue queueHandles[] = new DistributedQueue[num_clients];
+        ZooKeeper[] clients = new ZooKeeper[num_clients];
+        DistributedQueue[] queueHandles = new DistributedQueue[num_clients];
         for(int i=0; i < clients.length; i++){
             clients[i] = createClient();
             queueHandles[i] = new DistributedQueue(clients[i], dir, null);
@@ -51,7 +51,7 @@ public class DistributedQueueTest extends ClientBase {
 
         queueHandles[0].offer(testString.getBytes());
 
-        byte dequeuedBytes[] = queueHandles[0].remove();
+        byte[] dequeuedBytes = queueHandles[0].remove();
         Assert.assertEquals(new String(dequeuedBytes), testString);
     }
 
@@ -60,8 +60,8 @@ public class DistributedQueueTest extends ClientBase {
         String dir = "/testOffer2";
         String testString = "Hello World";
         final int num_clients = 2;
-        ZooKeeper clients[] = new ZooKeeper[num_clients];
-        DistributedQueue queueHandles[] = new DistributedQueue[num_clients];
+        ZooKeeper[] clients = new ZooKeeper[num_clients];
+        DistributedQueue[] queueHandles = new DistributedQueue[num_clients];
         for(int i=0; i < clients.length; i++){
             clients[i] = createClient();
             queueHandles[i] = new DistributedQueue(clients[i], dir, null);
@@ -69,7 +69,7 @@ public class DistributedQueueTest extends ClientBase {
 
         queueHandles[0].offer(testString.getBytes());
 
-        byte dequeuedBytes[] = queueHandles[1].remove();
+        byte[] dequeuedBytes = queueHandles[1].remove();
         Assert.assertEquals(new String(dequeuedBytes), testString);
     }
 
@@ -78,8 +78,8 @@ public class DistributedQueueTest extends ClientBase {
         String dir = "/testTake1";
         String testString = "Hello World";
         final int num_clients = 1;
-        ZooKeeper clients[] = new ZooKeeper[num_clients];
-        DistributedQueue queueHandles[] = new DistributedQueue[num_clients];
+        ZooKeeper[] clients = new ZooKeeper[num_clients];
+        DistributedQueue[] queueHandles = new DistributedQueue[num_clients];
         for(int i=0; i < clients.length; i++){
             clients[i] = createClient();
             queueHandles[i] = new DistributedQueue(clients[i], dir, null);
@@ -87,7 +87,7 @@ public class DistributedQueueTest extends ClientBase {
 
         queueHandles[0].offer(testString.getBytes());
 
-        byte dequeuedBytes[] = queueHandles[0].take();
+        byte[] dequeuedBytes = queueHandles[0].take();
         Assert.assertEquals(new String(dequeuedBytes), testString);
     }
 
@@ -98,8 +98,8 @@ public class DistributedQueueTest extends ClientBase {
         String dir = "/testRemove1";
         String testString = "Hello World";
         final int num_clients = 1;
-        ZooKeeper clients[] = new ZooKeeper[num_clients];
-        DistributedQueue queueHandles[] = new DistributedQueue[num_clients];
+        ZooKeeper[] clients = new ZooKeeper[num_clients];
+        DistributedQueue[] queueHandles = new DistributedQueue[num_clients];
         for(int i=0; i < clients.length; i++){
             clients[i] = createClient();
             queueHandles[i] = new DistributedQueue(clients[i], dir, null);
@@ -116,8 +116,8 @@ public class DistributedQueueTest extends ClientBase {
     public void createNremoveMtest(String dir,int n,int m) throws Exception{
         String testString = "Hello World";
         final int num_clients = 2;
-        ZooKeeper clients[] = new ZooKeeper[num_clients];
-        DistributedQueue queueHandles[] = new DistributedQueue[num_clients];
+        ZooKeeper[] clients = new ZooKeeper[num_clients];
+        DistributedQueue[] queueHandles = new DistributedQueue[num_clients];
         for(int i=0; i < clients.length; i++){
             clients[i] = createClient();
             queueHandles[i] = new DistributedQueue(clients[i], dir, null);
@@ -128,7 +128,7 @@ public class DistributedQueueTest extends ClientBase {
             queueHandles[0].offer(offerString.getBytes());
         }
 
-        byte data[] = null;
+        byte[] data = null;
         for(int i=0; i<m; i++){
             data=queueHandles[1].remove();
         }
@@ -147,8 +147,8 @@ public class DistributedQueueTest extends ClientBase {
     public void createNremoveMelementTest(String dir,int n,int m) throws Exception{
         String testString = "Hello World";
         final int num_clients = 2;
-        ZooKeeper clients[] = new ZooKeeper[num_clients];
-        DistributedQueue queueHandles[] = new DistributedQueue[num_clients];
+        ZooKeeper[] clients = new ZooKeeper[num_clients];
+        DistributedQueue[] queueHandles = new DistributedQueue[num_clients];
         for(int i=0; i < clients.length; i++){
             clients[i] = createClient();
             queueHandles[i] = new DistributedQueue(clients[i], dir, null);
@@ -159,7 +159,7 @@ public class DistributedQueueTest extends ClientBase {
             queueHandles[0].offer(offerString.getBytes());
         }
 
-        byte data[] = null;
+        byte[] data = null;
         for(int i=0; i<m; i++){
             data=queueHandles[1].remove();
         }
@@ -191,8 +191,8 @@ public class DistributedQueueTest extends ClientBase {
         String dir = "/testTakeWait1";
         final String testString = "Hello World";
         final int num_clients = 1;
-        final ZooKeeper clients[] = new ZooKeeper[num_clients];
-        final DistributedQueue queueHandles[] = new DistributedQueue[num_clients];
+        final ZooKeeper[] clients = new ZooKeeper[num_clients];
+        final DistributedQueue[] queueHandles = new DistributedQueue[num_clients];
         for(int i=0; i < clients.length; i++){
             clients[i] = createClient();
             queueHandles[i] = new DistributedQueue(clients[i], dir, null);
@@ -238,8 +238,8 @@ public class DistributedQueueTest extends ClientBase {
         String dir = "/testTakeWait2";
         final String testString = "Hello World";
         final int num_clients = 1;
-        final ZooKeeper clients[] = new ZooKeeper[num_clients];
-        final DistributedQueue queueHandles[] = new DistributedQueue[num_clients];
+        final ZooKeeper[] clients = new ZooKeeper[num_clients];
+        final DistributedQueue[] queueHandles = new DistributedQueue[num_clients];
         for(int i=0; i < clients.length; i++){
             clients[i] = createClient();
             queueHandles[i] = new DistributedQueue(clients[i], dir, null);
diff --git a/zookeeper-server/pom.xml b/zookeeper-server/pom.xml
index 307e650..5f14cb9 100755
--- a/zookeeper-server/pom.xml
+++ b/zookeeper-server/pom.xml
@@ -290,6 +290,38 @@
           </systemPropertyVariables>
         </configuration>
       </plugin>
+
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-checkstyle-plugin</artifactId>
+        <version>3.1.0</version>
+        <dependencies>
+          <dependency>
+            <groupId>com.puppycrawl.tools</groupId>
+            <artifactId>checkstyle</artifactId>
+            <version>${checkstyle.version}</version>
+          </dependency>
+        </dependencies>
+        <configuration>
+          <configLocation>checkstyle-strict.xml</configLocation>
+          <suppressionsLocation>checkstyleSuppressions.xml</suppressionsLocation>
+          <encoding>UTF-8</encoding>
+          <consoleOutput>true</consoleOutput>
+          <failOnViolation>true</failOnViolation>
+          <includeResources>false</includeResources>
+          <includeTestSourceDirectory>true</includeTestSourceDirectory>
+          <includeTestResources>false</includeTestResources>
+        </configuration>
+        <executions>
+          <execution>
+            <id>checkstyle</id>
+            <phase>validate</phase>
+            <goals>
+              <goal>check</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
     </plugins>
   </build>
 
diff --git a/zookeeper-server/src/main/java/org/apache/zookeeper/AsyncCallback.java b/zookeeper-server/src/main/java/org/apache/zookeeper/AsyncCallback.java
index 8b2233b..b8e2426 100644
--- a/zookeeper-server/src/main/java/org/apache/zookeeper/AsyncCallback.java
+++ b/zookeeper-server/src/main/java/org/apache/zookeeper/AsyncCallback.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -15,10 +15,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.apache.zookeeper;
 
 import java.util.List;
-
 import org.apache.yetus.audience.InterfaceAudience;
 import org.apache.zookeeper.data.ACL;
 import org.apache.zookeeper.data.Stat;
@@ -38,6 +38,7 @@ public interface AsyncCallback {
      */
     @InterfaceAudience.Public
     interface StatCallback extends AsyncCallback {
+
         /**
          * Process the result of the asynchronous call.
          * <p>
@@ -65,21 +66,24 @@ public interface AsyncCallback {
          * @param stat {@link org.apache.zookeeper.data.Stat} object of
          *             the node on given path.
          */
-        public void processResult(int rc, String path, Object ctx, Stat stat);
+        void processResult(int rc, String path, Object ctx, Stat stat);
+
     }
 
-    /*
-    *  This callback is used to get all children node number of the node.
-    * */
+    /**
+     *  This callback is used to get all children node number of the node.
+     */
     @InterfaceAudience.Public
     interface AllChildrenNumberCallback extends AsyncCallback {
+
         /**
          *
          * @param rc      The return code or the result of the call.
          * @param ctx     Whatever context object that we passed to asynchronous calls.
          * @param number  the number of children nodes under a specific path
          */
-        public void processResult(int rc, String path, Object ctx, int number);
+        void processResult(int rc, String path, Object ctx, int number);
+
     }
 
     /**
@@ -87,6 +91,7 @@ public interface AsyncCallback {
      */
     @InterfaceAudience.Public
     interface DataCallback extends AsyncCallback {
+
         /**
          * Process the result of asynchronous calls.
          * <p>
@@ -111,8 +116,8 @@ public interface AsyncCallback {
          * @param stat {@link org.apache.zookeeper.data.Stat} object of
          *             the node on given path.
          */
-        public void processResult(int rc, String path, Object ctx, byte data[],
-                Stat stat);
+        void processResult(int rc, String path, Object ctx, byte[] data, Stat stat);
+
     }
 
     /**
@@ -120,6 +125,7 @@ public interface AsyncCallback {
      */
     @InterfaceAudience.Public
     interface ACLCallback extends AsyncCallback {
+
         /**
          * Process the result of the asynchronous call.
          * <p>
@@ -144,8 +150,8 @@ public interface AsyncCallback {
          * @param stat {@link org.apache.zookeeper.data.Stat} object of
          *             the node on given path.
          */
-        public void processResult(int rc, String path, Object ctx,
-                List<ACL> acl, Stat stat);
+        void processResult(int rc, String path, Object ctx, List<ACL> acl, Stat stat);
+
     }
 
     /**
@@ -153,6 +159,7 @@ public interface AsyncCallback {
      */
     @InterfaceAudience.Public
     interface ChildrenCallback extends AsyncCallback {
+
         /**
          * Process the result of the asynchronous call.
          * <p>
@@ -175,8 +182,8 @@ public interface AsyncCallback {
          * @param children An unordered array of children of the node on
          *                 given path.
          */
-        public void processResult(int rc, String path, Object ctx,
-                List<String> children);
+        void processResult(int rc, String path, Object ctx, List<String> children);
+
     }
 
     /**
@@ -184,6 +191,7 @@ public interface AsyncCallback {
      */
     @InterfaceAudience.Public
     interface Children2Callback extends AsyncCallback {
+
         /**
          * Process the result of the asynchronous call.
          * See {@link org.apache.zookeeper.AsyncCallback.ChildrenCallback}.
@@ -197,8 +205,8 @@ public interface AsyncCallback {
          * @param stat     {@link org.apache.zookeeper.data.Stat} object of
          *                 the node on given path.
          */
-        public void processResult(int rc, String path, Object ctx,
-                List<String> children, Stat stat);
+        void processResult(int rc, String path, Object ctx, List<String> children, Stat stat);
+
     }
 
     /**
@@ -206,6 +214,7 @@ public interface AsyncCallback {
      */
     @InterfaceAudience.Public
     interface Create2Callback extends AsyncCallback {
+
         /**
          * Process the result of the asynchronous call.
          * See {@link org.apache.zookeeper.AsyncCallback.StringCallback}.
@@ -220,8 +229,8 @@ public interface AsyncCallback {
          * @param stat {@link org.apache.zookeeper.data.Stat} object of
          *             the node on given path.
          */
-        public void processResult(int rc, String path, Object ctx,
-        		String name, Stat stat);
+        void processResult(int rc, String path, Object ctx, String name, Stat stat);
+
     }
 
     /**
@@ -229,6 +238,7 @@ public interface AsyncCallback {
      */
     @InterfaceAudience.Public
     interface StringCallback extends AsyncCallback {
+
         /**
          * Process the result of the asynchronous call.
          * <p>
@@ -262,7 +272,8 @@ public interface AsyncCallback {
          *             On success, <i>name</i> and <i>path</i> are usually
          *             equal, unless a sequential node has been created.
          */
-        public void processResult(int rc, String path, Object ctx, String name);
+        void processResult(int rc, String path, Object ctx, String name);
+
     }
 
     /**
@@ -273,6 +284,7 @@ public interface AsyncCallback {
      */
     @InterfaceAudience.Public
     interface VoidCallback extends AsyncCallback {
+
         /**
          * Process the result of the asynchronous call.
          * <p>
@@ -305,7 +317,8 @@ public interface AsyncCallback {
          * @param ctx  Whatever context object that we passed to
          *             asynchronous calls.
          */
-        public void processResult(int rc, String path, Object ctx);
+        void processResult(int rc, String path, Object ctx);
+
     }
 
     /**
@@ -315,6 +328,7 @@ public interface AsyncCallback {
      */
     @InterfaceAudience.Public
     interface MultiCallback extends AsyncCallback {
+
         /**
          * Process the result of the asynchronous call.
          * <p>
@@ -339,8 +353,8 @@ public interface AsyncCallback {
          *                  One result for each operation,
          *                  and the order matches that of input.
          */
-        public void processResult(int rc, String path, Object ctx,
-                List<OpResult> opResults);
+        void processResult(int rc, String path, Object ctx, List<OpResult> opResults);
+
     }
 
     /**
@@ -348,12 +362,15 @@ public interface AsyncCallback {
      * a single getEphemerals call.
      */
     interface EphemeralsCallback extends AsyncCallback {
+
         /**
          *
          * @param rc      The return code or the result of the call.
          * @param ctx     Whatever context object that we passed to asynchronous calls.
          * @param paths   The path that we passed to asynchronous calls.
          */
-        public void processResult(int rc, Object ctx, List<String> paths);
+        void processResult(int rc, Object ctx, List<String> paths);
+
     }
+
 }
diff --git a/zookeeper-server/src/main/java/org/apache/zookeeper/ClientCnxn.java b/zookeeper-server/src/main/java/org/apache/zookeeper/ClientCnxn.java
index 5148dab..406ee14 100644
--- a/zookeeper-server/src/main/java/org/apache/zookeeper/ClientCnxn.java
+++ b/zookeeper-server/src/main/java/org/apache/zookeeper/ClientCnxn.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -29,30 +29,28 @@ import java.net.Socket;
 import java.net.SocketAddress;
 import java.net.SocketException;
 import java.nio.ByteBuffer;
-import java.util.HashSet;
 import java.util.ArrayDeque;
 import java.util.ArrayList;
+import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import java.util.Random;
-import java.util.Set;
 import java.util.Map.Entry;
 import java.util.Queue;
+import java.util.Random;
+import java.util.Set;
 import java.util.concurrent.CopyOnWriteArraySet;
 import java.util.concurrent.LinkedBlockingDeque;
 import java.util.concurrent.LinkedBlockingQueue;
-
 import javax.security.auth.login.LoginException;
 import javax.security.sasl.SaslException;
-
 import org.apache.jute.BinaryInputArchive;
 import org.apache.jute.BinaryOutputArchive;
 import org.apache.jute.Record;
 import org.apache.zookeeper.AsyncCallback.ACLCallback;
+import org.apache.zookeeper.AsyncCallback.AllChildrenNumberCallback;
 import org.apache.zookeeper.AsyncCallback.Children2Callback;
 import org.apache.zookeeper.AsyncCallback.ChildrenCallback;
-import org.apache.zookeeper.AsyncCallback.AllChildrenNumberCallback;
 import org.apache.zookeeper.AsyncCallback.Create2Callback;
 import org.apache.zookeeper.AsyncCallback.DataCallback;
 import org.apache.zookeeper.AsyncCallback.EphemeralsCallback;
@@ -68,8 +66,8 @@ import org.apache.zookeeper.Watcher.Event.KeeperState;
 import org.apache.zookeeper.ZooDefs.OpCode;
 import org.apache.zookeeper.ZooKeeper.States;
 import org.apache.zookeeper.ZooKeeper.WatchRegistration;
-import org.apache.zookeeper.client.ZKClientConfig;
 import org.apache.zookeeper.client.HostProvider;
+import org.apache.zookeeper.client.ZKClientConfig;
 import org.apache.zookeeper.client.ZooKeeperSaslClient;
 import org.apache.zookeeper.common.Time;
 import org.apache.zookeeper.proto.AuthPacket;
@@ -78,8 +76,8 @@ import org.apache.zookeeper.proto.Create2Response;
 import org.apache.zookeeper.proto.CreateResponse;
 import org.apache.zookeeper.proto.ExistsResponse;
 import org.apache.zookeeper.proto.GetACLResponse;
-import org.apache.zookeeper.proto.GetChildren2Response;
 import org.apache.zookeeper.proto.GetAllChildrenNumberResponse;
+import org.apache.zookeeper.proto.GetChildren2Response;
 import org.apache.zookeeper.proto.GetChildrenResponse;
 import org.apache.zookeeper.proto.GetDataResponse;
 import org.apache.zookeeper.proto.GetEphemeralsResponse;
@@ -105,6 +103,7 @@ import org.slf4j.MDC;
  */
 @SuppressFBWarnings({"EI_EXPOSE_REP", "EI_EXPOSE_REP2"})
 public class ClientCnxn {
+
     private static final Logger LOG = LoggerFactory.getLogger(ClientCnxn.class);
 
     /* ZOOKEEPER-706: If a session has a large number of watches set then
@@ -118,14 +117,16 @@ public class ClientCnxn {
     private static final int SET_WATCHES_MAX_LENGTH = 128 * 1024;
 
     static class AuthData {
-        AuthData(String scheme, byte data[]) {
+
+        AuthData(String scheme, byte[] data) {
             this.scheme = scheme;
             this.data = data;
         }
 
         String scheme;
 
-        byte data[];
+        byte[] data;
+
     }
 
     private final CopyOnWriteArraySet<AuthData> authInfo = new CopyOnWriteArraySet<AuthData>();
@@ -160,7 +161,7 @@ public class ClientCnxn {
 
     private long sessionId;
 
-    private byte sessionPasswd[] = new byte[16];
+    private byte[] sessionPasswd = new byte[16];
 
     /**
      * If true, the connection is allowed to go to r-o mode. This field's value
@@ -183,7 +184,7 @@ public class ClientCnxn {
      * operation)
      */
     private volatile boolean closing = false;
-    
+
     /**
      * A set of ZooKeeper hosts this client could connect to.
      */
@@ -204,7 +205,6 @@ public class ClientCnxn {
      */
     volatile boolean seenRwServerBefore = false;
 
-
     public ZooKeeperSaslClient zooKeeperSaslClient;
 
     private final ZKClientConfig clientConfig;
@@ -232,17 +232,16 @@ public class ClientCnxn {
 
         SocketAddress local = sendThread.getClientCnxnSocket().getLocalSocketAddress();
         SocketAddress remote = sendThread.getClientCnxnSocket().getRemoteSocketAddress();
-        sb
-            .append("sessionid:0x").append(Long.toHexString(getSessionId()))
-            .append(" local:").append(local)
-            .append(" remoteserver:").append(remote)
-            .append(" lastZxid:").append(lastZxid)
-            .append(" xid:").append(xid)
-            .append(" sent:").append(sendThread.getClientCnxnSocket().getSentCount())
-            .append(" recv:").append(sendThread.getClientCnxnSocket().getRecvCount())
-            .append(" queuedpkts:").append(outgoingQueue.size())
-            .append(" pendingresp:").append(pendingQueue.size())
-            .append(" queuedevents:").append(eventThread.waitingEvents.size());
+        sb.append("sessionid:0x").append(Long.toHexString(getSessionId()))
+          .append(" local:").append(local)
+          .append(" remoteserver:").append(remote)
+          .append(" lastZxid:").append(lastZxid)
+          .append(" xid:").append(xid)
+          .append(" sent:").append(sendThread.getClientCnxnSocket().getSentCount())
+          .append(" recv:").append(sendThread.getClientCnxnSocket().getRecvCount())
+          .append(" queuedpkts:").append(outgoingQueue.size())
+          .append(" pendingresp:").append(pendingQueue.size())
+          .append(" queuedevents:").append(eventThread.waitingEvents.size());
 
         return sb.toString();
     }
@@ -251,6 +250,7 @@ public class ClientCnxn {
      * This class allows us to pass the headers and the relevant records around.
      */
     static class Packet {
+
         RequestHeader requestHeader;
 
         ReplyHeader replyHeader;
@@ -279,16 +279,22 @@ public class ClientCnxn {
         WatchDeregistration watchDeregistration;
 
         /** Convenience ctor */
-        Packet(RequestHeader requestHeader, ReplyHeader replyHeader,
-               Record request, Record response,
-               WatchRegistration watchRegistration) {
-            this(requestHeader, replyHeader, request, response,
-                 watchRegistration, false);
+        Packet(
+            RequestHeader requestHeader,
+            ReplyHeader replyHeader,
+            Record request,
+            Record response,
+            WatchRegistration watchRegistration) {
+            this(requestHeader, replyHeader, request, response, watchRegistration, false);
         }
 
-        Packet(RequestHeader requestHeader, ReplyHeader replyHeader,
-               Record request, Record response,
-               WatchRegistration watchRegistration, boolean readOnly) {
+        Packet(
+            RequestHeader requestHeader,
+            ReplyHeader replyHeader,
+            Record request,
+            Record response,
+            WatchRegistration watchRegistration,
+            boolean readOnly) {
 
             this.requestHeader = requestHeader;
             this.replyHeader = replyHeader;
@@ -338,6 +344,7 @@ public class ClientCnxn {
             // jute toString is horrible, remove unnecessary newlines
             return sb.toString().replaceAll("\r*\n+", " ");
         }
+
     }
 
     /**
@@ -360,11 +367,24 @@ public class ClientCnxn {
      *                mode in case of partitioning
      * @throws IOException
      */
-    public ClientCnxn(String chrootPath, HostProvider hostProvider, int sessionTimeout, ZooKeeper zooKeeper,
-            ClientWatchManager watcher, ClientCnxnSocket clientCnxnSocket, boolean canBeReadOnly)
-            throws IOException {
-        this(chrootPath, hostProvider, sessionTimeout, zooKeeper, watcher,
-             clientCnxnSocket, 0, new byte[16], canBeReadOnly);
+    public ClientCnxn(
+        String chrootPath,
+        HostProvider hostProvider,
+        int sessionTimeout,
+        ZooKeeper zooKeeper,
+        ClientWatchManager watcher,
+        ClientCnxnSocket clientCnxnSocket,
+        boolean canBeReadOnly) throws IOException {
+        this(
+            chrootPath,
+            hostProvider,
+            sessionTimeout,
+            zooKeeper,
+            watcher,
+            clientCnxnSocket,
+            0,
+            new byte[16],
+            canBeReadOnly);
     }
 
     /**
@@ -388,9 +408,16 @@ public class ClientCnxn {
      *                whether the connection is allowed to go to read-only
      *                mode in case of partitioning
      */
-    public ClientCnxn(String chrootPath, HostProvider hostProvider, int sessionTimeout, ZooKeeper zooKeeper,
-            ClientWatchManager watcher, ClientCnxnSocket clientCnxnSocket,
-            long sessionId, byte[] sessionPasswd, boolean canBeReadOnly) {
+    public ClientCnxn(
+        String chrootPath,
+        HostProvider hostProvider,
+        int sessionTimeout,
+        ZooKeeper zooKeeper,
+        ClientWatchManager watcher,
+        ClientCnxnSocket clientCnxnSocket,
+        long sessionId,
+        byte[] sessionPasswd,
+        boolean canBeReadOnly) {
         this.zooKeeper = zooKeeper;
         this.watcher = watcher;
         this.sessionId = sessionId;
@@ -405,7 +432,7 @@ public class ClientCnxn {
 
         sendThread = new SendThread(clientCnxnSocket);
         eventThread = new EventThread();
-        this.clientConfig=zooKeeper.getClientConfig();
+        this.clientConfig = zooKeeper.getClientConfig();
         initRequestTimeout();
     }
 
@@ -417,6 +444,7 @@ public class ClientCnxn {
     private Object eventOfDeath = new Object();
 
     private static class WatcherSetEventPair {
+
         private final Set<Watcher> watchers;
         private final WatchedEvent event;
 
@@ -424,6 +452,7 @@ public class ClientCnxn {
             this.watchers = watchers;
             this.event = event;
         }
+
     }
 
     /**
@@ -432,14 +461,13 @@ public class ClientCnxn {
      * See ZOOKEEPER-795 for details.
      */
     private static String makeThreadName(String suffix) {
-        String name = Thread.currentThread().getName().
-            replaceAll("-EventThread", "");
+        String name = Thread.currentThread().getName().replaceAll("-EventThread", "");
         return name + suffix;
     }
 
     class EventThread extends ZooKeeperThread {
-        private final LinkedBlockingQueue<Object> waitingEvents =
-            new LinkedBlockingQueue<Object>();
+
+        private final LinkedBlockingQueue<Object> waitingEvents = new LinkedBlockingQueue<Object>();
 
         /** This is really the queued session state until the event
          * thread actually processes the event and hands it to the watcher.
@@ -447,8 +475,8 @@ public class ClientCnxn {
          */
         private volatile KeeperState sessionState = KeeperState.Disconnected;
 
-       private volatile boolean wasKilled = false;
-       private volatile boolean isRunning = false;
+        private volatile boolean wasKilled = false;
+        private volatile boolean isRunning = false;
 
         EventThread() {
             super(makeThreadName("-EventThread"));
@@ -459,18 +487,15 @@ public class ClientCnxn {
             queueEvent(event, null);
         }
 
-        private void queueEvent(WatchedEvent event,
-                Set<Watcher> materializedWatchers) {
-            if (event.getType() == EventType.None
-                    && sessionState == event.getState()) {
+        private void queueEvent(WatchedEvent event, Set<Watcher> materializedWatchers) {
+            if (event.getType() == EventType.None && sessionState == event.getState()) {
                 return;
             }
             sessionState = event.getState();
             final Set<Watcher> watchers;
             if (materializedWatchers == null) {
                 // materialize the watchers based on the event
-                watchers = watcher.materialize(event.getState(),
-                        event.getType(), event.getPath());
+                watchers = watcher.materialize(event.getState(), event.getType(), event.getPath());
             } else {
                 watchers = new HashSet<Watcher>();
                 watchers.addAll(materializedWatchers);
@@ -480,22 +505,24 @@ public class ClientCnxn {
             waitingEvents.add(pair);
         }
 
-        public void queueCallback(AsyncCallback cb, int rc, String path,
-                Object ctx) {
+        public void queueCallback(AsyncCallback cb, int rc, String path, Object ctx) {
             waitingEvents.add(new LocalCallback(cb, rc, path, ctx));
         }
 
-       @SuppressFBWarnings("JLM_JSR166_UTILCONCURRENT_MONITORENTER")
-       public void queuePacket(Packet packet) {
-          if (wasKilled) {
-             synchronized (waitingEvents) {
-                if (isRunning) waitingEvents.add(packet);
-                else processEvent(packet);
-             }
-          } else {
-             waitingEvents.add(packet);
-          }
-       }
+        @SuppressFBWarnings("JLM_JSR166_UTILCONCURRENT_MONITORENTER")
+        public void queuePacket(Packet packet) {
+            if (wasKilled) {
+                synchronized (waitingEvents) {
+                    if (isRunning) {
+                        waitingEvents.add(packet);
+                    } else {
+                        processEvent(packet);
+                    }
+                }
+            } else {
+                waitingEvents.add(packet);
+            }
+        }
 
         public void queueEventOfDeath() {
             waitingEvents.add(eventOfDeath);
@@ -504,208 +531,192 @@ public class ClientCnxn {
         @Override
         @SuppressFBWarnings("JLM_JSR166_UTILCONCURRENT_MONITORENTER")
         public void run() {
-           try {
-              isRunning = true;
-              while (true) {
-                 Object event = waitingEvents.take();
-                 if (event == eventOfDeath) {
-                    wasKilled = true;
-                 } else {
-                    processEvent(event);
-                 }
-                 if (wasKilled)
-                    synchronized (waitingEvents) {
-                       if (waitingEvents.isEmpty()) {
-                          isRunning = false;
-                          break;
-                       }
+            try {
+                isRunning = true;
+                while (true) {
+                    Object event = waitingEvents.take();
+                    if (event == eventOfDeath) {
+                        wasKilled = true;
+                    } else {
+                        processEvent(event);
                     }
-              }
-           } catch (InterruptedException e) {
-              LOG.error("Event thread exiting due to interruption", e);
-           }
+                    if (wasKilled) {
+                        synchronized (waitingEvents) {
+                            if (waitingEvents.isEmpty()) {
+                                isRunning = false;
+                                break;
+                            }
+                        }
+                    }
+                }
+            } catch (InterruptedException e) {
+                LOG.error("Event thread exiting due to interruption", e);
+            }
 
-            LOG.info("EventThread shut down for session: 0x{}",
-                     Long.toHexString(getSessionId()));
+            LOG.info("EventThread shut down for session: 0x{}", Long.toHexString(getSessionId()));
         }
 
-       private void processEvent(Object event) {
-          try {
-              if (event instanceof WatcherSetEventPair) {
-                  // each watcher will process the event
-                  WatcherSetEventPair pair = (WatcherSetEventPair) event;
-                  for (Watcher watcher : pair.watchers) {
-                      try {
-                          watcher.process(pair.event);
-                      } catch (Throwable t) {
-                          LOG.error("Error while calling watcher ", t);
-                      }
-                  }
+        private void processEvent(Object event) {
+            try {
+                if (event instanceof WatcherSetEventPair) {
+                    // each watcher will process the event
+                    WatcherSetEventPair pair = (WatcherSetEventPair) event;
+                    for (Watcher watcher : pair.watchers) {
+                        try {
+                            watcher.process(pair.event);
+                        } catch (Throwable t) {
+                            LOG.error("Error while calling watcher ", t);
+                        }
+                    }
                 } else if (event instanceof LocalCallback) {
                     LocalCallback lcb = (LocalCallback) event;
                     if (lcb.cb instanceof StatCallback) {
-                        ((StatCallback) lcb.cb).processResult(lcb.rc, lcb.path,
-                                lcb.ctx, null);
+                        ((StatCallback) lcb.cb).processResult(lcb.rc, lcb.path, lcb.ctx, null);
                     } else if (lcb.cb instanceof DataCallback) {
-                        ((DataCallback) lcb.cb).processResult(lcb.rc, lcb.path,
-                                lcb.ctx, null, null);
+                        ((DataCallback) lcb.cb).processResult(lcb.rc, lcb.path, lcb.ctx, null, null);
                     } else if (lcb.cb instanceof ACLCallback) {
-                        ((ACLCallback) lcb.cb).processResult(lcb.rc, lcb.path,
-                                lcb.ctx, null, null);
+                        ((ACLCallback) lcb.cb).processResult(lcb.rc, lcb.path, lcb.ctx, null, null);
                     } else if (lcb.cb instanceof ChildrenCallback) {
-                        ((ChildrenCallback) lcb.cb).processResult(lcb.rc,
-                                lcb.path, lcb.ctx, null);
+                        ((ChildrenCallback) lcb.cb).processResult(lcb.rc, lcb.path, lcb.ctx, null);
                     } else if (lcb.cb instanceof Children2Callback) {
-                        ((Children2Callback) lcb.cb).processResult(lcb.rc,
-                                lcb.path, lcb.ctx, null, null);
+                        ((Children2Callback) lcb.cb).processResult(lcb.rc, lcb.path, lcb.ctx, null, null);
                     } else if (lcb.cb instanceof StringCallback) {
-                        ((StringCallback) lcb.cb).processResult(lcb.rc,
-                                lcb.path, lcb.ctx, null);
+                        ((StringCallback) lcb.cb).processResult(lcb.rc, lcb.path, lcb.ctx, null);
                     } else if (lcb.cb instanceof AsyncCallback.EphemeralsCallback) {
-                        ((AsyncCallback.EphemeralsCallback) lcb.cb).processResult(lcb.rc,
-                              lcb.ctx, null);
+                        ((AsyncCallback.EphemeralsCallback) lcb.cb).processResult(lcb.rc, lcb.ctx, null);
                     } else if (lcb.cb instanceof AsyncCallback.AllChildrenNumberCallback) {
-                        ((AsyncCallback.AllChildrenNumberCallback) lcb.cb).processResult(lcb.rc,
-                                lcb.path, lcb.ctx, -1);
+                        ((AsyncCallback.AllChildrenNumberCallback) lcb.cb).processResult(lcb.rc, lcb.path, lcb.ctx, -1);
                     } else {
-                        ((VoidCallback) lcb.cb).processResult(lcb.rc, lcb.path,
-                                lcb.ctx);
+                        ((VoidCallback) lcb.cb).processResult(lcb.rc, lcb.path, lcb.ctx);
                     }
                 } else {
-                  Packet p = (Packet) event;
-                  int rc = 0;
-                  String clientPath = p.clientPath;
-                  if (p.replyHeader.getErr() != 0) {
-                      rc = p.replyHeader.getErr();
-                  }
-                  if (p.cb == null) {
-                      LOG.warn("Somehow a null cb got to EventThread!");
-                  } else if (p.response instanceof ExistsResponse
-                          || p.response instanceof SetDataResponse
-                          || p.response instanceof SetACLResponse) {
-                      StatCallback cb = (StatCallback) p.cb;
-                      if (rc == 0) {
-                          if (p.response instanceof ExistsResponse) {
-                              cb.processResult(rc, clientPath, p.ctx,
-                                      ((ExistsResponse) p.response)
-                                              .getStat());
-                          } else if (p.response instanceof SetDataResponse) {
-                              cb.processResult(rc, clientPath, p.ctx,
-                                      ((SetDataResponse) p.response)
-                                              .getStat());
-                          } else if (p.response instanceof SetACLResponse) {
-                              cb.processResult(rc, clientPath, p.ctx,
-                                      ((SetACLResponse) p.response)
-                                              .getStat());
-                          }
-                      } else {
-                          cb.processResult(rc, clientPath, p.ctx, null);
-                      }
-                  } else if (p.response instanceof GetDataResponse) {
-                      DataCallback cb = (DataCallback) p.cb;
-                      GetDataResponse rsp = (GetDataResponse) p.response;
-                      if (rc == 0) {
-                          cb.processResult(rc, clientPath, p.ctx, rsp
-                                  .getData(), rsp.getStat());
-                      } else {
-                          cb.processResult(rc, clientPath, p.ctx, null,
-                                  null);
-                      }
-                  } else if (p.response instanceof GetACLResponse) {
-                      ACLCallback cb = (ACLCallback) p.cb;
-                      GetACLResponse rsp = (GetACLResponse) p.response;
-                      if (rc == 0) {
-                          cb.processResult(rc, clientPath, p.ctx, rsp
-                                  .getAcl(), rsp.getStat());
-                      } else {
-                          cb.processResult(rc, clientPath, p.ctx, null,
-                                  null);
-                      }
-                  } else if (p.response instanceof GetChildrenResponse) {
-                      ChildrenCallback cb = (ChildrenCallback) p.cb;
-                      GetChildrenResponse rsp = (GetChildrenResponse) p.response;
-                      if (rc == 0) {
-                          cb.processResult(rc, clientPath, p.ctx, rsp
-                                  .getChildren());
-                      } else {
-                          cb.processResult(rc, clientPath, p.ctx, null);
-                      }
-                  } else if (p.response instanceof GetAllChildrenNumberResponse) {
-                      AllChildrenNumberCallback cb = (AllChildrenNumberCallback) p.cb;
-                      GetAllChildrenNumberResponse rsp = (GetAllChildrenNumberResponse) p.response;
-                      if (rc == 0) {
-                          cb.processResult(rc, clientPath, p.ctx, rsp.getTotalNumber());
-                      } else {
-                          cb.processResult(rc, clientPath, p.ctx, -1);
-                      }
-                  } else if (p.response instanceof GetChildren2Response) {
-                      Children2Callback cb = (Children2Callback) p.cb;
-                      GetChildren2Response rsp = (GetChildren2Response) p.response;
-                      if (rc == 0) {
-                          cb.processResult(rc, clientPath, p.ctx, rsp
-                                  .getChildren(), rsp.getStat());
-                      } else {
-                          cb.processResult(rc, clientPath, p.ctx, null, null);
-                      }
-                  } else if (p.response instanceof CreateResponse) {
-                      StringCallback cb = (StringCallback) p.cb;
-                      CreateResponse rsp = (CreateResponse) p.response;
-                      if (rc == 0) {
-                          cb.processResult(rc, clientPath, p.ctx,
-                                  (chrootPath == null
-                                          ? rsp.getPath()
-                                          : rsp.getPath()
-                                    .substring(chrootPath.length())));
-                      } else {
-                          cb.processResult(rc, clientPath, p.ctx, null);
-                      }
-                  } else if (p.response instanceof Create2Response) {
-                	  Create2Callback cb = (Create2Callback) p.cb;
-                      Create2Response rsp = (Create2Response) p.response;
-                      if (rc == 0) {
-                          cb.processResult(rc, clientPath, p.ctx,
-                                  (chrootPath == null
-                                          ? rsp.getPath()
-                                          : rsp.getPath()
-                                    .substring(chrootPath.length())), rsp.getStat());
-                      } else {
-                          cb.processResult(rc, clientPath, p.ctx, null, null);
-                      }                   
-                  } else if (p.response instanceof MultiResponse) {
-                	  MultiCallback cb = (MultiCallback) p.cb;
-                	  MultiResponse rsp = (MultiResponse) p.response;
-                	  if (rc == 0) {
-                		  List<OpResult> results = rsp.getResultList();
-                		  int newRc = rc;
-                		  for (OpResult result : results) {
-                			  if (result instanceof ErrorResult
-                					  && KeeperException.Code.OK.intValue() != (newRc = ((ErrorResult) result)
-                					  .getErr())) {
-                				  break;
-                			  }
-                		  }
-                		  cb.processResult(newRc, clientPath, p.ctx, results);
-                	  } else {
-                		  cb.processResult(rc, clientPath, p.ctx, null);
-                	  }
-                  } else if (p.response instanceof GetEphemeralsResponse) {
-                    EphemeralsCallback cb = (EphemeralsCallback) p.cb;
-                    GetEphemeralsResponse rsp = (GetEphemeralsResponse) p.response;
-                    if (rc == 0) {
-                      cb.processResult(rc, p.ctx, rsp.getEphemerals());
-                    } else {
-                      cb.processResult(rc, p.ctx, null);
+                    Packet p = (Packet) event;
+                    int rc = 0;
+                    String clientPath = p.clientPath;
+                    if (p.replyHeader.getErr() != 0) {
+                        rc = p.replyHeader.getErr();
                     }
-                  }
-                  else if (p.cb instanceof VoidCallback) {
-                      VoidCallback cb = (VoidCallback) p.cb;
-                      cb.processResult(rc, clientPath, p.ctx);
-                  }
-              }
-          } catch (Throwable t) {
-              LOG.error("Caught unexpected throwable", t);
-          }
-       }
+                    if (p.cb == null) {
+                        LOG.warn("Somehow a null cb got to EventThread!");
+                    } else if (p.response instanceof ExistsResponse
+                               || p.response instanceof SetDataResponse
+                               || p.response instanceof SetACLResponse) {
+                        StatCallback cb = (StatCallback) p.cb;
+                        if (rc == 0) {
+                            if (p.response instanceof ExistsResponse) {
+                                cb.processResult(rc, clientPath, p.ctx, ((ExistsResponse) p.response).getStat());
+                            } else if (p.response instanceof SetDataResponse) {
+                                cb.processResult(rc, clientPath, p.ctx, ((SetDataResponse) p.response).getStat());
+                            } else if (p.response instanceof SetACLResponse) {
+                                cb.processResult(rc, clientPath, p.ctx, ((SetACLResponse) p.response).getStat());
+                            }
+                        } else {
+                            cb.processResult(rc, clientPath, p.ctx, null);
+                        }
+                    } else if (p.response instanceof GetDataResponse) {
+                        DataCallback cb = (DataCallback) p.cb;
+                        GetDataResponse rsp = (GetDataResponse) p.response;
+                        if (rc == 0) {
+                            cb.processResult(rc, clientPath, p.ctx, rsp.getData(), rsp.getStat());
+                        } else {
+                            cb.processResult(rc, clientPath, p.ctx, null, null);
+                        }
+                    } else if (p.response instanceof GetACLResponse) {
+                        ACLCallback cb = (ACLCallback) p.cb;
+                        GetACLResponse rsp = (GetACLResponse) p.response;
+                        if (rc == 0) {
+                            cb.processResult(rc, clientPath, p.ctx, rsp.getAcl(), rsp.getStat());
+                        } else {
+                            cb.processResult(rc, clientPath, p.ctx, null, null);
+                        }
+                    } else if (p.response instanceof GetChildrenResponse) {
+                        ChildrenCallback cb = (ChildrenCallback) p.cb;
+                        GetChildrenResponse rsp = (GetChildrenResponse) p.response;
+                        if (rc == 0) {
+                            cb.processResult(rc, clientPath, p.ctx, rsp.getChildren());
+                        } else {
+                            cb.processResult(rc, clientPath, p.ctx, null);
+                        }
+                    } else if (p.response instanceof GetAllChildrenNumberResponse) {
+                        AllChildrenNumberCallback cb = (AllChildrenNumberCallback) p.cb;
+                        GetAllChildrenNumberResponse rsp = (GetAllChildrenNumberResponse) p.response;
+                        if (rc == 0) {
+                            cb.processResult(rc, clientPath, p.ctx, rsp.getTotalNumber());
+                        } else {
+                            cb.processResult(rc, clientPath, p.ctx, -1);
+                        }
+                    } else if (p.response instanceof GetChildren2Response) {
+                        Children2Callback cb = (Children2Callback) p.cb;
+                        GetChildren2Response rsp = (GetChildren2Response) p.response;
+                        if (rc == 0) {
+                            cb.processResult(rc, clientPath, p.ctx, rsp.getChildren(), rsp.getStat());
+                        } else {
+                            cb.processResult(rc, clientPath, p.ctx, null, null);
+                        }
+                    } else if (p.response instanceof CreateResponse) {
+                        StringCallback cb = (StringCallback) p.cb;
+                        CreateResponse rsp = (CreateResponse) p.response;
+                        if (rc == 0) {
+                            cb.processResult(
+                                rc,
+                                clientPath,
+                                p.ctx,
+                                (chrootPath == null
+                                    ? rsp.getPath()
+                                    : rsp.getPath().substring(chrootPath.length())));
+                        } else {
+                            cb.processResult(rc, clientPath, p.ctx, null);
+                        }
+                    } else if (p.response instanceof Create2Response) {
+                        Create2Callback cb = (Create2Callback) p.cb;
+                        Create2Response rsp = (Create2Response) p.response;
+                        if (rc == 0) {
+                            cb.processResult(
+                                    rc,
+                                    clientPath,
+                                    p.ctx,
+                                    (chrootPath == null
+                                            ? rsp.getPath()
+                                            : rsp.getPath().substring(chrootPath.length())),
+                                    rsp.getStat());
+                        } else {
+                            cb.processResult(rc, clientPath, p.ctx, null, null);
+                        }
+                    } else if (p.response instanceof MultiResponse) {
+                        MultiCallback cb = (MultiCallback) p.cb;
+                        MultiResponse rsp = (MultiResponse) p.response;
+                        if (rc == 0) {
+                            List<OpResult> results = rsp.getResultList();
+                            int newRc = rc;
+                            for (OpResult result : results) {
+                                if (result instanceof ErrorResult
+                                    && KeeperException.Code.OK.intValue()
+                                       != (newRc = ((ErrorResult) result).getErr())) {
+                                    break;
+                                }
+                            }
+                            cb.processResult(newRc, clientPath, p.ctx, results);
+                        } else {
+                            cb.processResult(rc, clientPath, p.ctx, null);
+                        }
+                    } else if (p.response instanceof GetEphemeralsResponse) {
+                        EphemeralsCallback cb = (EphemeralsCallback) p.cb;
+                        GetEphemeralsResponse rsp = (GetEphemeralsResponse) p.response;
+                        if (rc == 0) {
+                            cb.processResult(rc, p.ctx, rsp.getEphemerals());
+                        } else {
+                            cb.processResult(rc, p.ctx, null);
+                        }
+                    } else if (p.cb instanceof VoidCallback) {
+                        VoidCallback cb = (VoidCallback) p.cb;
+                        cb.processResult(rc, clientPath, p.ctx);
+                    }
+                }
+            } catch (Throwable t) {
+                LOG.error("Caught unexpected throwable", t);
+            }
+        }
+
     }
 
     // @VisibleForTesting
@@ -720,12 +731,10 @@ public class ClientCnxn {
             Map<EventType, Set<Watcher>> materializedWatchers = null;
             try {
                 materializedWatchers = p.watchDeregistration.unregister(err);
-                for (Entry<EventType, Set<Watcher>> entry : materializedWatchers
-                        .entrySet()) {
+                for (Entry<EventType, Set<Watcher>> entry : materializedWatchers.entrySet()) {
                     Set<Watcher> watchers = entry.getValue();
                     if (watchers.size() > 0) {
-                        queueEvent(p.watchDeregistration.getClientPath(), err,
-                                watchers, entry.getKey());
+                        queueEvent(p.watchDeregistration.getClientPath(), err, watchers, entry.getKey());
                         // ignore connectionloss when removing from local
                         // session
                         p.replyHeader.setErr(Code.OK.intValue());
@@ -749,15 +758,13 @@ public class ClientCnxn {
         }
     }
 
-    void queueEvent(String clientPath, int err,
-            Set<Watcher> materializedWatchers, EventType eventType) {
+    void queueEvent(String clientPath, int err, Set<Watcher> materializedWatchers, EventType eventType) {
         KeeperState sessionState = KeeperState.SyncConnected;
         if (KeeperException.Code.SESSIONEXPIRED.intValue() == err
-                || KeeperException.Code.CONNECTIONLOSS.intValue() == err) {
+            || KeeperException.Code.CONNECTIONLOSS.intValue() == err) {
             sessionState = Event.KeeperState.Disconnected;
         }
-        WatchedEvent event = new WatchedEvent(eventType, sessionState,
-                clientPath);
+        WatchedEvent event = new WatchedEvent(eventType, sessionState, clientPath);
         eventThread.queueEvent(event, materializedWatchers);
     }
 
@@ -789,40 +796,48 @@ public class ClientCnxn {
     }
 
     static class EndOfStreamException extends IOException {
+
         private static final long serialVersionUID = -5438877188796231422L;
 
         public EndOfStreamException(String msg) {
             super(msg);
         }
-        
+
         @Override
         public String toString() {
             return "EndOfStreamException: " + getMessage();
         }
+
     }
 
     private static class SessionTimeoutException extends IOException {
+
         private static final long serialVersionUID = 824482094072071178L;
 
         public SessionTimeoutException(String msg) {
             super(msg);
         }
+
     }
-    
+
     private static class SessionExpiredException extends IOException {
+
         private static final long serialVersionUID = -1388816932076193249L;
 
         public SessionExpiredException(String msg) {
             super(msg);
         }
+
     }
 
     private static class RWServerFoundException extends IOException {
+
         private static final long serialVersionUID = 90431199887158758L;
 
         public RWServerFoundException(String msg) {
             super(msg);
         }
+
     }
 
     /**
@@ -830,14 +845,14 @@ public class ClientCnxn {
      * beats. It also spawns the ReadThread.
      */
     class SendThread extends ZooKeeperThread {
+
         private long lastPingSentNs;
         private final ClientCnxnSocket clientCnxnSocket;
         private Random r = new Random();
         private boolean isFirstConnect = true;
 
         void readResponse(ByteBuffer incomingBuffer) throws IOException {
-            ByteBufferInputStream bbis = new ByteBufferInputStream(
-                    incomingBuffer);
+            ByteBufferInputStream bbis = new ByteBufferInputStream(incomingBuffer);
             BinaryInputArchive bbia = BinaryInputArchive.getArchive(bbis);
             ReplyHeader replyHdr = new ReplyHeader();
 
@@ -846,32 +861,29 @@ public class ClientCnxn {
                 // -2 is the xid for pings
                 if (LOG.isDebugEnabled()) {
                     LOG.debug("Got ping response for sessionid: 0x"
-                            + Long.toHexString(sessionId)
-                            + " after "
-                            + ((System.nanoTime() - lastPingSentNs) / 1000000)
-                            + "ms");
+                              + Long.toHexString(sessionId)
+                              + " after "
+                              + ((System.nanoTime() - lastPingSentNs) / 1000000)
+                              + "ms");
                 }
                 return;
             }
             if (replyHdr.getXid() == -4) {
-                // -4 is the xid for AuthPacket               
-                if(replyHdr.getErr() == KeeperException.Code.AUTHFAILED.intValue()) {
-                    state = States.AUTH_FAILED;                    
-                    eventThread.queueEvent( new WatchedEvent(Watcher.Event.EventType.None, 
-                            Watcher.Event.KeeperState.AuthFailed, null) );
+                // -4 is the xid for AuthPacket
+                if (replyHdr.getErr() == KeeperException.Code.AUTHFAILED.intValue()) {
+                    state = States.AUTH_FAILED;
+                    eventThread.queueEvent(new WatchedEvent(Watcher.Event.EventType.None, Watcher.Event.KeeperState.AuthFailed, null));
                     eventThread.queueEventOfDeath();
                 }
                 if (LOG.isDebugEnabled()) {
-                    LOG.debug("Got auth sessionid:0x"
-                            + Long.toHexString(sessionId));
+                    LOG.debug("Got auth sessionid:0x" + Long.toHexString(sessionId));
                 }
                 return;
             }
             if (replyHdr.getXid() == -1) {
                 // -1 means notification
                 if (LOG.isDebugEnabled()) {
-                    LOG.debug("Got notification sessionid:0x"
-                        + Long.toHexString(sessionId));
+                    LOG.debug("Got notification sessionid:0x" + Long.toHexString(sessionId));
                 }
                 WatcherEvent event = new WatcherEvent();
                 event.deserialize(bbia, "response");
@@ -879,24 +891,24 @@ public class ClientCnxn {
                 // convert from a server path to a client path
                 if (chrootPath != null) {
                     String serverPath = event.getPath();
-                    if(serverPath.compareTo(chrootPath)==0)
+                    if (serverPath.compareTo(chrootPath) == 0) {
                         event.setPath("/");
-                    else if (serverPath.length() > chrootPath.length())
+                    } else if (serverPath.length() > chrootPath.length()) {
                         event.setPath(serverPath.substring(chrootPath.length()));
-                    else {
-                    	LOG.warn("Got server path " + event.getPath()
-                    			+ " which is too short for chroot path "
-                    			+ chrootPath);
+                    } else {
+                        LOG.warn("Got server path "
+                                 + event.getPath()
+                                 + " which is too short for chroot path "
+                                 + chrootPath);
                     }
                 }
 
                 WatchedEvent we = new WatchedEvent(event);
                 if (LOG.isDebugEnabled()) {
-                    LOG.debug("Got " + we + " for sessionid 0x"
-                            + Long.toHexString(sessionId));
+                    LOG.debug("Got " + we + " for sessionid 0x" + Long.toHexString(sessionId));
                 }
 
-                eventThread.queueEvent( we );
+                eventThread.queueEvent(we);
                 return;
             }
 
@@ -905,17 +917,15 @@ public class ClientCnxn {
             // response as with other packets.
             if (tunnelAuthInProgress()) {
                 GetSASLRequest request = new GetSASLRequest();
-                request.deserialize(bbia,"token");
-                zooKeeperSaslClient.respondToServer(request.getToken(),
-                  ClientCnxn.this);
+                request.deserialize(bbia, "token");
+                zooKeeperSaslClient.respondToServer(request.getToken(), ClientCnxn.this);
                 return;
             }
 
             Packet packet;
             synchronized (pendingQueue) {
                 if (pendingQueue.size() == 0) {
-                    throw new IOException("Nothing in the queue, but got "
-                            + replyHdr.getXid());
+                    throw new IOException("Nothing in the queue, but got " + replyHdr.getXid());
                 }
                 packet = pendingQueue.remove();
             }
@@ -925,15 +935,11 @@ public class ClientCnxn {
              */
             try {
                 if (packet.requestHeader.getXid() != replyHdr.getXid()) {
-                    packet.replyHeader.setErr(
-                            KeeperException.Code.CONNECTIONLOSS.intValue());
-                    throw new IOException("Xid out of order. Got Xid "
-                            + replyHdr.getXid() + " with err " +
-                            + replyHdr.getErr() +
-                            " expected Xid "
-                            + packet.requestHeader.getXid()
-                            + " for a packet with details: "
-                            + packet );
+                    packet.replyHeader.setErr(KeeperException.Code.CONNECTIONLOSS.intValue());
+                    throw new IOException("Xid out of order. Got Xid " + replyHdr.getXid()
+                                          + " with err " + replyHdr.getErr()
+                                          + " expected Xid " + packet.requestHeader.getXid()
+                                          + " for a packet with details: " + packet);
                 }
 
                 packet.replyHeader.setXid(replyHdr.getXid());
@@ -947,8 +953,7 @@ public class ClientCnxn {
                 }
 
                 if (LOG.isDebugEnabled()) {
-                    LOG.debug("Reading reply sessionid:0x"
-                            + Long.toHexString(sessionId) + ", packet:: " + packet);
+                    LOG.debug("Reading reply sessionid:0x" + Long.toHexString(sessionId) + ", packet:: " + packet);
                 }
             } finally {
                 finishPacket(packet);
@@ -968,7 +973,7 @@ public class ClientCnxn {
         // Runnable
         /**
          * Used by ClientCnxnSocket
-         * 
+         *
          * @return
          */
         ZooKeeper.States getZkState() {
@@ -983,13 +988,13 @@ public class ClientCnxn {
          * Setup session, previous watches, authentication.
          */
         void primeConnection() throws IOException {
-            LOG.info("Socket connection established, initiating session, client: {}, server: {}",
-                    clientCnxnSocket.getLocalSocketAddress(),
-                    clientCnxnSocket.getRemoteSocketAddress());
+            LOG.info(
+                "Socket connection established, initiating session, client: {}, server: {}",
+                clientCnxnSocket.getLocalSocketAddress(),
+                clientCnxnSocket.getRemoteSocketAddress());
             isFirstConnect = false;
             long sessId = (seenRwServerBefore) ? sessionId : 0;
-            ConnectRequest conReq = new ConnectRequest(0, lastZxid,
-                    sessionTimeout, sessId, sessionPasswd);
+            ConnectRequest conReq = new ConnectRequest(0, lastZxid, sessionTimeout, sessId, sessionPasswd);
             // We add backwards since we are pushing into the front
             // Only send if there's a pending watch
             // TODO: here we have the only remaining use of zooKeeper in
@@ -998,15 +1003,13 @@ public class ClientCnxn {
                 List<String> dataWatches = zooKeeper.getDataWatches();
                 List<String> existWatches = zooKeeper.getExistWatches();
                 List<String> childWatches = zooKeeper.getChildWatches();
-                if (!dataWatches.isEmpty()
-                        || !existWatches.isEmpty() || !childWatches.isEmpty()) {
+                if (!dataWatches.isEmpty() || !existWatches.isEmpty() || !childWatches.isEmpty()) {
                     Iterator<String> dataWatchesIter = prependChroot(dataWatches).iterator();
                     Iterator<String> existWatchesIter = prependChroot(existWatches).iterator();
                     Iterator<String> childWatchesIter = prependChroot(childWatches).iterator();
                     long setWatchesLastZxid = lastZxid;
 
-                    while (dataWatchesIter.hasNext()
-                           || existWatchesIter.hasNext() || childWatchesIter.hasNext()) {
+                    while (dataWatchesIter.hasNext() || existWatchesIter.hasNext() || childWatchesIter.hasNext()) {
                         List<String> dataWatchesBatch = new ArrayList<String>();
                         List<String> existWatchesBatch = new ArrayList<String>();
                         List<String> childWatchesBatch = new ArrayList<String>();
@@ -1031,10 +1034,7 @@ public class ClientCnxn {
                             batchLength += watch.length();
                         }
 
-                        SetWatches sw = new SetWatches(setWatchesLastZxid,
-                                                       dataWatchesBatch,
-                                                       existWatchesBatch,
-                                                       childWatchesBatch);
+                        SetWatches sw = new SetWatches(setWatchesLastZxid, dataWatchesBatch, existWatchesBatch, childWatchesBatch);
                         RequestHeader header = new RequestHeader(-8, OpCode.setWatches);
                         Packet packet = new Packet(header, new ReplyHeader(), sw, null, null);
                         outgoingQueue.addFirst(packet);
@@ -1043,15 +1043,17 @@ public class ClientCnxn {
             }
 
             for (AuthData id : authInfo) {
-                outgoingQueue.addFirst(new Packet(new RequestHeader(-4,
-                        OpCode.auth), null, new AuthPacket(0, id.scheme,
-                        id.data), null, null));
+                outgoingQueue.addFirst(
+                    new Packet(
+                        new RequestHeader(-4, OpCode.auth),
+                        null,
+                        new AuthPacket(0, id.scheme, id.data),
+                        null,
+                        null));
             }
-            outgoingQueue.addFirst(new Packet(null, null, conReq,
-                    null, null, readOnly));
+            outgoingQueue.addFirst(new Packet(null, null, conReq, null, null, readOnly));
             clientCnxnSocket.connectionPrimed();
-            LOG.debug("Session establishment request sent on {}",
-                        clientCnxnSocket.getRemoteSocketAddress());
+            LOG.debug("Session establishment request sent on {}", clientCnxnSocket.getRemoteSocketAddress());
         }
 
         private List<String> prependChroot(List<String> paths) {
@@ -1079,9 +1081,9 @@ public class ClientCnxn {
 
         private InetSocketAddress rwServerAddress = null;
 
-        private final static int minPingRwTimeout = 100;
+        private static final int minPingRwTimeout = 100;
 
-        private final static int maxPingRwTimeout = 60000;
+        private static final int maxPingRwTimeout = 60000;
 
         private int pingRwTimeout = minPingRwTimeout;
 
@@ -1092,7 +1094,7 @@ public class ClientCnxn {
         private void startConnect(InetSocketAddress addr) throws IOException {
             // initializing it for new connection
             saslLoginFailed = false;
-            if(!isFirstConnect){
+            if (!isFirstConnect) {
                 try {
                     Thread.sleep(r.nextInt(1000));
                 } catch (InterruptedException e) {
@@ -1109,18 +1111,17 @@ public class ClientCnxn {
                     if (zooKeeperSaslClient != null) {
                         zooKeeperSaslClient.shutdown();
                     }
-                    zooKeeperSaslClient = new ZooKeeperSaslClient(SaslServerPrincipal.getServerPrincipal(addr, clientConfig),
-                        clientConfig);
+                    zooKeeperSaslClient = new ZooKeeperSaslClient(SaslServerPrincipal.getServerPrincipal(addr, clientConfig), clientConfig);
                 } catch (LoginException e) {
                     // An authentication error occurred when the SASL client tried to initialize:
                     // for Kerberos this means that the client failed to authenticate with the KDC.
                     // This is different from an authentication error that occurs during communication
                     // with the Zookeeper server, which is handled below.
-                    LOG.warn("SASL configuration failed: " + e + " Will continue connection to Zookeeper server without "
-                      + "SASL authentication, if Zookeeper server allows it.");
-                    eventThread.queueEvent(new WatchedEvent(
-                      Watcher.Event.EventType.None,
-                      Watcher.Event.KeeperState.AuthFailed, null));
+                    LOG.warn("SASL configuration failed: "
+                             + e
+                             + " Will continue connection to Zookeeper server without "
+                             + "SASL authentication, if Zookeeper server allows it.");
+                    eventThread.queueEvent(new WatchedEvent(Watcher.Event.EventType.None, Watcher.Event.KeeperState.AuthFailed, null));
                     saslLoginFailed = true;
                 }
             }
@@ -1132,13 +1133,12 @@ public class ClientCnxn {
         private void logStartConnect(InetSocketAddress addr) {
             String msg = "Opening socket connection to server " + addr;
             if (zooKeeperSaslClient != null) {
-              msg += ". " + zooKeeperSaslClient.getConfigStatus();
+                msg += ". " + zooKeeperSaslClient.getConfigStatus();
             }
             LOG.info(msg);
         }
 
-        private static final String RETRY_CONN_MSG =
-            ", closing socket connection and attempting reconnect";
+        private static final String RETRY_CONN_MSG = ", closing socket connection and attempting reconnect";
         @Override
         public void run() {
             clientCnxnSocket.introduce(this, sessionId, outgoingQueue);
@@ -1173,7 +1173,7 @@ public class ClientCnxn {
                                 try {
                                     zooKeeperSaslClient.initialize(ClientCnxn.this);
                                 } catch (SaslException e) {
-                                   LOG.error("SASL authentication with Zookeeper Quorum member failed: " + e);
+                                    LOG.error("SASL authentication with Zookeeper Quorum member failed: " + e);
                                     state = States.AUTH_FAILED;
                                     sendAuthEvent = true;
                                 }
@@ -1192,11 +1192,9 @@ public class ClientCnxn {
                             }
 
                             if (sendAuthEvent) {
-                                eventThread.queueEvent(new WatchedEvent(
-                                      Watcher.Event.EventType.None,
-                                      authState,null));
+                                eventThread.queueEvent(new WatchedEvent(Watcher.Event.EventType.None, authState, null));
                                 if (state == States.AUTH_FAILED) {
-                                  eventThread.queueEventOfDeath();
+                                    eventThread.queueEventOfDeath();
                                 }
                             }
                         }
@@ -1204,22 +1202,21 @@ public class ClientCnxn {
                     } else {
                         to = connectTimeout - clientCnxnSocket.getIdleRecv();
                     }
-                    
+
                     if (to <= 0) {
                         String warnInfo;
                         warnInfo = "Client session timed out, have not heard from server in "
-                            + clientCnxnSocket.getIdleRecv()
-                            + "ms"
-                            + " for sessionid 0x"
-                            + Long.toHexString(sessionId);
+                                   + clientCnxnSocket.getIdleRecv() + "ms"
+                                   + " for sessionid 0x" + Long.toHexString(sessionId);
                         LOG.warn(warnInfo);
                         throw new SessionTimeoutException(warnInfo);
                     }
                     if (state.isConnected()) {
-                    	//1000(1 second) is to prevent race condition missing to send the second ping
-                    	//also make sure not to send too many pings when readTimeout is small 
-                        int timeToNextPing = readTimeout / 2 - clientCnxnSocket.getIdleSend() - 
-                        		((clientCnxnSocket.getIdleSend() > 1000) ? 1000 : 0);
+                        //1000(1 second) is to prevent race condition missing to send the second ping
+                        //also make sure not to send too many pings when readTimeout is small
+                        int timeToNextPing = readTimeout / 2
+                                             - clientCnxnSocket.getIdleSend()
+                                             - ((clientCnxnSocket.getIdleSend() > 1000) ? 1000 : 0);
                         //send a ping request either time is due or no packet sent out within MAX_SEND_PING_INTERVAL
                         if (timeToNextPing <= 0 || clientCnxnSocket.getIdleSend() > MAX_SEND_PING_INTERVAL) {
                             sendPing();
@@ -1238,8 +1235,7 @@ public class ClientCnxn {
                         if (idlePingRwServer >= pingRwTimeout) {
                             lastPingRwServer = now;
                             idlePingRwServer = 0;
-                            pingRwTimeout =
-                                Math.min(2*pingRwTimeout, maxPingRwTimeout);
+                            pingRwTimeout = Math.min(2 * pingRwTimeout, maxPingRwTimeout);
                             pingRwServer();
                         }
                         to = Math.min(to, pingRwTimeout - idlePingRwServer);
@@ -1251,8 +1247,9 @@ public class ClientCnxn {
                         if (LOG.isDebugEnabled()) {
                             // closing so this is expected
                             LOG.debug("An exception was thrown while closing send thread for session 0x"
-                                    + Long.toHexString(getSessionId())
-                                    + " : " + e.getMessage());
+                                      + Long.toHexString(getSessionId())
+                                      + " : "
+                                      + e.getMessage());
                         }
                         break;
                     } else {
@@ -1269,10 +1266,10 @@ public class ClientCnxn {
                             LOG.info("Socket error occurred: {}: {}", serverAddress, e.getMessage());
                         } else {
                             LOG.warn("Session 0x{} for server {}, unexpected error{}",
-                                            Long.toHexString(getSessionId()),
-                                            serverAddress,
-                                            RETRY_CONN_MSG,
-                                            e);
+                                     Long.toHexString(getSessionId()),
+                                     serverAddress,
+                                     RETRY_CONN_MSG,
+                                     e);
                         }
                         // At this point, there might still be new packets appended to outgoingQueue.
                         // they will be handled in next connection or cleared up if closed.
@@ -1287,21 +1284,19 @@ public class ClientCnxn {
             }
             clientCnxnSocket.close();
             if (state.isAlive()) {
-                eventThread.queueEvent(new WatchedEvent(Event.EventType.None,
-                        Event.KeeperState.Disconnected, null));
+                eventThread.queueEvent(new WatchedEvent(Event.EventType.None, Event.KeeperState.Disconnected, null));
             }
-            eventThread.queueEvent(new WatchedEvent(Event.EventType.None,
-                        Event.KeeperState.Closed, null));
-            ZooTrace.logTraceMessage(LOG, ZooTrace.getTextTraceLevel(),
-                    "SendThread exited loop for session: 0x"
-                           + Long.toHexString(getSessionId()));
+            eventThread.queueEvent(new WatchedEvent(Event.EventType.None, Event.KeeperState.Closed, null));
+            ZooTrace.logTraceMessage(
+                LOG,
+                ZooTrace.getTextTraceLevel(),
+                "SendThread exited loop for session: 0x" + Long.toHexString(getSessionId()));
         }
 
         private void cleanAndNotifyState() {
             cleanup();
             if (state.isAlive()) {
-                eventThread.queueEvent(new WatchedEvent(Event.EventType.None,
-                        Event.KeeperState.Disconnected, null));
+                eventThread.queueEvent(new WatchedEvent(Event.EventType.None, Event.KeeperState.Disconnected, null));
             }
             clientCnxnSocket.updateNow();
             clientCnxnSocket.updateLastSendAndHeard();
@@ -1310,8 +1305,7 @@ public class ClientCnxn {
         private void pingRwServer() throws RWServerFoundException {
             String result = null;
             InetSocketAddress addr = hostProvider.next(0);
-            LOG.info("Checking server " + addr + " for being r/w." +
-                    " Timeout " + pingRwTimeout);
+            LOG.info("Checking server " + addr + " for being r/w." + " Timeout " + pingRwTimeout);
 
             Socket sock = null;
             BufferedReader br = null;
@@ -1323,15 +1317,13 @@ public class ClientCnxn {
                 sock.getOutputStream().write("isro".getBytes());
                 sock.getOutputStream().flush();
                 sock.shutdownOutput();
-                br = new BufferedReader(
-                        new InputStreamReader(sock.getInputStream()));
+                br = new BufferedReader(new InputStreamReader(sock.getInputStream()));
                 result = br.readLine();
             } catch (ConnectException e) {
                 // ignore, this just means server is not up
             } catch (IOException e) {
                 // some unexpected error, warn about it
-                LOG.warn("Exception while seeking for r/w server " +
-                        e.getMessage(), e);
+                LOG.warn("Exception while seeking for r/w server " + e.getMessage(), e);
             } finally {
                 if (sock != null) {
                     try {
@@ -1355,7 +1347,7 @@ public class ClientCnxn {
                 // connection attempt
                 rwServerAddress = addr;
                 throw new RWServerFoundException("Majority server found at "
-                        + addr.getHostString() + ":" + addr.getPort());
+                                                 + addr.getHostString() + ":" + addr.getPort());
             }
         }
 
@@ -1381,27 +1373,29 @@ public class ClientCnxn {
         /**
          * Callback invoked by the ClientCnxnSocket once a connection has been
          * established.
-         * 
+         *
          * @param _negotiatedSessionTimeout
          * @param _sessionId
          * @param _sessionPasswd
          * @param isRO
          * @throws IOException
          */
-        void onConnected(int _negotiatedSessionTimeout, long _sessionId,
-                byte[] _sessionPasswd, boolean isRO) throws IOException {
+        void onConnected(
+            int _negotiatedSessionTimeout,
+            long _sessionId,
+            byte[] _sessionPasswd,
+            boolean isRO) throws IOException {
             negotiatedSessionTimeout = _negotiatedSessionTimeout;
             if (negotiatedSessionTimeout <= 0) {
                 state = States.CLOSED;
 
-                eventThread.queueEvent(new WatchedEvent(
-                        Watcher.Event.EventType.None,
-                        Watcher.Event.KeeperState.Expired, null));
+                eventThread.queueEvent(new WatchedEvent(Watcher.Event.EventType.None, Watcher.Event.KeeperState.Expired, null));
                 eventThread.queueEventOfDeath();
 
                 String warnInfo;
                 warnInfo = "Unable to reconnect to ZooKeeper service, session 0x"
-                    + Long.toHexString(sessionId) + " has expired";
+                           + Long.toHexString(sessionId)
+                           + " has expired";
                 LOG.warn(warnInfo);
                 throw new SessionExpiredException(warnInfo);
             }
@@ -1413,19 +1407,15 @@ public class ClientCnxn {
             hostProvider.onConnected();
             sessionId = _sessionId;
             sessionPasswd = _sessionPasswd;
-            state = (isRO) ?
-                    States.CONNECTEDREADONLY : States.CONNECTED;
+            state = (isRO) ? States.CONNECTEDREADONLY : States.CONNECTED;
             seenRwServerBefore |= !isRO;
             LOG.info("Session establishment complete on server "
-                    + clientCnxnSocket.getRemoteSocketAddress()
-                    + ", sessionid = 0x" + Long.toHexString(sessionId)
-                    + ", negotiated timeout = " + negotiatedSessionTimeout
-                    + (isRO ? " (READ-ONLY mode)" : ""));
-            KeeperState eventState = (isRO) ?
-                    KeeperState.ConnectedReadOnly : KeeperState.SyncConnected;
-            eventThread.queueEvent(new WatchedEvent(
-                    Watcher.Event.EventType.None,
-                    eventState, null));
+                     + clientCnxnSocket.getRemoteSocketAddress()
+                     + ", sessionid = 0x" + Long.toHexString(sessionId)
+                     + ", negotiated timeout = " + negotiatedSessionTimeout
+                     + (isRO ? " (READ-ONLY mode)" : ""));
+            KeeperState eventState = (isRO) ? KeeperState.ConnectedReadOnly : KeeperState.SyncConnected;
+            eventThread.queueEvent(new WatchedEvent(Watcher.Event.EventType.None, eventState, null));
         }
 
         void close() {
@@ -1461,6 +1451,7 @@ public class ClientCnxn {
         public void sendPacket(Packet p) throws IOException {
             clientCnxnSocket.sendPacket(p);
         }
+
     }
 
     /**
@@ -1471,8 +1462,7 @@ public class ClientCnxn {
      */
     public void disconnect() {
         if (LOG.isDebugEnabled()) {
-            LOG.debug("Disconnecting client for session: 0x"
-                      + Long.toHexString(getSessionId()));
+            LOG.debug("Disconnecting client for session: 0x" + Long.toHexString(getSessionId()));
         }
 
         sendThread.close();
@@ -1495,8 +1485,7 @@ public class ClientCnxn {
      */
     public void close() throws IOException {
         if (LOG.isDebugEnabled()) {
-            LOG.debug("Closing client for session: 0x"
-                      + Long.toHexString(getSessionId()));
+            LOG.debug("Closing client for session: 0x" + Long.toHexString(getSessionId()));
         }
 
         try {
@@ -1521,7 +1510,7 @@ public class ClientCnxn {
      * getXid() is called externally by ClientCnxnNIO::doIO() when packets are sent from the outgoingQueue to
      * the server. Thus, getXid() must be public.
      */
-    synchronized public int getXid() {
+    public synchronized int getXid() {
         // Avoid negative cxid values.  In particular, cxid values of -4, -2, and -1 are special and
         // must not be used for requests -- see SendThread.readResponse.
         // Skip from MAX to 1.
@@ -1531,19 +1520,32 @@ public class ClientCnxn {
         return xid++;
     }
 
-    public ReplyHeader submitRequest(RequestHeader h, Record request,
-            Record response, WatchRegistration watchRegistration)
-            throws InterruptedException {
+    public ReplyHeader submitRequest(
+        RequestHeader h,
+        Record request,
+        Record response,
+        WatchRegistration watchRegistration) throws InterruptedException {
         return submitRequest(h, request, response, watchRegistration, null);
     }
 
-    public ReplyHeader submitRequest(RequestHeader h, Record request,
-            Record response, WatchRegistration watchRegistration,
-            WatchDeregistration watchDeregistration)
-            throws InterruptedException {
+    public ReplyHeader submitRequest(
+        RequestHeader h,
+        Record request,
+        Record response,
+        WatchRegistration watchRegistration,
+        WatchDeregistration watchDeregistration) throws InterruptedException {
         ReplyHeader r = new ReplyHeader();
-        Packet packet = queuePacket(h, r, request, response, null, null, null,
-                null, watchRegistration, watchDeregistration);
+        Packet packet = queuePacket(
+            h,
+            r,
+            request,
+            response,
+            null,
+            null,
+            null,
+            null,
+            watchRegistration,
+            watchDeregistration);
         synchronized (packet) {
             if (requestTimeout > 0) {
                 // Wait for request completion with timeout
@@ -1564,15 +1566,12 @@ public class ClientCnxn {
     /**
      * Wait for request completion with timeout.
      */
-    private void waitForPacketFinish(ReplyHeader r, Packet packet)
-            throws InterruptedException {
+    private void waitForPacketFinish(ReplyHeader r, Packet packet) throws InterruptedException {
         long waitStartTime = Time.currentElapsedTime();
         while (!packet.finished) {
             packet.wait(requestTimeout);
-            if (!packet.finished && ((Time.currentElapsedTime()
-                    - waitStartTime) >= requestTimeout)) {
-                LOG.error("Timeout error occurred for the packet '{}'.",
-                        packet);
+            if (!packet.finished && ((Time.currentElapsedTime() - waitStartTime) >= requestTimeout)) {
+                LOG.error("Timeout error occurred for the packet '{}'.", packet);
                 r.setErr(Code.REQUESTTIMEOUT.intValue());
                 break;
             }
@@ -1583,8 +1582,7 @@ public class ClientCnxn {
         sendThread.getClientCnxnSocket().saslCompleted();
     }
 
-    public void sendPacket(Record request, Record response, AsyncCallback cb, int opCode)
-    throws IOException {
+    public void sendPacket(Record request, Record response, AsyncCallback cb, int opCode) throws IOException {
         // Generate Xid now because it will be sent immediately,
         // by call to sendThread.sendPacket() below.
         int xid = getXid();
@@ -1600,17 +1598,30 @@ public class ClientCnxn {
         sendThread.sendPacket(p);
     }
 
-    public Packet queuePacket(RequestHeader h, ReplyHeader r, Record request,
-            Record response, AsyncCallback cb, String clientPath,
-            String serverPath, Object ctx, WatchRegistration watchRegistration) {
-        return queuePacket(h, r, request, response, cb, clientPath, serverPath,
-                ctx, watchRegistration, null);
+    public Packet queuePacket(
+        RequestHeader h,
+        ReplyHeader r,
+        Record request,
+        Record response,
+        AsyncCallback cb,
+        String clientPath,
+        String serverPath,
+        Object ctx,
+        WatchRegistration watchRegistration) {
+        return queuePacket(h, r, request, response, cb, clientPath, serverPath, ctx, watchRegistration, null);
     }
 
-    public Packet queuePacket(RequestHeader h, ReplyHeader r, Record request,
-            Record response, AsyncCallback cb, String clientPath,
-            String serverPath, Object ctx, WatchRegistration watchRegistration,
-            WatchDeregistration watchDeregistration) {
+    public Packet queuePacket(
+        RequestHeader h,
+        ReplyHeader r,
+        Record request,
+        Record response,
+        AsyncCallback cb,
+        String clientPath,
+        String serverPath,
+        Object ctx,
+        WatchRegistration watchRegistration,
+        WatchDeregistration watchDeregistration) {
         Packet packet = null;
 
         // Note that we do not generate the Xid for the packet yet. It is
@@ -1642,14 +1653,21 @@ public class ClientCnxn {
         return packet;
     }
 
-    public void addAuthInfo(String scheme, byte auth[]) {
+    public void addAuthInfo(String scheme, byte[] auth) {
         if (!state.isAlive()) {
             return;
         }
         authInfo.add(new AuthData(scheme, auth));
-        queuePacket(new RequestHeader(-4, OpCode.auth), null,
-                new AuthPacket(0, scheme, auth), null, null, null, null,
-                null, null);
+        queuePacket(
+            new RequestHeader(-4, OpCode.auth),
+            null,
+            new AuthPacket(0, scheme, auth),
+            null,
+            null,
+            null,
+            null,
+            null,
+            null);
     }
 
     States getState() {
@@ -1657,6 +1675,7 @@ public class ClientCnxn {
     }
 
     private static class LocalCallback {
+
         private final AsyncCallback cb;
         private final int rc;
         private final String path;
@@ -1668,23 +1687,26 @@ public class ClientCnxn {
             this.path = path;
             this.ctx = ctx;
         }
+
     }
 
     private void initRequestTimeout() {
         try {
             requestTimeout = clientConfig.getLong(
-                    ZKClientConfig.ZOOKEEPER_REQUEST_TIMEOUT,
-                    ZKClientConfig.ZOOKEEPER_REQUEST_TIMEOUT_DEFAULT);
-            LOG.info("{} value is {}. feature enabled=",
-                    ZKClientConfig.ZOOKEEPER_REQUEST_TIMEOUT,
-                    requestTimeout, requestTimeout > 0);
+                ZKClientConfig.ZOOKEEPER_REQUEST_TIMEOUT,
+                ZKClientConfig.ZOOKEEPER_REQUEST_TIMEOUT_DEFAULT);
+            LOG.info(
+                "{} value is {}. feature enabled={}",
+                ZKClientConfig.ZOOKEEPER_REQUEST_TIMEOUT,
+                requestTimeout,
+                requestTimeout > 0);
         } catch (NumberFormatException e) {
             LOG.error(
-                    "Configured value {} for property {} can not be parsed to long.",
-                    clientConfig.getProperty(
-                            ZKClientConfig.ZOOKEEPER_REQUEST_TIMEOUT),
-                    ZKClientConfig.ZOOKEEPER_REQUEST_TIMEOUT);
+                "Configured value {} for property {} can not be parsed to long.",
+                clientConfig.getProperty(ZKClientConfig.ZOOKEEPER_REQUEST_TIMEOUT),
+                ZKClientConfig.ZOOKEEPER_REQUEST_TIMEOUT);
             throw e;
         }
     }
+
 }
diff --git a/zookeeper-server/src/main/java/org/apache/zookeeper/ClientCnxnSocket.java b/zookeeper-server/src/main/java/org/apache/zookeeper/ClientCnxnSocket.java
index dc1c71a..2e1297d 100644
--- a/zookeeper-server/src/main/java/org/apache/zookeeper/ClientCnxnSocket.java
+++ b/zookeeper-server/src/main/java/org/apache/zookeeper/ClientCnxnSocket.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -26,12 +26,11 @@ import java.text.MessageFormat;
 import java.util.Queue;
 import java.util.concurrent.LinkedBlockingDeque;
 import java.util.concurrent.atomic.AtomicLong;
-
 import org.apache.jute.BinaryInputArchive;
 import org.apache.zookeeper.ClientCnxn.Packet;
 import org.apache.zookeeper.client.ZKClientConfig;
-import org.apache.zookeeper.common.ZKConfig;
 import org.apache.zookeeper.common.Time;
+import org.apache.zookeeper.common.ZKConfig;
 import org.apache.zookeeper.proto.ConnectResponse;
 import org.apache.zookeeper.server.ByteBufferInputStream;
 import org.slf4j.Logger;
@@ -40,12 +39,13 @@ import org.slf4j.LoggerFactory;
 /**
  * A ClientCnxnSocket does the lower level communication with a socket
  * implementation.
- * 
+ *
  * This code has been moved out of ClientCnxn so that a Netty implementation can
  * be provided as an alternative to the NIO socket code.
- * 
+ *
  */
 abstract class ClientCnxnSocket {
+
     private static final Logger LOG = LoggerFactory.getLogger(ClientCnxnSocket.class);
 
     protected boolean initialized;
@@ -76,8 +76,7 @@ abstract class ClientCnxnSocket {
      */
     protected long sessionId;
 
-    void introduce(ClientCnxn.SendThread sendThread, long sessionId,
-                   LinkedBlockingDeque<Packet> outgoingQueue) {
+    void introduce(ClientCnxn.SendThread sendThread, long sessionId, LinkedBlockingDeque<Packet> outgoingQueue) {
         this.sendThread = sendThread;
         this.sessionId = sessionId;
         this.outgoingQueue = outgoingQueue;
@@ -131,8 +130,7 @@ abstract class ClientCnxnSocket {
                 buf.append(Integer.toHexString(b) + ",");
             }
             buf.append("]");
-            LOG.trace("readConnectResult " + incomingBuffer.remaining() + " "
-                    + buf.toString());
+            LOG.trace("readConnectResult " + incomingBuffer.remaining() + " " + buf.toString());
         }
         ByteBufferInputStream bbis = new ByteBufferInputStream(incomingBuffer);
         BinaryInputArchive bbia = BinaryInputArchive.getArchive(bbis);
@@ -150,8 +148,7 @@ abstract class ClientCnxnSocket {
         }
 
         this.sessionId = conRsp.getSessionId();
-        sendThread.onConnected(conRsp.getTimeOut(), this.sessionId,
-                conRsp.getPasswd(), isRO);
+        sendThread.onConnected(conRsp.getTimeOut(), this.sessionId, conRsp.getPasswd(), isRO);
     }
 
     abstract boolean isConnected();
@@ -208,9 +205,10 @@ abstract class ClientCnxnSocket {
      * @throws IOException
      * @throws InterruptedException
      */
-    abstract void doTransport(int waitTimeOut, Queue<Packet> pendingQueue,
-            ClientCnxn cnxn)
-            throws IOException, InterruptedException;
+    abstract void doTransport(
+        int waitTimeOut,
+        Queue<Packet> pendingQueue,
+        ClientCnxn cnxn) throws IOException, InterruptedException;
 
     /**
      * Close the socket.
@@ -232,15 +230,15 @@ abstract class ClientCnxnSocket {
 
     protected void initProperties() throws IOException {
         try {
-            packetLen = clientConfig.getInt(ZKConfig.JUTE_MAXBUFFER,
-                    ZKClientConfig.CLIENT_MAX_PACKET_LENGTH_DEFAULT);
-            LOG.info("{} value is {} Bytes", ZKConfig.JUTE_MAXBUFFER,
-                    packetLen);
+            packetLen = clientConfig.getInt(
+                ZKConfig.JUTE_MAXBUFFER,
+                ZKClientConfig.CLIENT_MAX_PACKET_LENGTH_DEFAULT);
+            LOG.info("{} value is {} Bytes", ZKConfig.JUTE_MAXBUFFER, packetLen);
         } catch (NumberFormatException e) {
             String msg = MessageFormat.format(
-                    "Configured value {0} for property {1} can not be parsed to int",
-                    clientConfig.getProperty(ZKConfig.JUTE_MAXBUFFER),
-                    ZKConfig.JUTE_MAXBUFFER);
+                "Configured value {0} for property {1} can not be parsed to int",
+                clientConfig.getProperty(ZKConfig.JUTE_MAXBUFFER),
+                ZKConfig.JUTE_MAXBUFFER);
             LOG.error(msg);
             throw new IOException(msg);
         }
diff --git a/zookeeper-server/src/main/java/org/apache/zookeeper/ClientCnxnSocketNIO.java b/zookeeper-server/src/main/java/org/apache/zookeeper/ClientCnxnSocketNIO.java
index 0ce64ab..7786795 100644
--- a/zookeeper-server/src/main/java/org/apache/zookeeper/ClientCnxnSocketNIO.java
+++ b/zookeeper-server/src/main/java/org/apache/zookeeper/ClientCnxnSocketNIO.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -30,7 +30,6 @@ import java.util.Iterator;
 import java.util.Queue;
 import java.util.Set;
 import java.util.concurrent.LinkedBlockingDeque;
-
 import org.apache.zookeeper.ClientCnxn.EndOfStreamException;
 import org.apache.zookeeper.ClientCnxn.Packet;
 import org.apache.zookeeper.ZooDefs.OpCode;
@@ -39,8 +38,8 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public class ClientCnxnSocketNIO extends ClientCnxnSocket {
-    private static final Logger LOG = LoggerFactory
-            .getLogger(ClientCnxnSocketNIO.class);
+
+    private static final Logger LOG = LoggerFactory.getLogger(ClientCnxnSocketNIO.class);
 
     private final Selector selector = Selector.open();
 
@@ -59,13 +58,12 @@ public class ClientCnxnSocketNIO extends ClientCnxnSocket {
     boolean isConnected() {
         return sockKey != null;
     }
-    
+
     /**
      * @throws InterruptedException
      * @throws IOException
      */
-    void doIO(Queue<Packet> pendingQueue, ClientCnxn cnxn)
-      throws InterruptedException, IOException {
+    void doIO(Queue<Packet> pendingQueue, ClientCnxn cnxn) throws InterruptedException, IOException {
         SocketChannel sock = (SocketChannel) sockKey.channel();
         if (sock == null) {
             throw new IOException("Socket is null!");
@@ -73,10 +71,9 @@ public class ClientCnxnSocketNIO extends ClientCnxnSocket {
         if (sockKey.isReadable()) {
             int rc = sock.read(incomingBuffer);
             if (rc < 0) {
-                throw new EndOfStreamException(
-                        "Unable to read additional data from server sessionid 0x"
-                                + Long.toHexString(sessionId)
-                                + ", likely server has closed socket");
+                throw new EndOfStreamException("Unable to read additional data from server sessionid 0x"
+                                               + Long.toHexString(sessionId)
+                                               + ", likely server has closed socket");
             }
             if (!incomingBuffer.hasRemaining()) {
                 incomingBuffer.flip();
@@ -86,8 +83,7 @@ public class ClientCnxnSocketNIO extends ClientCnxnSocket {
                 } else if (!initialized) {
                     readConnectResult();
                     enableRead();
-                    if (findSendablePacket(outgoingQueue,
-                            sendThread.tunnelAuthInProgress()) != null) {
+                    if (findSendablePacket(outgoingQueue, sendThread.tunnelAuthInProgress()) != null) {
                         // Since SASL authentication has completed (if client is configured to do so),
                         // outgoing packets waiting in the outgoingQueue can now be sent.
                         enableWrite();
@@ -105,16 +101,15 @@ public class ClientCnxnSocketNIO extends ClientCnxnSocket {
             }
         }
         if (sockKey.isWritable()) {
-            Packet p = findSendablePacket(outgoingQueue,
-                    sendThread.tunnelAuthInProgress());
+            Packet p = findSendablePacket(outgoingQueue, sendThread.tunnelAuthInProgress());
 
             if (p != null) {
                 updateLastSend();
                 // If we already started writing p, p.bb will already exist
                 if (p.bb == null) {
-                    if ((p.requestHeader != null) &&
-                            (p.requestHeader.getType() != OpCode.ping) &&
-                            (p.requestHeader.getType() != OpCode.auth)) {
+                    if ((p.requestHeader != null)
+                        && (p.requestHeader.getType() != OpCode.ping)
+                        && (p.requestHeader.getType() != OpCode.auth)) {
                         p.requestHeader.setXid(cnxn.getXid());
                     }
                     p.createBB();
@@ -124,8 +119,8 @@ public class ClientCnxnSocketNIO extends ClientCnxnSocket {
                     sentCount.getAndIncrement();
                     outgoingQueue.removeFirstOccurrence(p);
                     if (p.requestHeader != null
-                            && p.requestHeader.getType() != OpCode.ping
-                            && p.requestHeader.getType() != OpCode.auth) {
+                        && p.requestHeader.getType() != OpCode.ping
+                        && p.requestHeader.getType() != OpCode.auth) {
                         synchronized (pendingQueue) {
                             pendingQueue.add(p);
                         }
@@ -157,8 +152,7 @@ public class ClientCnxnSocketNIO extends ClientCnxnSocket {
         }
     }
 
-    private Packet findSendablePacket(LinkedBlockingDeque<Packet> outgoingQueue,
-                                      boolean tunneledAuthInProgres) {
+    private Packet findSendablePacket(LinkedBlockingDeque<Packet> outgoingQueue, boolean tunneledAuthInProgres) {
         if (outgoingQueue.isEmpty()) {
             return null;
         }
@@ -221,7 +215,7 @@ public class ClientCnxnSocketNIO extends ClientCnxnSocket {
         }
         sockKey = null;
     }
- 
+
     @Override
     void close() {
         try {
@@ -232,7 +226,7 @@ public class ClientCnxnSocketNIO extends ClientCnxnSocket {
             LOG.warn("Ignoring exception during selector close", e);
         }
     }
-    
+
     /**
      * create a socket channel.
      * @return the created socket channel
@@ -249,25 +243,24 @@ public class ClientCnxnSocketNIO extends ClientCnxnSocket {
 
     /**
      * register with the selection and connect
-     * @param sock the {@link SocketChannel} 
+     * @param sock the {@link SocketChannel}
      * @param addr the address of remote host
      * @throws IOException
      */
-    void registerAndConnect(SocketChannel sock, InetSocketAddress addr) 
-    throws IOException {
+    void registerAndConnect(SocketChannel sock, InetSocketAddress addr) throws IOException {
         sockKey = sock.register(selector, SelectionKey.OP_CONNECT);
         boolean immediateConnect = sock.connect(addr);
         if (immediateConnect) {
             sendThread.primeConnection();
         }
     }
-    
+
     @Override
     void connect(InetSocketAddress addr) throws IOException {
         SocketChannel sock = createSock();
         try {
-           registerAndConnect(sock, addr);
-      } catch (IOException e) {
+            registerAndConnect(sock, addr);
+        } catch (IOException e) {
             LOG.error("Unable to open socket to " + addr);
             sock.close();
             throw e;
@@ -283,7 +276,7 @@ public class ClientCnxnSocketNIO extends ClientCnxnSocket {
 
     /**
      * Returns the address to which the socket is connected.
-     * 
+     *
      * @return ip address of the remote side of the connection or null if not
      *         connected
      */
@@ -294,7 +287,7 @@ public class ClientCnxnSocketNIO extends ClientCnxnSocket {
 
     /**
      * Returns the local address to which the socket is bound.
-     * 
+     *
      * @return ip address of the remote side of the connection or null if not
      *         connected
      */
@@ -302,7 +295,7 @@ public class ClientCnxnSocketNIO extends ClientCnxnSocket {
     SocketAddress getLocalSocketAddress() {
         return localSocketAddress;
     }
-    
+
     private void updateSocketAddresses() {
         Socket socket = ((SocketChannel) sockKey.channel()).socket();
         localSocketAddress = socket.getLocalSocketAddress();
@@ -322,10 +315,12 @@ public class ClientCnxnSocketNIO extends ClientCnxnSocket {
     private synchronized void wakeupCnxn() {
         selector.wakeup();
     }
-    
+
     @Override
-    void doTransport(int waitTimeOut, Queue<Packet> pendingQueue, ClientCnxn cnxn)
-            throws IOException, InterruptedException {
+    void doTransport(
+        int waitTimeOut,
+        Queue<Packet> pendingQueue,
+        ClientCnxn cnxn) throws IOException, InterruptedException {
         selector.select(waitTimeOut);
         Set<SelectionKey> selected;
         synchronized (this) {
@@ -348,8 +343,7 @@ public class ClientCnxnSocketNIO extends ClientCnxnSocket {
             }
         }
         if (sendThread.getZkState().isConnected()) {
-            if (findSendablePacket(outgoingQueue,
-                    sendThread.tunnelAuthInProgress()) != null) {
+            if (findSendablePacket(outgoingQueue, sendThread.tunnelAuthInProgress()) != null) {
                 enableWrite();
             }
         }
@@ -363,8 +357,8 @@ public class ClientCnxnSocketNIO extends ClientCnxnSocket {
         // sockKey may be concurrently accessed by multiple
         // threads. We use tmp here to avoid a race condition
         SelectionKey tmp = sockKey;
-        if (tmp!=null) {
-           ((SocketChannel) tmp.channel()).socket().close();
+        if (tmp != null) {
+            ((SocketChannel) tmp.channel()).socket().close();
         }
     }
 
@@ -387,7 +381,7 @@ public class ClientCnxnSocketNIO extends ClientCnxnSocket {
         }
     }
 
-    synchronized private void enableRead() {
+    private synchronized void enableRead() {
         int i = sockKey.interestOps();
         if ((i & SelectionKey.OP_READ) == 0) {
             sockKey.interestOps(i | SelectionKey.OP_READ);
@@ -413,4 +407,5 @@ public class ClientCnxnSocketNIO extends ClientCnxnSocket {
         ByteBuffer pbb = p.bb;
         sock.write(pbb);
     }
+
 }
diff --git a/zookeeper-server/src/main/java/org/apache/zookeeper/ClientCnxnSocketNetty.java b/zookeeper-server/src/main/java/org/apache/zookeeper/ClientCnxnSocketNetty.java
index e299ddd..930222c 100755
--- a/zookeeper-server/src/main/java/org/apache/zookeeper/ClientCnxnSocketNetty.java
+++ b/zookeeper-server/src/main/java/org/apache/zookeeper/ClientCnxnSocketNetty.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -18,22 +18,7 @@
 
 package org.apache.zookeeper;
 
-import java.io.IOException;
-import java.net.InetSocketAddress;
-import java.net.SocketAddress;
-import java.util.Iterator;
-import java.util.Queue;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.Semaphore;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicReference;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantLock;
-
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.SSLEngine;
-
+import static org.apache.zookeeper.common.X509Exception.SSLContextException;
 import io.netty.bootstrap.Bootstrap;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.ByteBufAllocator;
@@ -51,6 +36,20 @@ import io.netty.channel.socket.SocketChannel;
 import io.netty.handler.ssl.SslHandler;
 import io.netty.util.concurrent.Future;
 import io.netty.util.concurrent.GenericFutureListener;
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.net.SocketAddress;
+import java.util.Iterator;
+import java.util.Queue;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.Semaphore;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicReference;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLEngine;
 import org.apache.zookeeper.ClientCnxn.EndOfStreamException;
 import org.apache.zookeeper.ClientCnxn.Packet;
 import org.apache.zookeeper.client.ZKClientConfig;
@@ -60,14 +59,13 @@ import org.apache.zookeeper.common.X509Util;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import static org.apache.zookeeper.common.X509Exception.SSLContextException;
-
 /**
  * ClientCnxnSocketNetty implements ClientCnxnSocket abstract methods.
  * It's responsible for connecting to server, reading/writing network traffic and
  * being a layer between network data and higher level packets.
  */
 public class ClientCnxnSocketNetty extends ClientCnxnSocket {
+
     private static final Logger LOG = LoggerFactory.getLogger(ClientCnxnSocketNetty.class);
 
     private final EventLoopGroup eventLoopGroup;
@@ -79,8 +77,7 @@ public class ClientCnxnSocketNetty extends ClientCnxnSocket {
     private final AtomicBoolean needSasl = new AtomicBoolean();
     private final Semaphore waitSasl = new Semaphore(0);
 
-    private static final AtomicReference<ByteBufAllocator> TEST_ALLOCATOR =
-            new AtomicReference<>(null);
+    private static final AtomicReference<ByteBufAllocator> TEST_ALLOCATOR = new AtomicReference<>(null);
 
     ClientCnxnSocketNetty(ZKClientConfig clientConfig) throws IOException {
         this.clientConfig = clientConfig;
@@ -131,12 +128,11 @@ public class ClientCnxnSocketNetty extends ClientCnxnSocket {
     void connect(InetSocketAddress addr) throws IOException {
         firstConnect = new CountDownLatch(1);
 
-        Bootstrap bootstrap = new Bootstrap()
-                .group(eventLoopGroup)
-                .channel(NettyUtils.nioOrEpollSocketChannel())
-                .option(ChannelOption.SO_LINGER, -1)
-                .option(ChannelOption.TCP_NODELAY, true)
-                .handler(new ZKClientPipelineFactory(addr.getHostString(), addr.getPort()));
+        Bootstrap bootstrap = new Bootstrap().group(eventLoopGroup)
+                                             .channel(NettyUtils.nioOrEpollSocketChannel())
+                                             .option(ChannelOption.SO_LINGER, -1)
+                                             .option(ChannelOption.TCP_NODELAY, true)
+                                             .handler(new ZKClientPipelineFactory(addr.getHostString(), addr.getPort()));
         bootstrap = configureBootstrapAllocator(bootstrap);
         bootstrap.validate();
 
@@ -261,10 +257,10 @@ public class ClientCnxnSocketNetty extends ClientCnxnSocket {
     }
 
     @Override
-    void doTransport(int waitTimeOut,
-                     Queue<Packet> pendingQueue,
-                     ClientCnxn cnxn)
-            throws IOException, InterruptedException {
+    void doTransport(
+        int waitTimeOut,
+        Queue<Packet> pendingQueue,
+        ClientCnxn cnxn) throws IOException, InterruptedException {
         try {
             if (!firstConnect.await(waitTimeOut, TimeUnit.MILLISECONDS)) {
                 return;
@@ -286,9 +282,7 @@ public class ClientCnxnSocketNetty extends ClientCnxnSocket {
             // channel disconnection happened
             if (disconnected.get()) {
                 addBack(head);
-                throw new EndOfStreamException("channel for sessionid 0x"
-                        + Long.toHexString(sessionId)
-                        + " is lost");
+                throw new EndOfStreamException("channel for sessionid 0x" + Long.toHexString(sessionId) + " is lost");
             }
             if (head != null) {
                 doWrite(pendingQueue, head, cnxn);
@@ -337,9 +331,7 @@ public class ClientCnxnSocketNetty extends ClientCnxnSocket {
         p.createBB();
         updateLastSend();
         final ByteBuf writeBuffer = Unpooled.wrappedBuffer(p.bb);
-        final ChannelFuture result = doFlush
-                ? channel.writeAndFlush(writeBuffer)
-                : channel.write(writeBuffer);
+        final ChannelFuture result = doFlush ? channel.writeAndFlush(writeBuffer) : channel.write(writeBuffer);
         result.addListener(onSendPktDoneListener);
         return result;
     }
@@ -357,9 +349,9 @@ public class ClientCnxnSocketNetty extends ClientCnxnSocket {
         boolean anyPacketsSent = false;
         while (true) {
             if (p != WakeupPacket.getInstance()) {
-                if ((p.requestHeader != null) &&
-                        (p.requestHeader.getType() != ZooDefs.OpCode.ping) &&
-                        (p.requestHeader.getType() != ZooDefs.OpCode.auth)) {
+                if ((p.requestHeader != null)
+                    && (p.requestHeader.getType() != ZooDefs.OpCode.ping)
+                    && (p.requestHeader.getType() != ZooDefs.OpCode.auth)) {
                     p.requestHeader.setXid(cnxn.getXid());
                     synchronized (pendingQueue) {
                         pendingQueue.add(p);
@@ -408,9 +400,9 @@ public class ClientCnxnSocketNetty extends ClientCnxnSocket {
         }
     }
 
-
     // *************** <END> CientCnxnSocketNetty </END> ******************
     private static class WakeupPacket {
+
         private static final Packet instance = new Packet(null, null, null, null, null);
 
         protected WakeupPacket() {
@@ -420,6 +412,7 @@ public class ClientCnxnSocketNetty extends ClientCnxnSocket {
         public static Packet getInstance() {
             return instance;
         }
+
     }
 
     /**
@@ -427,6 +420,7 @@ public class ClientCnxnSocketNetty extends ClientCnxnSocket {
      * connection implementation.
      */
     private class ZKClientPipelineFactory extends ChannelInitializer<SocketChannel> {
+
         private SSLContext sslContext = null;
         private SSLEngine sslEngine = null;
         private String host;
@@ -459,6 +453,7 @@ public class ClientCnxnSocketNetty extends ClientCnxnSocket {
             pipeline.addLast("ssl", new SslHandler(sslEngine));
             LOG.info("SSL handler added for channel: {}", pipeline.channel());
         }
+
     }
 
     /**
@@ -466,6 +461,7 @@ public class ClientCnxnSocketNetty extends ClientCnxnSocket {
      * place. It mainly handles read traffic and helps synchronize connection state.
      */
     private class ZKClientHandler extends SimpleChannelInboundHandler<ByteBuf> {
+
         AtomicBoolean channelClosed = new AtomicBoolean(false);
 
         @Override
@@ -491,8 +487,7 @@ public class ClientCnxnSocketNetty extends ClientCnxnSocket {
             updateNow();
             while (buf.isReadable()) {
                 if (incomingBuffer.remaining() > buf.readableBytes()) {
-                    int newLimit = incomingBuffer.position()
-                            + buf.readableBytes();
+                    int newLimit = incomingBuffer.position() + buf.readableBytes();
                     incomingBuffer.limit(newLimit);
                 }
                 buf.readBytes(incomingBuffer);
@@ -527,6 +522,7 @@ public class ClientCnxnSocketNetty extends ClientCnxnSocket {
             LOG.warn("Exception caught", cause);
             cleanup();
         }
+
     }
 
     /**
@@ -548,4 +544,5 @@ public class ClientCnxnSocketNetty extends ClientCnxnSocket {
     static void clearTestAllocator() {
         TEST_ALLOCATOR.set(null);
     }
+
 }
diff --git a/zookeeper-server/src/main/java/org/apache/zookeeper/ClientWatchManager.java b/zookeeper-server/src/main/java/org/apache/zookeeper/ClientWatchManager.java
index d56374d..d4ea3c5 100644
--- a/zookeeper-server/src/main/java/org/apache/zookeeper/ClientWatchManager.java
+++ b/zookeeper-server/src/main/java/org/apache/zookeeper/ClientWatchManager.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -23,18 +23,19 @@ import java.util.Set;
 /**
  */
 public interface ClientWatchManager {
+
     /**
-     * Return a set of watchers that should be notified of the event. The 
-     * manager must not notify the watcher(s), however it will update it's 
-     * internal structure as if the watches had triggered. The intent being 
-     * that the callee is now responsible for notifying the watchers of the 
+     * Return a set of watchers that should be notified of the event. The
+     * manager must not notify the watcher(s), however it will update it's
+     * internal structure as if the watches had triggered. The intent being
+     * that the callee is now responsible for notifying the watchers of the
      * event, possibly at some later time.
-     * 
+     *
      * @param state event state
      * @param type event type
      * @param path event path
      * @return may be empty set but must not be null
      */
-    public Set<Watcher> materialize(Watcher.Event.KeeperState state,
-        Watcher.Event.EventType type, String path);
+    Set<Watcher> materialize(Watcher.Event.KeeperState state, Watcher.Event.EventType type, String path);
+
 }
diff --git a/zookeeper-server/src/main/java/org/apache/zookeeper/CreateMode.java b/zookeeper-server/src/main/java/org/apache/zookeeper/CreateMode.java
index 587f7a1..139722a 100644
--- a/zookeeper-server/src/main/java/org/apache/zookeeper/CreateMode.java
+++ b/zookeeper-server/src/main/java/org/apache/zookeeper/CreateMode.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -15,6 +15,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.apache.zookeeper;
 
 import org.apache.yetus.audience.InterfaceAudience;
@@ -26,25 +27,25 @@ import org.slf4j.LoggerFactory;
  */
 @InterfaceAudience.Public
 public enum CreateMode {
-    
+
     /**
      * The znode will not be automatically deleted upon client's disconnect.
      */
-    PERSISTENT (0, false, false, false, false),
+    PERSISTENT(0, false, false, false, false),
     /**
-    * The znode will not be automatically deleted upon client's disconnect,
-    * and its name will be appended with a monotonically increasing number.
-    */
-    PERSISTENT_SEQUENTIAL (2, false, true, false, false),
+     * The znode will not be automatically deleted upon client's disconnect,
+     * and its name will be appended with a monotonically increasing number.
+     */
+    PERSISTENT_SEQUENTIAL(2, false, true, false, false),
     /**
      * The znode will be deleted upon the client's disconnect.
      */
-    EPHEMERAL (1, true, false, false, false),
+    EPHEMERAL(1, true, false, false, false),
     /**
      * The znode will be deleted upon the client's disconnect, and its name
      * will be appended with a monotonically increasing number.
      */
-    EPHEMERAL_SEQUENTIAL (3, true, true, false, false),
+    EPHEMERAL_SEQUENTIAL(3, true, true, false, false),
     /**
      * The znode will be a container node. Container
      * nodes are special purpose nodes useful for recipes such as leader, lock,
@@ -54,7 +55,7 @@ public enum CreateMode {
      * {@link org.apache.zookeeper.KeeperException.NoNodeException}
      * when creating children inside of this container node.
      */
-    CONTAINER (4, false, false, true, false),
+    CONTAINER(4, false, false, true, false),
     /**
      * The znode will not be automatically deleted upon client's disconnect.
      * However if the znode has not been modified within the given TTL, it
@@ -77,8 +78,7 @@ public enum CreateMode {
     private int flag;
     private boolean isTTL;
 
-    CreateMode(int flag, boolean ephemeral, boolean sequential,
-               boolean isContainer, boolean isTTL) {
+    CreateMode(int flag, boolean ephemeral, boolean sequential, boolean isContainer, boolean isTTL) {
         this.flag = flag;
         this.ephemeral = ephemeral;
         this.sequential = sequential;
@@ -86,11 +86,11 @@ public enum CreateMode {
         this.isTTL = isTTL;
     }
 
-    public boolean isEphemeral() { 
+    public boolean isEphemeral() {
         return ephemeral;
     }
 
-    public boolean isSequential() { 
+    public boolean isSequential() {
         return sequential;
     }
 
@@ -109,25 +109,31 @@ public enum CreateMode {
     /**
      * Map an integer value to a CreateMode value
      */
-    static public CreateMode fromFlag(int flag) throws KeeperException {
-        switch(flag) {
-        case 0: return CreateMode.PERSISTENT;
+    public static CreateMode fromFlag(int flag) throws KeeperException {
+        switch (flag) {
+        case 0:
+            return CreateMode.PERSISTENT;
 
-        case 1: return CreateMode.EPHEMERAL;
+        case 1:
+            return CreateMode.EPHEMERAL;
 
-        case 2: return CreateMode.PERSISTENT_SEQUENTIAL;
+        case 2:
+            return CreateMode.PERSISTENT_SEQUENTIAL;
 
-        case 3: return CreateMode.EPHEMERAL_SEQUENTIAL ;
+        case 3:
+            return CreateMode.EPHEMERAL_SEQUENTIAL;
 
-        case 4: return CreateMode.CONTAINER;
+        case 4:
+            return CreateMode.CONTAINER;
 
-        case 5: return CreateMode.PERSISTENT_WITH_TTL;
+        case 5:
+            return CreateMode.PERSISTENT_WITH_TTL;
 
-        case 6: return CreateMode.PERSISTENT_SEQUENTIAL_WITH_TTL;
+        case 6:
+            return CreateMode.PERSISTENT_SEQUENTIAL_WITH_TTL;
 
         default:
-            String errMsg = "Received an invalid flag value: " + flag
-                    + " to convert to a CreateMode";
+            String errMsg = "Received an invalid flag value: " + flag + " to convert to a CreateMode";
             LOG.error(errMsg);
             throw new KeeperException.BadArgumentsException(errMsg);
         }
@@ -136,31 +142,31 @@ public enum CreateMode {
     /**
      * Map an integer value to a CreateMode value
      */
-    static public CreateMode fromFlag(int flag, CreateMode defaultMode) {
-        switch(flag) {
-            case 0:
-                return CreateMode.PERSISTENT;
+    public static CreateMode fromFlag(int flag, CreateMode defaultMode) {
+        switch (flag) {
+        case 0:
+            return CreateMode.PERSISTENT;
 
-            case 1:
-                return CreateMode.EPHEMERAL;
+        case 1:
+            return CreateMode.EPHEMERAL;
 
-            case 2:
-                return CreateMode.PERSISTENT_SEQUENTIAL;
+        case 2:
+            return CreateMode.PERSISTENT_SEQUENTIAL;
 
-            case 3:
-                return CreateMode.EPHEMERAL_SEQUENTIAL;
+        case 3:
+            return CreateMode.EPHEMERAL_SEQUENTIAL;
 
-            case 4:
-                return CreateMode.CONTAINER;
+        case 4:
+            return CreateMode.CONTAINER;
 
-            case 5:
-                return CreateMode.PERSISTENT_WITH_TTL;
+        case 5:
+            return CreateMode.PERSISTENT_WITH_TTL;
 
-            case 6:
-                return CreateMode.PERSISTENT_SEQUENTIAL_WITH_TTL;
+        case 6:
+            return CreateMode.PERSISTENT_SEQUENTIAL_WITH_TTL;
 
-            default:
-                return defaultMode;
+        default:
+            return defaultMode;
         }
     }
 }
diff --git a/zookeeper-server/src/main/java/org/apache/zookeeper/DigestWatcher.java b/zookeeper-server/src/main/java/org/apache/zookeeper/DigestWatcher.java
index 15035c8..e8662df 100644
--- a/zookeeper-server/src/main/java/org/apache/zookeeper/DigestWatcher.java
+++ b/zookeeper-server/src/main/java/org/apache/zookeeper/DigestWatcher.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -26,7 +26,8 @@ public interface DigestWatcher {
     /**
      * Called when the digest mismatch is found on a given zxid.
      *
-     * @param mismatchZxid the zxid when the digest mismatch happened. 
+     * @param mismatchZxid the zxid when the digest mismatch happened.
      */
     void process(long mismatchZxid);
+
 }
diff --git a/zookeeper-server/src/main/java/org/apache/zookeeper/Environment.java b/zookeeper-server/src/main/java/org/apache/zookeeper/Environment.java
index 7bd5c7f..9ec38a1 100644
--- a/zookeeper-server/src/main/java/org/apache/zookeeper/Environment.java
+++ b/zookeeper-server/src/main/java/org/apache/zookeeper/Environment.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -22,7 +22,6 @@ import java.net.InetAddress;
 import java.net.UnknownHostException;
 import java.util.ArrayList;
 import java.util.List;
-
 import org.slf4j.Logger;
 
 /**
@@ -30,26 +29,33 @@ import org.slf4j.Logger;
  *
  */
 public class Environment {
+
     public static final String JAAS_CONF_KEY = "java.security.auth.login.config";
 
     public static class Entry {
+
         private String k;
         private String v;
         public Entry(String k, String v) {
             this.k = k;
             this.v = v;
         }
-        public String getKey() { return k; }
-        public String getValue() { return v; }
-        
+        public String getKey() {
+            return k;
+        }
+        public String getValue() {
+            return v;
+        }
+
         @Override
         public String toString() {
             return k + "=" + v;
         }
+
     }
 
     private static void put(List<Entry> l, String k, String v) {
-        l.add(new Entry(k,v));
+        l.add(new Entry(k, v));
     }
 
     public static List<Entry> list() {
@@ -57,56 +63,40 @@ public class Environment {
         put(l, "zookeeper.version", Version.getFullVersion());
 
         try {
-            put(l, "host.name",
-                InetAddress.getLocalHost().getCanonicalHostName());
+            put(l, "host.name", InetAddress.getLocalHost().getCanonicalHostName());
         } catch (UnknownHostException e) {
             put(l, "host.name", "<NA>");
         }
 
-        put(l, "java.version",
-                System.getProperty("java.version", "<NA>"));
-        put(l, "java.vendor",
-                System.getProperty("java.vendor", "<NA>"));
-        put(l, "java.home",
-                System.getProperty("java.home", "<NA>"));
-        put(l, "java.class.path",
-                System.getProperty("java.class.path", "<NA>"));
-        put(l, "java.library.path",
-                System.getProperty("java.library.path", "<NA>"));
-        put(l, "java.io.tmpdir",
-                System.getProperty("java.io.tmpdir", "<NA>"));
-        put(l, "java.compiler",
-                System.getProperty("java.compiler", "<NA>"));
-        put(l, "os.name",
-                System.getProperty("os.name", "<NA>"));
-        put(l, "os.arch",
-                System.getProperty("os.arch", "<NA>"));
-        put(l, "os.version",
-                System.getProperty("os.version", "<NA>"));
-        put(l, "user.name",
-                System.getProperty("user.name", "<NA>"));
-        put(l, "user.home",
-                System.getProperty("user.home", "<NA>"));
-        put(l, "user.dir",
-                System.getProperty("user.dir", "<NA>"));
+        put(l, "java.version", System.getProperty("java.version", "<NA>"));
+        put(l, "java.vendor", System.getProperty("java.vendor", "<NA>"));
+        put(l, "java.home", System.getProperty("java.home", "<NA>"));
+        put(l, "java.class.path", System.getProperty("java.class.path", "<NA>"));
+        put(l, "java.library.path", System.getProperty("java.library.path", "<NA>"));
+        put(l, "java.io.tmpdir", System.getProperty("java.io.tmpdir", "<NA>"));
+        put(l, "java.compiler", System.getProperty("java.compiler", "<NA>"));
+        put(l, "os.name", System.getProperty("os.name", "<NA>"));
+        put(l, "os.arch", System.getProperty("os.arch", "<NA>"));
+        put(l, "os.version", System.getProperty("os.version", "<NA>"));
+        put(l, "user.name", System.getProperty("user.name", "<NA>"));
+        put(l, "user.home", System.getProperty("user.home", "<NA>"));
+        put(l, "user.dir", System.getProperty("user.dir", "<NA>"));
 
         // Get memory information.
         Runtime runtime = Runtime.getRuntime();
         int mb = 1024 * 1024;
-        put(l, "os.memory.free",
-               Long.toString(runtime.freeMemory() / mb) + "MB");
-        put(l, "os.memory.max",
-               Long.toString(runtime.maxMemory() / mb) + "MB");
-        put(l, "os.memory.total",
-               Long.toString(runtime.totalMemory() / mb) + "MB");
+        put(l, "os.memory.free", runtime.freeMemory() / mb + "MB");
+        put(l, "os.memory.max", runtime.maxMemory() / mb + "MB");
+        put(l, "os.memory.total", runtime.totalMemory() / mb + "MB");
 
         return l;
     }
-    
+
     public static void logEnv(String msg, Logger log) {
         List<Entry> env = Environment.list();
         for (Entry e : env) {
             log.info(msg + e.toString());
         }
     }
+
 }
diff --git a/zookeeper-server/src/main/java/org/apache/zookeeper/JLineZNodeCompleter.java b/zookeeper-server/src/main/java/org/apache/zookeeper/JLineZNodeCompleter.java
index fa6126b..e555214 100644
--- a/zookeeper-server/src/main/java/org/apache/zookeeper/JLineZNodeCompleter.java
+++ b/zookeeper-server/src/main/java/org/apache/zookeeper/JLineZNodeCompleter.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -20,67 +20,63 @@ package org.apache.zookeeper;
 
 import java.util.Collections;
 import java.util.List;
-
 import jline.console.completer.Completer;
 
 class JLineZNodeCompleter implements Completer {
+
     private ZooKeeper zk;
 
     public JLineZNodeCompleter(ZooKeeper zk) {
         this.zk = zk;
     }
 
-    @SuppressWarnings({ "unchecked", "rawtypes" })
+    @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);
+        buffer = buffer.substring(0, cursor);
         String token = "";
         if (!buffer.endsWith(" ")) {
             String[] tokens = buffer.split(" ");
             if (tokens.length != 0) {
-                token = tokens[tokens.length-1] ;
+                token = tokens[tokens.length - 1];
             }
         }
 
-        if (token.startsWith("/")){
-            return completeZNode( buffer, token, candidates);
+        if (token.startsWith("/")) {
+            return completeZNode(buffer, token, candidates);
         }
         return completeCommand(buffer, token, candidates);
     }
 
-    private int completeCommand(String buffer, String token,
-            List<String> candidates)
-    {
+    private int completeCommand(String buffer, String token, List<String> candidates) {
         for (String cmd : ZooKeeperMain.getCommands()) {
-            if (cmd.startsWith( token )) {
+            if (cmd.startsWith(token)) {
                 candidates.add(cmd);
             }
         }
-        return buffer.lastIndexOf(" ")+1;
+        return buffer.lastIndexOf(" ") + 1;
     }
 
-    private int completeZNode( String buffer, String token,
-            List<String> candidates)
-    {
+    private int completeZNode(String buffer, String token, List<String> candidates) {
         String path = token;
         int idx = path.lastIndexOf("/") + 1;
         String prefix = path.substring(idx);
         try {
             // Only the root path can end in a /, so strip it off every other prefix
-            String dir = idx == 1 ? "/" : path.substring(0,idx-1);
+            String dir = idx == 1 ? "/" : path.substring(0, idx - 1);
             List<String> children = zk.getChildren(dir, false);
             for (String child : children) {
                 if (child.startsWith(prefix)) {
-                    candidates.add( child );
+                    candidates.add(child);
                 }
             }
-        } catch( InterruptedException e) {
+        } catch (InterruptedException e) {
             return 0;
-        }
-        catch( KeeperException e) {
+        } catch (KeeperException e) {
             return 0;
         }
         Collections.sort(candidates);
         return candidates.size() == 0 ? buffer.length() : buffer.lastIndexOf("/") + 1;
     }
+
 }
diff --git a/zookeeper-server/src/main/java/org/apache/zookeeper/KeeperException.java b/zookeeper-server/src/main/java/org/apache/zookeeper/KeeperException.java
index 42f7a33..5cff6f3 100644
--- a/zookeeper-server/src/main/java/org/apache/zookeeper/KeeperException.java
+++ b/zookeeper-server/src/main/java/org/apache/zookeeper/KeeperException.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -18,17 +18,17 @@
 
 package org.apache.zookeeper;
 
-import org.apache.yetus.audience.InterfaceAudience;
-
 import java.util.ArrayList;
 import java.util.EnumSet;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import org.apache.yetus.audience.InterfaceAudience;
 
 @SuppressWarnings("serial")
 @InterfaceAudience.Public
 public abstract class KeeperException extends Exception {
+
     /**
      * All multi-requests that result in an exception retain the results
      * here so that it is possible to examine the problems in the catch
@@ -92,65 +92,65 @@ public abstract class KeeperException extends Exception {
      */
     public static KeeperException create(Code code) {
         switch (code) {
-            case SYSTEMERROR:
-                return new SystemErrorException();
-            case RUNTIMEINCONSISTENCY:
-                return new RuntimeInconsistencyException();
-            case DATAINCONSISTENCY:
-                return new DataInconsistencyException();
-            case CONNECTIONLOSS:
-                return new ConnectionLossException();
-            case MARSHALLINGERROR:
-                return new MarshallingErrorException();
-            case UNIMPLEMENTED:
-                return new UnimplementedException();
-            case OPERATIONTIMEOUT:
-                return new OperationTimeoutException();
-            case NEWCONFIGNOQUORUM:
-               return new NewConfigNoQuorum();
-            case RECONFIGINPROGRESS:
-               return new ReconfigInProgress();
-            case BADARGUMENTS:
-                return new BadArgumentsException();
-            case APIERROR:
-                return new APIErrorException();
-            case NONODE:
-                return new NoNodeException();
-            case NOAUTH:
-                return new NoAuthException();
-            case BADVERSION:
-                return new BadVersionException();
-            case NOCHILDRENFOREPHEMERALS:
-                return new NoChildrenForEphemeralsException();
-            case NODEEXISTS:
-                return new NodeExistsException();
-            case INVALIDACL:
-                return new InvalidACLException();
-            case AUTHFAILED:
-                return new AuthFailedException();
-            case NOTEMPTY:
-                return new NotEmptyException();
-            case SESSIONEXPIRED:
-                return new SessionExpiredException();
-            case INVALIDCALLBACK:
-                return new InvalidCallbackException();
-            case SESSIONMOVED:
-                return new SessionMovedException();
-            case NOTREADONLY:
-                return new NotReadOnlyException();
-            case EPHEMERALONLOCALSESSION:
-                return new EphemeralOnLocalSessionException();
-            case NOWATCHER:
-                return new NoWatcherException();
-            case RECONFIGDISABLED:
-                return new ReconfigDisabledException();
-            case SESSIONCLOSEDREQUIRESASLAUTH:
-                return new SessionClosedRequireAuthException();
-            case REQUESTTIMEOUT:
-                return new RequestTimeoutException();
-            case OK:
-            default:
-                throw new IllegalArgumentException("Invalid exception code");
+        case SYSTEMERROR:
+            return new SystemErrorException();
+        case RUNTIMEINCONSISTENCY:
+            return new RuntimeInconsistencyException();
+        case DATAINCONSISTENCY:
+            return new DataInconsistencyException();
+        case CONNECTIONLOSS:
+            return new ConnectionLossException();
+        case MARSHALLINGERROR:
+            return new MarshallingErrorException();
+        case UNIMPLEMENTED:
+            return new UnimplementedException();
+        case OPERATIONTIMEOUT:
+            return new OperationTimeoutException();
+        case NEWCONFIGNOQUORUM:
+            return new NewConfigNoQuorum();
+        case RECONFIGINPROGRESS:
+            return new ReconfigInProgress();
+        case BADARGUMENTS:
+            return new BadArgumentsException();
+        case APIERROR:
+            return new APIErrorException();
+        case NONODE:
+            return new NoNodeException();
+        case NOAUTH:
+            return new NoAuthException();
+        case BADVERSION:
+            return new BadVersionException();
+        case NOCHILDRENFOREPHEMERALS:
+            return new NoChildrenForEphemeralsException();
+        case NODEEXISTS:
+            return new NodeExistsException();
+        case INVALIDACL:
+            return new InvalidACLException();
+        case AUTHFAILED:
+            return new AuthFailedException();
+        case NOTEMPTY:
+            return new NotEmptyException();
+        case SESSIONEXPIRED:
+            return new SessionExpiredException();
+        case INVALIDCALLBACK:
+            return new InvalidCallbackException();
+        case SESSIONMOVED:
+            return new SessionMovedException();
+        case NOTREADONLY:
+            return new NotReadOnlyException();
+        case EPHEMERALONLOCALSESSION:
+            return new EphemeralOnLocalSessionException();
+        case NOWATCHER:
+            return new NoWatcherException();
+        case RECONFIGDISABLED:
+            return new ReconfigDisabledException();
+        case SESSIONCLOSEDREQUIRESASLAUTH:
+            return new SessionClosedRequireAuthException();
+        case REQUESTTIMEOUT:
+            return new RequestTimeoutException();
+        case OK:
+        default:
+            throw new IllegalArgumentException("Invalid exception code");
         }
     }
 
@@ -181,142 +181,143 @@ public abstract class KeeperException extends Exception {
     @Deprecated
     @InterfaceAudience.Public
     public interface CodeDeprecated {
+
         /**
          * @deprecated deprecated in 3.1.0, use {@link Code#OK} instead
          */
         @Deprecated
-        public static final int Ok = 0;
+        int Ok = 0;
 
         /**
          * @deprecated deprecated in 3.1.0, use {@link Code#SYSTEMERROR} instead
          */
         @Deprecated
-        public static final int SystemError = -1;
+        int SystemError = -1;
         /**
          * @deprecated deprecated in 3.1.0, use
          * {@link Code#RUNTIMEINCONSISTENCY} instead
          */
         @Deprecated
-        public static final int RuntimeInconsistency = -2;
+        int RuntimeInconsistency = -2;
         /**
          * @deprecated deprecated in 3.1.0, use {@link Code#DATAINCONSISTENCY}
          * instead
          */
         @Deprecated
-        public static final int DataInconsistency = -3;
+        int DataInconsistency = -3;
         /**
          * @deprecated deprecated in 3.1.0, use {@link Code#CONNECTIONLOSS}
          * instead
          */
         @Deprecated
-        public static final int ConnectionLoss = -4;
+        int ConnectionLoss = -4;
         /**
          * @deprecated deprecated in 3.1.0, use {@link Code#MARSHALLINGERROR}
          * instead
          */
         @Deprecated
-        public static final int MarshallingError = -5;
+        int MarshallingError = -5;
         /**
          * @deprecated deprecated in 3.1.0, use {@link Code#UNIMPLEMENTED}
          * instead
          */
         @Deprecated
-        public static final int Unimplemented = -6;
+        int Unimplemented = -6;
         /**
          * @deprecated deprecated in 3.1.0, use {@link Code#OPERATIONTIMEOUT}
          * instead
          */
         @Deprecated
-        public static final int OperationTimeout = -7;
+        int OperationTimeout = -7;
         /**
          * @deprecated deprecated in 3.1.0, use {@link Code#BADARGUMENTS}
          * instead
          */
         @Deprecated
-        public static final int BadArguments = -8;
+        int BadArguments = -8;
 
         @Deprecated
-        public static final int UnknownSession= -12;
+        int UnknownSession = -12;
 
         /**
          * @deprecated deprecated in 3.1.0, use {@link Code#NEWCONFIGNOQUORUM}
          * instead
          */
         @Deprecated
-        public static final int NewConfigNoQuorum = -13;
+        int NewConfigNoQuorum = -13;
 
         /**
          * @deprecated deprecated in 3.1.0, use {@link Code#RECONFIGINPROGRESS}
          * instead
          */
         @Deprecated
-        public static final int ReconfigInProgress= -14;
+        int ReconfigInProgress = -14;
 
         /**
          * @deprecated deprecated in 3.1.0, use {@link Code#APIERROR} instead
          */
         @Deprecated
-        public static final int APIError = -100;
+        int APIError = -100;
 
         /**
          * @deprecated deprecated in 3.1.0, use {@link Code#NONODE} instead
          */
         @Deprecated
-        public static final int NoNode = -101;
+        int NoNode = -101;
         /**
          * @deprecated deprecated in 3.1.0, use {@link Code#NOAUTH} instead
          */
         @Deprecated
-        public static final int NoAuth = -102;
+        int NoAuth = -102;
         /**
          * @deprecated deprecated in 3.1.0, use {@link Code#BADVERSION} instead
          */
         @Deprecated
-        public static final int BadVersion = -103;
+        int BadVersion = -103;
         /**
          * @deprecated deprecated in 3.1.0, use
          * {@link Code#NOCHILDRENFOREPHEMERALS}
          * instead
          */
         @Deprecated
-        public static final int NoChildrenForEphemerals = -108;
+        int NoChildrenForEphemerals = -108;
         /**
          * @deprecated deprecated in 3.1.0, use {@link Code#NODEEXISTS} instead
          */
         @Deprecated
-        public static final int NodeExists = -110;
+        int NodeExists = -110;
         /**
          * @deprecated deprecated in 3.1.0, use {@link Code#NOTEMPTY} instead
          */
         @Deprecated
-        public static final int NotEmpty = -111;
+        int NotEmpty = -111;
         /**
          * @deprecated deprecated in 3.1.0, use {@link Code#SESSIONEXPIRED} instead
          */
         @Deprecated
-        public static final int SessionExpired = -112;
+        int SessionExpired = -112;
         /**
          * @deprecated deprecated in 3.1.0, use {@link Code#INVALIDCALLBACK}
          * instead
          */
         @Deprecated
-        public static final int InvalidCallback = -113;
+        int InvalidCallback = -113;
         /**
          * @deprecated deprecated in 3.1.0, use {@link Code#INVALIDACL} instead
          */
         @Deprecated
-        public static final int InvalidACL = -114;
+        int InvalidACL = -114;
         /**
          * @deprecated deprecated in 3.1.0, use {@link Code#AUTHFAILED} instead
          */
         @Deprecated
-        public static final int AuthFailed = -115;
-        
+        int AuthFailed = -115;
+
         // This value will be used directly in {@link CODE#SESSIONMOVED}
-        // public static final int SessionMoved = -118;       
-        
+        // public static final int SessionMoved = -118;
+
         @Deprecated
-        public static final int EphemeralOnLocalSession = -120;
+        int EphemeralOnLocalSession = -120;
 
     }
 
@@ -326,78 +327,78 @@ public abstract class KeeperException extends Exception {
      * enum values are in all CAPS.
      */
     @InterfaceAudience.Public
-    public static enum Code implements CodeDeprecated {
+    public enum Code implements CodeDeprecated {
         /** Everything is OK */
-        OK (Ok),
+        OK(Ok),
 
         /** System and server-side errors.
          * This is never thrown by the server, it shouldn't be used other than
          * to indicate a range. Specifically error codes greater than this
          * value, but lesser than {@link #APIERROR}, are system errors.
          */
-        SYSTEMERROR (SystemError),
+        SYSTEMERROR(SystemError),
 
         /** A runtime inconsistency was found */
-        RUNTIMEINCONSISTENCY (RuntimeInconsistency),
+        RUNTIMEINCONSISTENCY(RuntimeInconsistency),
         /** A data inconsistency was found */
-        DATAINCONSISTENCY (DataInconsistency),
+        DATAINCONSISTENCY(DataInconsistency),
         /** Connection to the server has been lost */
-        CONNECTIONLOSS (ConnectionLoss),
+        CONNECTIONLOSS(ConnectionLoss),
         /** Error while marshalling or unmarshalling data */
-        MARSHALLINGERROR (MarshallingError),
+        MARSHALLINGERROR(MarshallingError),
         /** Operation is unimplemented */
-        UNIMPLEMENTED (Unimplemented),
+        UNIMPLEMENTED(Unimplemented),
         /** Operation timeout */
-        OPERATIONTIMEOUT (OperationTimeout),
+        OPERATIONTIMEOUT(OperationTimeout),
         /** Invalid arguments */
-        BADARGUMENTS (BadArguments),
-        /** No quorum of new config is connected and up-to-date with the leader of last commmitted config - try 
+        BADARGUMENTS(BadArguments),
+        /** No quorum of new config is connected and up-to-date with the leader of last commmitted config - try
          *  invoking reconfiguration after new servers are connected and synced */
-        NEWCONFIGNOQUORUM (NewConfigNoQuorum),
+        NEWCONFIGNOQUORUM(NewConfigNoQuorum),
         /** Another reconfiguration is in progress -- concurrent reconfigs not supported (yet) */
-        RECONFIGINPROGRESS (ReconfigInProgress),
+        RECONFIGINPROGRESS(ReconfigInProgress),
         /** Unknown session (internal server use only) */
-        UNKNOWNSESSION (UnknownSession),
-        
+        UNKNOWNSESSION(UnknownSession),
+
         /** API errors.
          * This is never thrown by the server, it shouldn't be used other than
          * to indicate a range. Specifically error codes greater than this
          * value are API errors (while values less than this indicate a
          * {@link #SYSTEMERROR}).
          */
-        APIERROR (APIError),
+        APIERROR(APIError),
 
         /** Node does not exist */
-        NONODE (NoNode),
+        NONODE(NoNode),
         /** Not authenticated */
-        NOAUTH (NoAuth),
+        NOAUTH(NoAuth),
         /** Version conflict
-            In case of reconfiguration: reconfig requested from config version X but last seen config has a different version Y */
-        BADVERSION (BadVersion),
+         In case of reconfiguration: reconfig requested from config version X but last seen config has a different version Y */
+        BADVERSION(BadVersion),
         /** Ephemeral nodes may not have children */
-        NOCHILDRENFOREPHEMERALS (NoChildrenForEphemerals),
+        NOCHILDRENFOREPHEMERALS(NoChildrenForEphemerals),
         /** The node already exists */
-        NODEEXISTS (NodeExists),
+        NODEEXISTS(NodeExists),
         /** The node has children */
-        NOTEMPTY (NotEmpty),
+        NOTEMPTY(NotEmpty),
         /** The session has been expired by the server */
-        SESSIONEXPIRED (SessionExpired),
+        SESSIONEXPIRED(SessionExpired),
         /** Invalid callback specified */
-        INVALIDCALLBACK (InvalidCallback),
+        INVALIDCALLBACK(InvalidCallback),
         /** Invalid ACL specified */
-        INVALIDACL (InvalidACL),
+        INVALIDACL(InvalidACL),
         /** Client authentication failed */
-        AUTHFAILED (AuthFailed),
+        AUTHFAILED(AuthFailed),
         /** Session moved to another server, so operation is ignored */
-        SESSIONMOVED (-118),
+        SESSIONMOVED(-118),
         /** State-changing request is passed to read-only server */
-        NOTREADONLY (-119),
+        NOTREADONLY(-119),
         /** Attempt to create ephemeral node on a local session */
-        EPHEMERALONLOCALSESSION (EphemeralOnLocalSession),
+        EPHEMERALONLOCALSESSION(EphemeralOnLocalSession),
         /** Attempts to remove a non-existing watcher */
-        NOWATCHER (-121),
+        NOWATCHER(-121),
         /** Request not completed within max allowed time.*/
-        REQUESTTIMEOUT (-122),
+        REQUESTTIMEOUT(-122),
         /** Attempts to perform a reconfiguration operation when reconfiguration feature is disabled. */
         RECONFIGDISABLED(-123),
         /** The session has been closed by server because server requires client to do SASL authentication,
@@ -405,12 +406,12 @@ public abstract class KeeperException extends Exception {
          *  (i.e. wrong credential used.). */
         SESSIONCLOSEDREQUIRESASLAUTH(-124);
 
-        private static final Map<Integer,Code> lookup
-            = new HashMap<Integer,Code>();
+        private static final Map<Integer, Code> lookup = new HashMap<Integer, Code>();
 
         static {
-            for(Code c : EnumSet.allOf(Code.class))
+            for (Code c : EnumSet.allOf(Code.class)) {
                 lookup.put(c.code, c);
+            }
         }
 
         private final int code;
@@ -422,7 +423,9 @@ public abstract class KeeperException extends Exception {
          * Get the int value for a particular Code.
          * @return error code as integer
          */
-        public int intValue() { return code; }
+        public int intValue() {
+            return code;
+        }
 
         /**
          * Get the Code value for a particular integer error code
@@ -436,64 +439,64 @@ public abstract class KeeperException extends Exception {
 
     static String getCodeMessage(Code code) {
         switch (code) {
-            case OK:
-                return "ok";
-            case SYSTEMERROR:
-                return "SystemError";
-            case RUNTIMEINCONSISTENCY:
-                return "RuntimeInconsistency";
-            case DATAINCONSISTENCY:
-                return "DataInconsistency";
-            case CONNECTIONLOSS:
-                return "ConnectionLoss";
-            case MARSHALLINGERROR:
-                return "MarshallingError";
-            case NEWCONFIGNOQUORUM:
-               return "NewConfigNoQuorum";
-            case RECONFIGINPROGRESS:
-               return "ReconfigInProgress";
-            case UNIMPLEMENTED:
-                return "Unimplemented";
-            case OPERATIONTIMEOUT:
-                return "OperationTimeout";
-            case BADARGUMENTS:
-                return "BadArguments";
-            case APIERROR:
-                return "APIError";
-            case NONODE:
-                return "NoNode";
-            case NOAUTH:
-                return "NoAuth";
-            case BADVERSION:
-                return "BadVersion";
-            case NOCHILDRENFOREPHEMERALS:
-                return "NoChildrenForEphemerals";
-            case NODEEXISTS:
-                return "NodeExists";
-            case INVALIDACL:
-                return "InvalidACL";
-            case AUTHFAILED:
-                return "AuthFailed";
-            case NOTEMPTY:
-                return "Directory not empty";
-            case SESSIONEXPIRED:
-                return "Session expired";
-            case INVALIDCALLBACK:
-                return "Invalid callback";
-            case SESSIONMOVED:
-                return "Session moved";
-            case NOTREADONLY:
-                return "Not a read-only call";
-            case EPHEMERALONLOCALSESSION:
-                return "Ephemeral node on local session";
-            case NOWATCHER:
-                return "No such watcher";
-            case RECONFIGDISABLED:
-                return "Reconfig is disabled";
-            case SESSIONCLOSEDREQUIRESASLAUTH:
-                return "Session closed because client failed to authenticate";
-            default:
-                return "Unknown error " + code;
+        case OK:
+            return "ok";
+        case SYSTEMERROR:
+            return "SystemError";
+        case RUNTIMEINCONSISTENCY:
+            return "RuntimeInconsistency";
+        case DATAINCONSISTENCY:
+            return "DataInconsistency";
+        case CONNECTIONLOSS:
+            return "ConnectionLoss";
+        case MARSHALLINGERROR:
+            return "MarshallingError";
+        case NEWCONFIGNOQUORUM:
+            return "NewConfigNoQuorum";
+        case RECONFIGINPROGRESS:
+            return "ReconfigInProgress";
+        case UNIMPLEMENTED:
+            return "Unimplemented";
+        case OPERATIONTIMEOUT:
+            return "OperationTimeout";
+        case BADARGUMENTS:
+            return "BadArguments";
+        case APIERROR:
+            return "APIError";
+        case NONODE:
+            return "NoNode";
+        case NOAUTH:
+            return "NoAuth";
+        case BADVERSION:
+            return "BadVersion";
+        case NOCHILDRENFOREPHEMERALS:
+            return "NoChildrenForEphemerals";
+        case NODEEXISTS:
+            return "NodeExists";
+        case INVALIDACL:
+            return "InvalidACL";
+        case AUTHFAILED:
+            return "AuthFailed";
+        case NOTEMPTY:
+            return "Directory not empty";
+        case SESSIONEXPIRED:
+            return "Session expired";
+        case INVALIDCALLBACK:
+            return "Invalid callback";
+        case SESSIONMOVED:
+            return "Session moved";
+        case NOTREADONLY:
+            return "Not a read-only call";
+        case EPHEMERALONLOCALSESSION:
+            return "Ephemeral node on local session";
+        case NOWATCHER:
+            return "No such watcher";
+        case RECONFIGDISABLED:
+            return "Reconfig is disabled";
+        case SESSIONCLOSEDREQUIRESASLAUTH:
+            return "Session closed because client failed to authenticate";
+        default:
+            return "Unknown error " + code;
         }
     }
 
@@ -565,9 +568,11 @@ public abstract class KeeperException extends Exception {
      */
     @InterfaceAudience.Public
     public static class APIErrorException extends KeeperException {
+
         public APIErrorException() {
             super(Code.APIERROR);
         }
+
     }
 
     /**
@@ -575,9 +580,11 @@ public abstract class KeeperException extends Exception {
      */
     @InterfaceAudience.Public
     public static class AuthFailedException extends KeeperException {
+
         public AuthFailedException() {
             super(Code.AUTHFAILED);
         }
+
     }
 
     /**
@@ -585,12 +592,14 @@ public abstract class KeeperException extends Exception {
      */
     @InterfaceAudience.Public
     public static class BadArgumentsException extends KeeperException {
+
         public BadArgumentsException() {
             super(Code.BADARGUMENTS);
         }
         public BadArgumentsException(String path) {
             super(Code.BADARGUMENTS, path);
         }
+
     }
 
     /**
@@ -598,12 +607,14 @@ public abstract class KeeperException extends Exception {
      */
     @InterfaceAudience.Public
     public static class BadVersionException extends KeeperException {
+
         public BadVersionException() {
             super(Code.BADVERSION);
         }
         public BadVersionException(String path) {
             super(Code.BADVERSION, path);
         }
+
     }
 
     /**
@@ -611,9 +622,11 @@ public abstract class KeeperException extends Exception {
      */
     @InterfaceAudience.Public
     public static class ConnectionLossException extends KeeperException {
+
         public ConnectionLossException() {
             super(Code.CONNECTIONLOSS);
         }
+
     }
 
     /**
@@ -621,9 +634,11 @@ public abstract class KeeperException extends Exception {
      */
     @InterfaceAudience.Public
     public static class DataInconsistencyException extends KeeperException {
+
         public DataInconsistencyException() {
             super(Code.DATAINCONSISTENCY);
         }
+
     }
 
     /**
@@ -631,12 +646,14 @@ public abstract class KeeperException extends Exception {
      */
     @InterfaceAudience.Public
     public static class InvalidACLException extends KeeperException {
+
         public InvalidACLException() {
             super(Code.INVALIDACL);
         }
         public InvalidACLException(String path) {
             super(Code.INVALIDACL, path);
         }
+
     }
 
     /**
@@ -644,9 +661,11 @@ public abstract class KeeperException extends Exception {
      */
     @InterfaceAudience.Public
     public static class InvalidCallbackException extends KeeperException {
+
         public InvalidCallbackException() {
             super(Code.INVALIDCALLBACK);
         }
+
     }
 
     /**
@@ -654,9 +673,11 @@ public abstract class KeeperException extends Exception {
      */
     @InterfaceAudience.Public
     public static class MarshallingErrorException extends KeeperException {
+
         public MarshallingErrorException() {
             super(Code.MARSHALLINGERROR);
         }
+
     }
 
     /**
@@ -664,9 +685,11 @@ public abstract class KeeperException extends Exception {
      */
     @InterfaceAudience.Public
     public static class NoAuthException extends KeeperException {
+
         public NoAuthException() {
             super(Code.NOAUTH);
         }
+
     }
 
     /**
@@ -674,32 +697,38 @@ public abstract class KeeperException extends Exception {
      */
     @InterfaceAudience.Public
     public static class NewConfigNoQuorum extends KeeperException {
+
         public NewConfigNoQuorum() {
             super(Code.NEWCONFIGNOQUORUM);
         }
+
     }
-    
+
     /**
      * @see Code#RECONFIGINPROGRESS
      */
     @InterfaceAudience.Public
     public static class ReconfigInProgress extends KeeperException {
+
         public ReconfigInProgress() {
             super(Code.RECONFIGINPROGRESS);
         }
+
     }
-    
+
     /**
      * @see Code#NOCHILDRENFOREPHEMERALS
      */
     @InterfaceAudience.Public
     public static class NoChildrenForEphemeralsException extends KeeperException {
+
         public NoChildrenForEphemeralsException() {
             super(Code.NOCHILDRENFOREPHEMERALS);
         }
         public NoChildrenForEphemeralsException(String path) {
             super(Code.NOCHILDRENFOREPHEMERALS, path);
         }
+
     }
 
     /**
@@ -707,12 +736,14 @@ public abstract class KeeperException extends Exception {
      */
     @InterfaceAudience.Public
     public static class NodeExistsException extends KeeperException {
+
         public NodeExistsException() {
             super(Code.NODEEXISTS);
         }
         public NodeExistsException(String path) {
             super(Code.NODEEXISTS, path);
         }
+
     }
 
     /**
@@ -720,12 +751,14 @@ public abstract class KeeperException extends Exception {
      */
     @InterfaceAudience.Public
     public static class NoNodeException extends KeeperException {
+
         public NoNodeException() {
             super(Code.NONODE);
         }
         public NoNodeException(String path) {
             super(Code.NONODE, path);
         }
+
     }
 
     /**
@@ -733,12 +766,14 @@ public abstract class KeeperException extends Exception {
      */
     @InterfaceAudience.Public
     public static class NotEmptyException extends KeeperException {
+
         public NotEmptyException() {
             super(Code.NOTEMPTY);
         }
         public NotEmptyException(String path) {
             super(Code.NOTEMPTY, path);
         }
+
     }
 
     /**
@@ -746,9 +781,11 @@ public abstract class KeeperException extends Exception {
      */
     @InterfaceAudience.Public
     public static class OperationTimeoutException extends KeeperException {
+
         public OperationTimeoutException() {
             super(Code.OPERATIONTIMEOUT);
         }
+
     }
 
     /**
@@ -756,9 +793,11 @@ public abstract class KeeperException extends Exception {
      */
     @InterfaceAudience.Public
     public static class RuntimeInconsistencyException extends KeeperException {
+
         public RuntimeInconsistencyException() {
             super(Code.RUNTIMEINCONSISTENCY);
         }
+
     }
 
     /**
@@ -766,9 +805,11 @@ public abstract class KeeperException extends Exception {
      */
     @InterfaceAudience.Public
     public static class SessionExpiredException extends KeeperException {
+
         public SessionExpiredException() {
             super(Code.SESSIONEXPIRED);
         }
+
     }
 
     /**
@@ -776,9 +817,11 @@ public abstract class KeeperException extends Exception {
      */
     @InterfaceAudience.Public
     public static class UnknownSessionException extends KeeperException {
+
         public UnknownSessionException() {
             super(Code.UNKNOWNSESSION);
         }
+
     }
 
     /**
@@ -786,9 +829,11 @@ public abstract class KeeperException extends Exception {
      */
     @InterfaceAudience.Public
     public static class SessionMovedException extends KeeperException {
+
         public SessionMovedException() {
             super(Code.SESSIONMOVED);
         }
+
     }
 
     /**
@@ -796,9 +841,11 @@ public abstract class KeeperException extends Exception {
      */
     @InterfaceAudience.Public
     public static class NotReadOnlyException extends KeeperException {
+
         public NotReadOnlyException() {
             super(Code.NOTREADONLY);
         }
+
     }
 
     /**
@@ -806,9 +853,11 @@ public abstract class KeeperException extends Exception {
      */
     @InterfaceAudience.Public
     public static class EphemeralOnLocalSessionException extends KeeperException {
+
         public EphemeralOnLocalSessionException() {
             super(Code.EPHEMERALONLOCALSESSION);
         }
+
     }
 
     /**
@@ -816,9 +865,11 @@ public abstract class KeeperException extends Exception {
      */
     @InterfaceAudience.Public
     public static class SystemErrorException extends KeeperException {
+
         public SystemErrorException() {
             super(Code.SYSTEMERROR);
         }
+
     }
 
     /**
@@ -826,9 +877,11 @@ public abstract class KeeperException extends Exception {
      */
     @InterfaceAudience.Public
     public static class UnimplementedException extends KeeperException {
+
         public UnimplementedException() {
             super(Code.UNIMPLEMENTED);
         }
+
     }
 
     /**
@@ -836,6 +889,7 @@ public abstract class KeeperException extends Exception {
      */
     @InterfaceAudience.Public
     public static class NoWatcherException extends KeeperException {
+
         public NoWatcherException() {
             super(Code.NOWATCHER);
         }
@@ -843,6 +897,7 @@ public abstract class KeeperException extends Exception {
         public NoWatcherException(String path) {
             super(Code.NOWATCHER, path);
         }
+
     }
 
     /**
@@ -850,28 +905,39 @@ public abstract class KeeperException extends Exception {
      */
     @InterfaceAudience.Public
     public static class ReconfigDisabledException extends KeeperException {
-        public ReconfigDisabledException() { super(Code.RECONFIGDISABLED); }
+
+        public ReconfigDisabledException() {
+            super(Code.RECONFIGDISABLED);
+        }
         public ReconfigDisabledException(String path) {
             super(Code.RECONFIGDISABLED, path);
         }
+
     }
 
     /**
      * @see Code#SESSIONCLOSEDREQUIRESASLAUTH
      */
     public static class SessionClosedRequireAuthException extends KeeperException {
-        public SessionClosedRequireAuthException() { super(Code.SESSIONCLOSEDREQUIRESASLAUTH); }
+
+        public SessionClosedRequireAuthException() {
+            super(Code.SESSIONCLOSEDREQUIRESASLAUTH);
+        }
         public SessionClosedRequireAuthException(String path) {
             super(Code.SESSIONCLOSEDREQUIRESASLAUTH, path);
         }
+
     }
 
     /**
      * @see Code#REQUESTTIMEOUT
      */
     public static class RequestTimeoutException extends KeeperException {
+
         public RequestTimeoutException() {
             super(Code.REQUESTTIMEOUT);
         }
+
     }
+
 }
diff --git a/zookeeper-server/src/main/java/org/apache/zookeeper/Login.java b/zookeeper-server/src/main/java/org/apache/zookeeper/Login.java
index 5806fcb..e95a350 100644
--- a/zookeeper-server/src/main/java/org/apache/zookeeper/Login.java
+++ b/zookeeper-server/src/main/java/org/apache/zookeeper/Login.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -25,28 +25,26 @@ package org.apache.zookeeper;
  * See ZooKeeperSaslClient for client-side usage.
  */
 
+import java.util.Date;
+import java.util.Random;
+import java.util.Set;
+import javax.security.auth.Subject;
+import javax.security.auth.callback.CallbackHandler;
 import javax.security.auth.kerberos.KerberosPrincipal;
+import javax.security.auth.kerberos.KerberosTicket;
 import javax.security.auth.login.AppConfigurationEntry;
 import javax.security.auth.login.Configuration;
 import javax.security.auth.login.LoginContext;
 import javax.security.auth.login.LoginException;
-import javax.security.auth.callback.CallbackHandler;
-
 import org.apache.zookeeper.client.ZKClientConfig;
+import org.apache.zookeeper.common.Time;
 import org.apache.zookeeper.common.ZKConfig;
 import org.apache.zookeeper.server.ZooKeeperSaslServer;
-import org.apache.zookeeper.common.Time;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.security.auth.kerberos.KerberosTicket;
-import javax.security.auth.Subject;
-
-import java.util.Date;
-import java.util.Random;
-import java.util.Set;
-
 public class Login {
+
     private static final String KINIT_COMMAND_DEFAULT = "/usr/bin/kinit";
     private static final Logger LOG = LoggerFactory.getLogger(Login.class);
     public CallbackHandler callbackHandler;
@@ -85,7 +83,7 @@ public class Login {
     /**
      * LoginThread constructor. The constructor starts the thread used to
      * periodically re-login to the Kerberos Ticket Granting Server.
-     * 
+     *
      * @param loginContextName
      *            name of section in JAAS file that will be use to login. Passed
      *            as first param to javax.security.auth.login.LoginContext().
@@ -98,25 +96,24 @@ public class Login {
      * @throws javax.security.auth.login.LoginException
      *             Thrown if authentication fails.
      */
-    public Login(final String loginContextName, CallbackHandler callbackHandler, final ZKConfig zkConfig)
-            throws LoginException {
-        this.zkConfig=zkConfig;
+    public Login(final String loginContextName, CallbackHandler callbackHandler, final ZKConfig zkConfig) throws LoginException {
+        this.zkConfig = zkConfig;
         this.callbackHandler = callbackHandler;
         login = login(loginContextName);
         this.loginContextName = loginContextName;
         subject = login.getSubject();
         isKrbTicket = !subject.getPrivateCredentials(KerberosTicket.class).isEmpty();
-        AppConfigurationEntry entries[] = Configuration.getConfiguration().getAppConfigurationEntry(loginContextName);
-        for (AppConfigurationEntry entry: entries) {
+        AppConfigurationEntry[] entries = Configuration.getConfiguration().getAppConfigurationEntry(loginContextName);
+        for (AppConfigurationEntry entry : entries) {
             // there will only be a single entry, so this for() loop will only be iterated through once.
             if (entry.getOptions().get("useTicketCache") != null) {
-                String val = (String)entry.getOptions().get("useTicketCache");
+                String val = (String) entry.getOptions().get("useTicketCache");
                 if (val.equals("true")) {
                     isUsingTicketCache = true;
                 }
             }
             if (entry.getOptions().get("principal") != null) {
-                principal = (String)entry.getOptions().get("principal");
+                principal = (String) entry.getOptions().get("principal");
             }
             break;
         }
@@ -148,21 +145,20 @@ public class Login {
                         Date expiryDate = new Date(expiry);
                         if ((isUsingTicketCache) && (tgt.getEndTime().equals(tgt.getRenewTill()))) {
                             Object[] logPayload = {expiryDate, principal, principal};
-                            LOG.error("The TGT cannot be renewed beyond the next expiry date: {}." +
-                                    "This process will not be able to authenticate new SASL connections after that " +
-                                    "time (for example, it will not be authenticate a new connection with a Zookeeper " +
-                                    "Quorum member).  Ask your system administrator to either increase the " +
-                                    "'renew until' time by doing : 'modprinc -maxrenewlife {}' within " +
-                                    "kadmin, or instead, to generate a keytab for {}. Because the TGT's " +
-                                    "expiry cannot be further extended by refreshing, exiting refresh thread now.", logPayload);
+                            LOG.error("The TGT cannot be renewed beyond the next expiry date: {}."
+                                      + "This process will not be able to authenticate new SASL connections after that "
+                                      + "time (for example, it will not be authenticate a new connection with a Zookeeper "
+                                      + "Quorum member).  Ask your system administrator to either increase the "
+                                      + "'renew until' time by doing : 'modprinc -maxrenewlife {}' within "
+                                      + "kadmin, or instead, to generate a keytab for {}. Because the TGT's "
+                                      + "expiry cannot be further extended by refreshing, exiting refresh thread now.", logPayload);
                             return;
                         }
                         // determine how long to sleep from looking at ticket's expiry.
                         // We should not allow the ticket to expire, but we should take into consideration
                         // MIN_TIME_BEFORE_RELOGIN. Will not sleep less than MIN_TIME_BEFORE_RELOGIN, unless doing so
                         // would cause ticket expiration.
-                        if ((nextRefresh > expiry) ||
-                                ((now + MIN_TIME_BEFORE_RELOGIN) > expiry)) {
+                        if ((nextRefresh > expiry) || ((now + MIN_TIME_BEFORE_RELOGIN) > expiry)) {
                             // expiry is before next scheduled refresh).
                             nextRefresh = now;
                         } else {
@@ -172,8 +168,8 @@ public class Login {
                                 Date newuntil = new Date(now + MIN_TIME_BEFORE_RELOGIN);
                                 Object[] logPayload = {until, newuntil, (MIN_TIME_BEFORE_RELOGIN / 1000)};
                                 LOG.warn("TGT refresh thread time adjusted from : {} to : {} since "
-                                        + "the former is sooner than the minimum refresh interval ("
-                                        + "{} seconds) from now.", logPayload);
+                                         + "the former is sooner than the minimum refresh interval ("
+                                         + "{} seconds) from now.", logPayload);
                             }
                             nextRefresh = Math.max(nextRefresh, now + MIN_TIME_BEFORE_RELOGIN);
                         }
@@ -181,8 +177,8 @@ public class Login {
                         if (nextRefresh > expiry) {
                             Object[] logPayload = {nextRefreshDate, expiryDate};
                             LOG.error("next refresh: {} is later than expiry {}."
-                                    + " This may indicate a clock skew problem. Check that this host and the KDC's "
-                                    + "hosts' clocks are in sync. Exiting refresh thread.", logPayload);
+                                      + " This may indicate a clock skew problem. Check that this host and the KDC's "
+                                      + "hosts' clocks are in sync. Exiting refresh thread.", logPayload);
                             return;
                         }
                     }
@@ -197,12 +193,11 @@ public class Login {
                             LOG.warn("TGT renewal thread has been interrupted and will exit.");
                             break;
                         }
-                    }
-                    else {
+                    } else {
                         LOG.error("nextRefresh:{} is in the past: exiting refresh thread. Check"
-                                + " clock sync between this host and KDC - (KDC's clock is likely ahead of this host)."
-                                + " Manual intervention will be required for this client to successfully authenticate."
-                                + " Exiting refresh thread.", nextRefreshDate);
+                                  + " clock sync between this host and KDC - (KDC's clock is likely ahead of this host)."
+                                  + " Manual intervention will be required for this client to successfully authenticate."
+                                  + " Exiting refresh thread.", nextRefreshDate);
                         break;
                     }
                     if (isUsingTicketCache) {
@@ -227,7 +222,8 @@ public class Login {
                                 } else {
                                     Object[] logPayload = {cmd, kinitArgs, e.toString(), e};
                                     LOG.warn("Could not renew TGT due to problem running shell command: '{}"
-                                            + " {}'; exception was:{}. Exiting refresh thread.", logPayload);
+                                             + " {}'; exception was:{}. Exiting refresh thread.",
+                                             logPayload);
                                     return;
                                 }
                             }
@@ -255,7 +251,7 @@ public class Login {
                             }
                         }
                     } catch (LoginException le) {
-                        LOG.error("Failed to refresh TGT: refresh thread exiting now.",le);
+                        LOG.error("Failed to refresh TGT: refresh thread exiting now.", le);
                         break;
                     }
                 }
@@ -292,12 +288,13 @@ public class Login {
 
     private synchronized LoginContext login(final String loginContextName) throws LoginException {
         if (loginContextName == null) {
-            throw new LoginException("loginContext name (JAAS file section header) was null. " +
-                    "Please check your java.security.login.auth.config (=" +
-                    System.getProperty("java.security.login.auth.config") +
-                    ") and your " + getLoginContextMessage());
+            throw new LoginException("loginContext name (JAAS file section header) was null. "
+                                     + "Please check your java.security.login.auth.config (="
+                                     + System.getProperty("java.security.login.auth.config")
+                                     + ") and your "
+                                     + getLoginContextMessage());
         }
-        LoginContext loginContext = new LoginContext(loginContextName,callbackHandler);
+        LoginContext loginContext = new LoginContext(loginContextName, callbackHandler);
         loginContext.login();
         LOG.info("{} successfully logged in.", loginContextName);
         return loginContext;
@@ -305,11 +302,15 @@ public class Login {
 
     private String getLoginContextMessage() {
         if (zkConfig instanceof ZKClientConfig) {
-            return ZKClientConfig.LOGIN_CONTEXT_NAME_KEY + "(=" + zkConfig.getProperty(
-                    ZKClientConfig.LOGIN_CONTEXT_NAME_KEY, ZKClientConfig.LOGIN_CONTEXT_NAME_KEY_DEFAULT) + ")";
+            return ZKClientConfig.LOGIN_CONTEXT_NAME_KEY
+                   + "(="
+                   + zkConfig.getProperty(ZKClientConfig.LOGIN_CONTEXT_NAME_KEY, ZKClientConfig.LOGIN_CONTEXT_NAME_KEY_DEFAULT)
+                   + ")";
         } else {
-            return ZooKeeperSaslServer.LOGIN_CONTEXT_NAME_KEY + "(=" + System.getProperty(
-                    ZooKeeperSaslServer.LOGIN_CONTEXT_NAME_KEY, ZooKeeperSaslServer.DEFAULT_LOGIN_CONTEXT_NAME) + ")";
+            return ZooKeeperSaslServer.LOGIN_CONTEXT_NAME_KEY
+                   + "(="
+                   + System.getProperty(ZooKeeperSaslServer.LOGIN_CONTEXT_NAME_KEY, ZooKeeperSaslServer.DEFAULT_LOGIN_CONTEXT_NAME)
+                   + ")";
         }
     }
 
@@ -319,24 +320,22 @@ public class Login {
         long expires = tgt.getEndTime().getTime();
         LOG.info("TGT valid starting at:        {}", tgt.getStartTime().toString());
         LOG.info("TGT expires:                  {}", tgt.getEndTime().toString());
-        long proposedRefresh = start + (long) ((expires - start) *
-                (TICKET_RENEW_WINDOW + (TICKET_RENEW_JITTER * rng.nextDouble())));
+        long proposedRefresh = start + (long) ((expires - start) * (TICKET_RENEW_WINDOW + (TICKET_RENEW_JITTER * rng.nextDouble())));
         if (proposedRefresh > expires) {
             // proposedRefresh is too far in the future: it's after ticket expires: simply return now.
             return Time.currentWallTime();
-        }
-        else {
+        } else {
             return proposedRefresh;
         }
     }
 
     private synchronized KerberosTicket getTGT() {
         Set<KerberosTicket> tickets = subject.getPrivateCredentials(KerberosTicket.class);
-        for(KerberosTicket ticket: tickets) {
+        for (KerberosTicket ticket : tickets) {
             KerberosPrincipal server = ticket.getServer();
             if (server.getName().equals("krbtgt/" + server.getRealm() + "@" + server.getRealm())) {
                 LOG.debug("Client principal is \"{}\".", ticket.getClient().getName());
-                LOG.debug("Server principal is \"{}\".",  ticket.getServer().getName());
+                LOG.debug("Server principal is \"{}\".", ticket.getServer().getName());
                 return ticket;
             }
         }
@@ -345,10 +344,10 @@ public class Login {
 
     private boolean hasSufficientTimeElapsed() {
         long now = Time.currentElapsedTime();
-        if (now - getLastLogin() < MIN_TIME_BEFORE_RELOGIN ) {
+        if (now - getLastLogin() < MIN_TIME_BEFORE_RELOGIN) {
             LOG.warn("Not attempting to re-login since the last re-login was "
-                    + "attempted less than {} seconds before.",
-                    (MIN_TIME_BEFORE_RELOGIN / 1000));
+                     + "attempted less than {} seconds before.",
+                     (MIN_TIME_BEFORE_RELOGIN / 1000));
             return false;
         }
         // register most recent relogin attempt
@@ -393,13 +392,12 @@ public class Login {
      * @throws javax.security.auth.login.LoginException on a failure
      */
     // c.f. HADOOP-6559
-    private synchronized void reLogin()
-            throws LoginException {
+    private synchronized void reLogin() throws LoginException {
         if (!isKrbTicket) {
             return;
         }
         LoginContext login = getLogin();
-        if (login  == null) {
+        if (login == null) {
             throw new LoginException("login must be done first");
         }
         if (!hasSufficientTimeElapsed()) {
@@ -419,4 +417,5 @@ public class Login {
             setLogin(login);
         }
     }
+
 }
diff --git a/zookeeper-server/src/main/java/org/apache/zookeeper/MultiOperationRecord.java b/zookeeper-server/src/main/java/org/apache/zookeeper/MultiOperationRecord.java
index ef6a9f3..d43e728 100644
--- a/zookeeper-server/src/main/java/org/apache/zookeeper/MultiOperationRecord.java
+++ b/zookeeper-server/src/main/java/org/apache/zookeeper/MultiOperationRecord.java
@@ -17,15 +17,21 @@
 
 package org.apache.zookeeper;
 
-import org.apache.jute.InputArchive;
-import org.apache.jute.OutputArchive;
-import org.apache.jute.Record;
-import org.apache.zookeeper.proto.*;
-
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
+import org.apache.jute.InputArchive;
+import org.apache.jute.OutputArchive;
+import org.apache.jute.Record;
+import org.apache.zookeeper.proto.CheckVersionRequest;
+import org.apache.zookeeper.proto.CreateRequest;
+import org.apache.zookeeper.proto.CreateTTLRequest;
+import org.apache.zookeeper.proto.DeleteRequest;
+import org.apache.zookeeper.proto.GetChildrenRequest;
+import org.apache.zookeeper.proto.GetDataRequest;
+import org.apache.zookeeper.proto.MultiHeader;
+import org.apache.zookeeper.proto.SetDataRequest;
 
 /**
  * Encodes a composite operation.  In the wire format, each operation
@@ -36,6 +42,7 @@ import java.util.List;
  * All of the operations must be from the same OpKind.
  */
 public class MultiOperationRecord implements Record, Iterable<Op> {
+
     private List<Op> ops = new ArrayList<Op>();
     private Op.OpKind opKind = null;
 
@@ -51,7 +58,7 @@ public class MultiOperationRecord implements Record, Iterable<Op> {
 
     @Override
     public Iterator<Op> iterator() {
-        return ops.iterator() ;
+        return ops.iterator();
     }
 
     public void add(Op op) throws IllegalArgumentException {
@@ -65,7 +72,7 @@ public class MultiOperationRecord implements Record, Iterable<Op> {
 
     /**
      * Returns the kind of the operations contained by the record.
-     * @return  The OpKind value of all the elements in the record.
+     * @return The OpKind value of all the elements in the record.
      */
     public Op.OpKind getOpKind() {
         return opKind;
@@ -75,8 +82,8 @@ public class MultiOperationRecord implements Record, Iterable<Op> {
         if (opKind == null) {
             opKind = ok;
         } else if (ok != opKind) {
-            throw new IllegalArgumentException("Mixing read and write operations (transactions)" +
-                      " is not allowed in a multi request.");
+            throw new IllegalArgumentException("Mixing read and write operations (transactions)"
+                                               + " is not allowed in a multi request.");
         }
     }
 
@@ -87,19 +94,19 @@ public class MultiOperationRecord implements Record, Iterable<Op> {
             MultiHeader h = new MultiHeader(op.getType(), false, -1);
             h.serialize(archive, tag);
             switch (op.getType()) {
-                case ZooDefs.OpCode.create:
-                case ZooDefs.OpCode.create2:
-                case ZooDefs.OpCode.createTTL:
-                case ZooDefs.OpCode.createContainer:
-                case ZooDefs.OpCode.delete:
-                case ZooDefs.OpCode.setData:
-                case ZooDefs.OpCode.check:
-                case ZooDefs.OpCode.getChildren:
-                case ZooDefs.OpCode.getData:
-                    op.toRequestRecord().serialize(archive, tag);
-                    break;
-                default:
-                    throw new IOException("Invalid type of op");
+            case ZooDefs.OpCode.create:
+            case ZooDefs.OpCode.create2:
+            case ZooDefs.OpCode.createTTL:
+            case ZooDefs.OpCode.createContainer:
+            case ZooDefs.OpCode.delete:
+            case ZooDefs.OpCode.setData:
+            case ZooDefs.OpCode.check:
+            case ZooDefs.OpCode.getChildren:
+            case ZooDefs.OpCode.getData:
+                op.toRequestRecord().serialize(archive, tag);
+                break;
+            default:
+                throw new IOException("Invalid type of op");
             }
         }
         new MultiHeader(-1, true, -1).serialize(archive, tag);
@@ -114,45 +121,45 @@ public class MultiOperationRecord implements Record, Iterable<Op> {
         try {
             while (!h.getDone()) {
                 switch (h.getType()) {
-                    case ZooDefs.OpCode.create:
-                    case ZooDefs.OpCode.create2:
-                    case ZooDefs.OpCode.createContainer:
-                        CreateRequest cr = new CreateRequest();
-                        cr.deserialize(archive, tag);
-                        add(Op.create(cr.getPath(), cr.getData(), cr.getAcl(), cr.getFlags()));
-                        break;
-                    case ZooDefs.OpCode.createTTL:
-                        CreateTTLRequest crTtl = new CreateTTLRequest();
-                        crTtl.deserialize(archive, tag);
-                        add(Op.create(crTtl.getPath(), crTtl.getData(), crTtl.getAcl(), crTtl.getFlags(), crTtl.getTtl()));
-                        break;
-                    case ZooDefs.OpCode.delete:
-                        DeleteRequest dr = new DeleteRequest();
-                        dr.deserialize(archive, tag);
-                        add(Op.delete(dr.getPath(), dr.getVersion()));
-                        break;
-                    case ZooDefs.OpCode.setData:
-                        SetDataRequest sdr = new SetDataRequest();
-                        sdr.deserialize(archive, tag);
-                        add(Op.setData(sdr.getPath(), sdr.getData(), sdr.getVersion()));
-                        break;
-                    case ZooDefs.OpCode.check:
-                        CheckVersionRequest cvr = new CheckVersionRequest();
-                        cvr.deserialize(archive, tag);
-                        add(Op.check(cvr.getPath(), cvr.getVersion()));
-                        break;
-                    case ZooDefs.OpCode.getChildren:
-                        GetChildrenRequest gcr = new GetChildrenRequest();
-                        gcr.deserialize(archive, tag);
-                        add(Op.getChildren(gcr.getPath()));
-                        break;
-                    case ZooDefs.OpCode.getData:
-                        GetDataRequest gdr = new GetDataRequest();
-                        gdr.deserialize(archive, tag);
-                        add(Op.getData(gdr.getPath()));
-                        break;
-                    default:
-                        throw new IOException("Invalid type of op");
+                case ZooDefs.OpCode.create:
+                case ZooDefs.OpCode.create2:
+                case ZooDefs.OpCode.createContainer:
+                    CreateRequest cr = new CreateRequest();
+                    cr.deserialize(archive, tag);
+                    add(Op.create(cr.getPath(), cr.getData(), cr.getAcl(), cr.getFlags()));
+                    break;
+                case ZooDefs.OpCode.createTTL:
+                    CreateTTLRequest crTtl = new CreateTTLRequest();
+                    crTtl.deserialize(archive, tag);
+                    add(Op.create(crTtl.getPath(), crTtl.getData(), crTtl.getAcl(), crTtl.getFlags(), crTtl.getTtl()));
+                    break;
+                case ZooDefs.OpCode.delete:
+                    DeleteRequest dr = new DeleteRequest();
+                    dr.deserialize(archive, tag);
+                    add(Op.delete(dr.getPath(), dr.getVersion()));
+                    break;
+                case ZooDefs.OpCode.setData:
+                    SetDataRequest sdr = new SetDataRequest();
+                    sdr.deserialize(archive, tag);
+                    add(Op.setData(sdr.getPath(), sdr.getData(), sdr.getVersion()));
+                    break;
+                case ZooDefs.OpCode.check:
+                    CheckVersionRequest cvr = new CheckVersionRequest();
+                    cvr.deserialize(archive, tag);
+                    add(Op.check(cvr.getPath(), cvr.getVersion()));
+                    break;
+                case ZooDefs.OpCode.getChildren:
+                    GetChildrenRequest gcr = new GetChildrenRequest();
+                    gcr.deserialize(archive, tag);
+                    add(Op.getChildren(gcr.getPath()));
+                    break;
+                case ZooDefs.OpCode.getData:
+                    GetDataRequest gdr = new GetDataRequest();
+                    gdr.deserialize(archive, tag);
+                    add(Op.getData(gdr.getPath()));
+                    break;
+                default:
+                    throw new IOException("Invalid type of op");
                 }
                 h.deserialize(archive, tag);
             }
@@ -164,8 +171,12 @@ public class MultiOperationRecord implements Record, Iterable<Op> {
 
     @Override
     public boolean equals(Object o) {
-        if (this == o) return true;
-        if (!(o instanceof MultiOperationRecord)) return false;
+        if (this == o) {
+            return true;
+        }
+        if (!(o instanceof MultiOperationRecord)) {
+            return false;
+        }
 
         MultiOperationRecord that = (MultiOperationRecord) o;
 
@@ -196,4 +207,5 @@ public class MultiOperationRecord implements Record, Iterable<Op> {
         }
         return h;
     }
+
 }
diff --git a/zookeeper-server/src/main/java/org/apache/zookeeper/MultiResponse.java b/zookeeper-server/src/main/java/org/apache/zookeeper/MultiResponse.java
index bd5c77b..16d2fb2 100644
--- a/zookeeper-server/src/main/java/org/apache/zookeeper/MultiResponse.java
+++ b/zookeeper-server/src/main/java/org/apache/zookeeper/MultiResponse.java
@@ -17,21 +17,20 @@
 
 package org.apache.zookeeper;
 
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
 import org.apache.jute.InputArchive;
 import org.apache.jute.OutputArchive;
 import org.apache.jute.Record;
 import org.apache.zookeeper.proto.Create2Response;
 import org.apache.zookeeper.proto.CreateResponse;
+import org.apache.zookeeper.proto.ErrorResponse;
 import org.apache.zookeeper.proto.GetChildrenResponse;
 import org.apache.zookeeper.proto.GetDataResponse;
 import org.apache.zookeeper.proto.MultiHeader;
 import org.apache.zookeeper.proto.SetDataResponse;
-import org.apache.zookeeper.proto.ErrorResponse;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
 
 /**
  * Handles the response from a multi request.  Such a response consists of
@@ -41,6 +40,7 @@ import java.util.List;
  * with the corresponding operation in the original request list.
  */
 public class MultiResponse implements Record, Iterable<OpResult> {
+
     private List<OpResult> results = new ArrayList<OpResult>();
 
     public void add(OpResult x) {
@@ -61,36 +61,38 @@ public class MultiResponse implements Record, Iterable<OpResult> {
         archive.startRecord(this, tag);
 
         for (OpResult result : results) {
-            int err = result.getType() == ZooDefs.OpCode.error ? ((OpResult.ErrorResult)result).getErr() : 0;
+            int err = result.getType() == ZooDefs.OpCode.error ? ((OpResult.ErrorResult) result).getErr() : 0;
 
             new MultiHeader(result.getType(), false, err).serialize(archive, tag);
 
             switch (result.getType()) {
-                case ZooDefs.OpCode.create:
-                    new CreateResponse(((OpResult.CreateResult) result).getPath()).serialize(archive, tag);
-                    break;
-                case ZooDefs.OpCode.create2:
-                	OpResult.CreateResult createResult = (OpResult.CreateResult) result;
-                    new Create2Response(createResult.getPath(),
-                    		createResult.getStat()).serialize(archive, tag);
-                    break;
-                case ZooDefs.OpCode.delete:
-                case ZooDefs.OpCode.check:
-                    break;
-                case ZooDefs.OpCode.setData:
-                    new SetDataResponse(((OpResult.SetDataResult) result).getStat()).serialize(archive, tag);
-                    break;
-                case ZooDefs.OpCode.getChildren:
-                    new GetChildrenResponse(((OpResult.GetChildrenResult) result).getChildren()).serialize(archive, tag);
-                    break;
-                case ZooDefs.OpCode.getData:
-                    new GetDataResponse(((OpResult.GetDataResult) result).getData(),((OpResult.GetDataResult) result).getStat()).serialize(archive, tag);
-                    break;
-                case ZooDefs.OpCode.error:
-                    new ErrorResponse(((OpResult.ErrorResult) result).getErr()).serialize(archive, tag);
-                    break;
-                default:
-                    throw new IOException("Invalid type " + result.getType() + " in MultiResponse");
+            case ZooDefs.OpCode.create:
+                new CreateResponse(((OpResult.CreateResult) result).getPath()).serialize(archive, tag);
+                break;
+            case ZooDefs.OpCode.create2:
+                OpResult.CreateResult createResult = (OpResult.CreateResult) result;
+                new Create2Response(createResult.getPath(), createResult.getStat()).serialize(archive, tag);
+                break;
+            case ZooDefs.OpCode.delete:
+            case ZooDefs.OpCode.check:
+                break;
+            case ZooDefs.OpCode.setData:
+                new SetDataResponse(((OpResult.SetDataResult) result).getStat()).serialize(archive, tag);
+                break;
+            case ZooDefs.OpCode.getChildren:
+                new GetChildrenResponse(((OpResult.GetChildrenResult) result).getChildren()).serialize(archive, tag);
+                break;
+            case ZooDefs.OpCode.getData:
+                new GetDataResponse(
+                    ((OpResult.GetDataResult) result).getData(),
+                    ((OpResult.GetDataResult) result).getStat())
+                    .serialize(archive, tag);
+                break;
+            case ZooDefs.OpCode.error:
+                new ErrorResponse(((OpResult.ErrorResult) result).getErr()).serialize(archive, tag);
+                break;
+            default:
+                throw new IOException("Invalid type " + result.getType() + " in MultiResponse");
             }
         }
         new MultiHeader(-1, true, -1).serialize(archive, tag);
@@ -106,53 +108,53 @@ public class MultiResponse implements Record, Iterable<OpResult> {
         h.deserialize(archive, tag);
         while (!h.getDone()) {
             switch (h.getType()) {
-                case ZooDefs.OpCode.create:
-                    CreateResponse cr = new CreateResponse();
-                    cr.deserialize(archive, tag);
-                    results.add(new OpResult.CreateResult(cr.getPath()));
-                    break;
-
-                case ZooDefs.OpCode.create2:
-                    Create2Response cr2 = new Create2Response();
-                    cr2.deserialize(archive, tag);
-                    results.add(new OpResult.CreateResult(cr2.getPath(), cr2.getStat()));
-                    break;
-
-                case ZooDefs.OpCode.delete:
-                    results.add(new OpResult.DeleteResult());
-                    break;
-
-                case ZooDefs.OpCode.setData:
-                    SetDataResponse sdr = new SetDataResponse();
-                    sdr.deserialize(archive, tag);
-                    results.add(new OpResult.SetDataResult(sdr.getStat()));
-                    break;
-
-                case ZooDefs.OpCode.check:
-                    results.add(new OpResult.CheckResult());
-                    break;
-
-                case ZooDefs.OpCode.getChildren:
-                    GetChildrenResponse gcr = new GetChildrenResponse();
-                    gcr.deserialize(archive, tag);
-                    results.add(new OpResult.GetChildrenResult(gcr.getChildren()));
-                    break;
-
-                case ZooDefs.OpCode.getData:
-                    GetDataResponse gdr = new GetDataResponse();
-                    gdr.deserialize(archive, tag);
-                    results.add(new OpResult.GetDataResult(gdr.getData(), gdr.getStat()));
-                    break;
-
-                case ZooDefs.OpCode.error:
-                    //FIXME: need way to more cleanly serialize/deserialize exceptions
-                    ErrorResponse er = new ErrorResponse();
-                    er.deserialize(archive, tag);
-                    results.add(new OpResult.ErrorResult(er.getErr()));
-                    break;
-
-                default:
-                    throw new IOException("Invalid type " + h.getType() + " in MultiResponse");
+            case ZooDefs.OpCode.create:
+                CreateResponse cr = new CreateResponse();
+                cr.deserialize(archive, tag);
+                results.add(new OpResult.CreateResult(cr.getPath()));
+                break;
+
+            case ZooDefs.OpCode.create2:
+                Create2Response cr2 = new Create2Response();
+                cr2.deserialize(archive, tag);
+                results.add(new OpResult.CreateResult(cr2.getPath(), cr2.getStat()));
+                break;
+
+            case ZooDefs.OpCode.delete:
+                results.add(new OpResult.DeleteResult());
+                break;
+
+            case ZooDefs.OpCode.setData:
+                SetDataResponse sdr = new SetDataResponse();
+                sdr.deserialize(archive, tag);
+                results.add(new OpResult.SetDataResult(sdr.getStat()));
+                break;
+
+            case ZooDefs.OpCode.check:
+                results.add(new OpResult.CheckResult());
+                break;
+
+            case ZooDefs.OpCode.getChildren:
+                GetChildrenResponse gcr = new GetChildrenResponse();
+                gcr.deserialize(archive, tag);
+                results.add(new OpResult.GetChildrenResult(gcr.getChildren()));
+                break;
+
+            case ZooDefs.OpCode.getData:
+                GetDataResponse gdr = new GetDataResponse();
+                gdr.deserialize(archive, tag);
+                results.add(new OpResult.GetDataResult(gdr.getData(), gdr.getStat()));
+                break;
+
+            case ZooDefs.OpCode.error:
+                // TODO: need way to more cleanly serialize/deserialize exceptions
+                ErrorResponse er = new ErrorResponse();
+                er.deserialize(archive, tag);
+                results.add(new OpResult.ErrorResult(er.getErr()));
+                break;
+
+            default:
+                throw new IOException("Invalid type " + h.getType() + " in MultiResponse");
             }
             h.deserialize(archive, tag);
         }
@@ -165,8 +167,12 @@ public class MultiResponse implements Record, Iterable<OpResult> {
 
     @Override
     public boolean equals(Object o) {
-        if (this == o) return true;
-        if (!(o instanceof MultiResponse)) return false;
+        if (this == o) {
+            return true;
+        }
+        if (!(o instanceof MultiResponse)) {
+            return false;
+        }
 
         MultiResponse other = (MultiResponse) o;
 
@@ -182,8 +188,9 @@ public class MultiResponse implements Record, Iterable<OpResult> {
                 }
             }
             return !i.hasNext();
+        } else {
+            return other.results == null;
         }
-        else return other.results == null;
     }
 
     @Override
@@ -194,4 +201,5 @@ public class MultiResponse implements Record, Iterable<OpResult> {
         }
         return hash;
     }
+
 }
diff --git a/zookeeper-server/src/main/java/org/apache/zookeeper/Op.java b/zookeeper-server/src/main/java/org/apache/zookeeper/Op.java
index 226f64e..8597ea8 100644
--- a/zookeeper-server/src/main/java/org/apache/zookeeper/Op.java
+++ b/zookeeper-server/src/main/java/org/apache/zookeeper/Op.java
@@ -17,6 +17,9 @@
 
 package org.apache.zookeeper;
 
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
 import org.apache.jute.Record;
 import org.apache.zookeeper.common.PathUtils;
 import org.apache.zookeeper.data.ACL;
@@ -30,10 +33,6 @@ import org.apache.zookeeper.proto.GetDataRequest;
 import org.apache.zookeeper.proto.SetDataRequest;
 import org.apache.zookeeper.server.EphemeralType;
 
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-
 /**
  * Represents a single operation in a multi-operation transaction.  Each operation can be a create, update,
  * delete, a version check or just read operations like getChildren or getData.
@@ -50,7 +49,11 @@ import java.util.List;
  */
 public abstract class Op {
 
-    public enum OpKind { TRANSACTION, READ }
+    public enum OpKind {
+        TRANSACTION,
+        READ
+    }
+
     private int type;
     private String path;
     private OpKind opKind;
@@ -177,7 +180,6 @@ public abstract class Op {
         return new SetData(path, data, version);
     }
 
-
     /**
      * Constructs an version check operation.  Arguments are as for the ZooKeeper.setData method except that
      * no data is provided since no update is intended.  The purpose for this is to allow read-modify-write
@@ -205,7 +207,7 @@ public abstract class Op {
     /**
      * Gets the integer type code for an Op.  This code should be as from ZooDefs.OpCode
      * @see ZooDefs.OpCode
-     * @return  The type code.
+     * @return The type code.
      */
     public int getType() {
         return type;
@@ -213,7 +215,7 @@ public abstract class Op {
 
     /**
      * Gets the path for an Op.
-     * @return  The path.
+     * @return The path.
      */
     public String getPath() {
         return path;
@@ -221,7 +223,7 @@ public abstract class Op {
 
     /**
      * Gets the kind of an Op.
-     * @return  The OpKind value.
+     * @return The OpKind value.
      */
     public OpKind getKind() {
         return opKind;
@@ -231,8 +233,8 @@ public abstract class Op {
      * Encodes an op for wire transmission.
      * @return An appropriate Record structure.
      */
-    public abstract Record toRequestRecord() ;
-    
+    public abstract Record toRequestRecord();
+
     /**
      * Reconstructs the transaction with the chroot prefix.
      * @return transaction with chroot.
@@ -241,7 +243,7 @@ public abstract class Op {
 
     /**
      * Performs client path validations.
-     * 
+     *
      * @throws IllegalArgumentException
      *             if an invalid path is specified
      * @throws KeeperException.BadArgumentsException
@@ -255,6 +257,7 @@ public abstract class Op {
     // these internal classes are public, but should not generally be referenced.
     //
     public static class Create extends Op {
+
         protected byte[] data;
         protected List<ACL> acl;
         protected int flags;
@@ -282,8 +285,12 @@ public abstract class Op {
 
         @Override
         public boolean equals(Object o) {
-            if (this == o) return true;
-            if (!(o instanceof Create)) return false;
+            if (this == o) {
+                return true;
+            }
+            if (!(o instanceof Create)) {
+                return false;
+            }
 
             Create op = (Create) o;
 
@@ -301,7 +308,11 @@ public abstract class Op {
                     break;
                 }
             }
-            return !i.hasNext() && getType() == op.getType() && Arrays.equals(data, op.data) && flags == op.flags && aclEquals;
+            return !i.hasNext()
+                   && getType() == op.getType()
+                   && Arrays.equals(data, op.data)
+                   && flags == op.flags
+                   && aclEquals;
         }
 
         @Override
@@ -325,9 +336,11 @@ public abstract class Op {
             PathUtils.validatePath(getPath(), createMode.isSequential());
             EphemeralType.validateTTL(createMode, -1);
         }
+
     }
 
     public static class CreateTTL extends Create {
+
         private final long ttl;
 
         private CreateTTL(String path, byte[] data, List<ACL> acl, int flags, long ttl) {
@@ -342,12 +355,12 @@ public abstract class Op {
 
         @Override
         public boolean equals(Object o) {
-            return super.equals(o) && (o instanceof CreateTTL) && (ttl == ((CreateTTL)o).ttl);
+            return super.equals(o) && (o instanceof CreateTTL) && (ttl == ((CreateTTL) o).ttl);
         }
 
         @Override
         public int hashCode() {
-            return super.hashCode() + (int)(ttl ^ (ttl >>> 32));
+            return super.hashCode() + (int) (ttl ^ (ttl >>> 32));
         }
 
         @Override
@@ -366,9 +379,11 @@ public abstract class Op {
             PathUtils.validatePath(getPath(), createMode.isSequential());
             EphemeralType.validateTTL(createMode, ttl);
         }
+
     }
 
     public static class Delete extends Op {
+
         private int version;
 
         private Delete(String path, int version) {
@@ -378,13 +393,16 @@ public abstract class Op {
 
         @Override
         public boolean equals(Object o) {
-            if (this == o) return true;
-            if (!(o instanceof Delete)) return false;
+            if (this == o) {
+                return true;
+            }
+            if (!(o instanceof Delete)) {
+                return false;
+            }
 
             Delete op = (Delete) o;
 
-            return getType() == op.getType() && version == op.version 
-                   && getPath().equals(op.getPath());
+            return getType() == op.getType() && version == op.version && getPath().equals(op.getPath());
         }
 
         @Override
@@ -401,9 +419,11 @@ public abstract class Op {
         Op withChroot(String path) {
             return new Delete(path, version);
         }
+
     }
 
     public static class SetData extends Op {
+
         private byte[] data;
         private int version;
 
@@ -415,13 +435,19 @@ public abstract class Op {
 
         @Override
         public boolean equals(Object o) {
-            if (this == o) return true;
-            if (!(o instanceof SetData)) return false;
+            if (this == o) {
+                return true;
+            }
+            if (!(o instanceof SetData)) {
+                return false;
+            }
 
             SetData op = (SetData) o;
 
-            return getType() == op.getType() && version == op.version 
-                   && getPath().equals(op.getPath()) && Arrays.equals(data, op.data);
+            return getType() == op.getType()
+                   && version == op.version
+                   && getPath().equals(op.getPath())
+                   && Arrays.equals(data, op.data);
         }
 
         @Override
@@ -438,9 +464,11 @@ public abstract class Op {
         Op withChroot(String path) {
             return new SetData(path, data, version);
         }
+
     }
 
     public static class Check extends Op {
+
         private int version;
 
         private Check(String path, int version) {
@@ -450,8 +478,12 @@ public abstract class Op {
 
         @Override
         public boolean equals(Object o) {
-            if (this == o) return true;
-            if (!(o instanceof Check)) return false;
+            if (this == o) {
+                return true;
+            }
+            if (!(o instanceof Check)) {
+                return false;
+            }
 
             Check op = (Check) o;
 
@@ -472,17 +504,23 @@ public abstract class Op {
         Op withChroot(String path) {
             return new Check(path, version);
         }
+
     }
 
     public static class GetChildren extends Op {
+
         GetChildren(String path) {
             super(ZooDefs.OpCode.getChildren, path, OpKind.READ);
         }
 
         @Override
         public boolean equals(Object o) {
-            if (this == o) return true;
-            if (!(o instanceof GetChildren)) return false;
+            if (this == o) {
+                return true;
+            }
+            if (!(o instanceof GetChildren)) {
+                return false;
+            }
 
             GetChildren op = (GetChildren) o;
 
@@ -503,17 +541,23 @@ public abstract class Op {
         Op withChroot(String path) {
             return new GetChildren(path);
         }
+
     }
 
     public static class GetData extends Op {
+
         GetData(String path) {
             super(ZooDefs.OpCode.getData, path, OpKind.READ);
         }
 
         @Override
         public boolean equals(Object o) {
-            if (this == o) return true;
-            if (!(o instanceof GetData)) return false;
+            if (this == o) {
+                return true;
+            }
+            if (!(o instanceof GetData)) {
+                return false;
+            }
 
             GetData op = (GetData) o;
 
@@ -534,5 +578,7 @@ public abstract class Op {
         Op withChroot(String path) {
             return new GetData(path);
         }
+
     }
+
 }
diff --git a/zookeeper-server/src/main/java/org/apache/zookeeper/OpResult.java b/zookeeper-server/src/main/java/org/apache/zookeeper/OpResult.java
index 320a8bd..08bbf94 100644
--- a/zookeeper-server/src/main/java/org/apache/zookeeper/OpResult.java
+++ b/zookeeper-server/src/main/java/org/apache/zookeeper/OpResult.java
@@ -17,16 +17,15 @@
 
 package org.apache.zookeeper;
 
-
-import org.apache.zookeeper.data.Stat;
-
 import java.util.Arrays;
 import java.util.List;
+import org.apache.zookeeper.data.Stat;
 
 /**
  * Encodes the result of a single part of a multiple operation commit.
  */
 public abstract class OpResult {
+
     private int type;
 
     private OpResult(int type) {
@@ -50,11 +49,12 @@ public abstract class OpResult {
      * create.
      */
     public static class CreateResult extends OpResult {
+
         private String path;
         private Stat stat;
 
         public CreateResult(String path) {
-        	this(ZooDefs.OpCode.create, path, null);
+            this(ZooDefs.OpCode.create, path, null);
         }
 
         public CreateResult(String path, Stat stat) {
@@ -62,7 +62,7 @@ public abstract class OpResult {
         }
 
         private CreateResult(int opcode, String path, Stat stat) {
-        	super(opcode);
+            super(opcode);
             this.path = path;
             this.stat = stat;
         }
@@ -77,37 +77,47 @@ public abstract class OpResult {
 
         @Override
         public boolean equals(Object o) {
-            if (this == o) return true;
-            if (!(o instanceof CreateResult)) return false;
+            if (this == o) {
+                return true;
+            }
+            if (!(o instanceof CreateResult)) {
+                return false;
+            }
 
             CreateResult other = (CreateResult) o;
 
-            boolean statsAreEqual = (stat == null && other.stat == null ||
-                        						(stat != null && other.stat != null &&
-                        					   stat.getMzxid() == other.stat.getMzxid()));
-            return getType() == other.getType() &&
-                   path.equals(other.getPath()) && statsAreEqual;
+            boolean statsAreEqual = stat == null
+                                    && other.stat == null
+                                    || (stat != null
+                                        && other.stat != null
+                                        && stat.getMzxid() == other.stat.getMzxid());
+            return getType() == other.getType() && path.equals(other.getPath()) && statsAreEqual;
         }
 
         @Override
         public int hashCode() {
-            return (int) (getType() * 35 + path.hashCode() +
-                    (stat == null ? 0 : stat.getMzxid()));
+            return (int) (getType() * 35 + path.hashCode() + (stat == null ? 0 : stat.getMzxid()));
         }
+
     }
 
     /**
      * A result from a delete operation.  No special values are available.
      */
     public static class DeleteResult extends OpResult {
+
         public DeleteResult() {
             super(ZooDefs.OpCode.delete);
         }
 
         @Override
         public boolean equals(Object o) {
-            if (this == o) return true;
-            if (!(o instanceof DeleteResult)) return false;
+            if (this == o) {
+                return true;
+            }
+            if (!(o instanceof DeleteResult)) {
+                return false;
+            }
 
             DeleteResult opResult = (DeleteResult) o;
             return getType() == opResult.getType();
@@ -117,6 +127,7 @@ public abstract class OpResult {
         public int hashCode() {
             return getType();
         }
+
     }
 
     /**
@@ -124,6 +135,7 @@ public abstract class OpResult {
      * to the Stat structure from the update.
      */
     public static class SetDataResult extends OpResult {
+
         private Stat stat;
 
         public SetDataResult(Stat stat) {
@@ -137,8 +149,12 @@ public abstract class OpResult {
 
         @Override
         public boolean equals(Object o) {
-            if (this == o) return true;
-            if (!(o instanceof SetDataResult)) return false;
+            if (this == o) {
+                return true;
+            }
+            if (!(o instanceof SetDataResult)) {
+                return false;
+            }
 
             SetDataResult other = (SetDataResult) o;
             return getType() == other.getType() && stat.getMzxid() == other.stat.getMzxid();
@@ -148,20 +164,26 @@ public abstract class OpResult {
         public int hashCode() {
             return (int) (getType() * 35 + stat.getMzxid());
         }
+
     }
 
     /**
      * A result from a version check operation.  No special values are available.
      */
     public static class CheckResult extends OpResult {
+
         public CheckResult() {
             super(ZooDefs.OpCode.check);
         }
 
         @Override
         public boolean equals(Object o) {
-            if (this == o) return true;
-            if (!(o instanceof CheckResult)) return false;
+            if (this == o) {
+                return true;
+            }
+            if (!(o instanceof CheckResult)) {
+                return false;
+            }
 
             CheckResult other = (CheckResult) o;
             return getType() == other.getType();
@@ -171,6 +193,7 @@ public abstract class OpResult {
         public int hashCode() {
             return getType();
         }
+
     }
 
     /**
@@ -178,6 +201,7 @@ public abstract class OpResult {
      * the names of the children of a given node.
      */
     public static class GetChildrenResult extends OpResult {
+
         private List<String> children;
 
         public GetChildrenResult(List<String> children) {
@@ -191,8 +215,12 @@ public abstract class OpResult {
 
         @Override
         public boolean equals(Object o) {
-            if (this == o) return true;
-            if (!(o instanceof GetChildrenResult)) return false;
+            if (this == o) {
+                return true;
+            }
+            if (!(o instanceof GetChildrenResult)) {
+                return false;
+            }
 
             GetChildrenResult other = (GetChildrenResult) o;
             return getType() == other.getType() && children.equals(other.children);
@@ -202,6 +230,7 @@ public abstract class OpResult {
         public int hashCode() {
             return getType() * 35 + children.hashCode();
         }
+
     }
 
     /**
@@ -227,19 +256,22 @@ public abstract class OpResult {
 
         @Override
         public boolean equals(Object o) {
-            if (this == o) return true;
-            if (!(o instanceof GetDataResult)) return false;
+            if (this == o) {
+                return true;
+            }
+            if (!(o instanceof GetDataResult)) {
+                return false;
+            }
 
             GetDataResult other = (GetDataResult) o;
-            return getType() == other.getType()
-                    && stat.equals(other.stat)
-                    && Arrays.equals(data, other.data);
+            return getType() == other.getType() && stat.equals(other.stat) && Arrays.equals(data, other.data);
         }
 
         @Override
         public int hashCode() {
             return (int) (getType() * 35 + stat.getMzxid() + Arrays.hashCode(data));
         }
+
     }
 
     /**
@@ -249,6 +281,7 @@ public abstract class OpResult {
      *
      */
     public static class ErrorResult extends OpResult {
+
         private int err;
 
         public ErrorResult(int err) {
@@ -262,8 +295,12 @@ public abstract class OpResult {
 
         @Override
         public boolean equals(Object o) {
-            if (this == o) return true;
-            if (!(o instanceof ErrorResult)) return false;
+            if (this == o) {
+                return true;
+            }
+            if (!(o instanceof ErrorResult)) {
+                return false;
+            }
 
             ErrorResult other = (ErrorResult) o;
             return getType() == other.getType() && err == other.getErr();
@@ -273,5 +310,7 @@ public abstract class OpResult {
         public int hashCode() {
             return getType() * 35 + err;
         }
+
     }
+
 }
diff --git a/zookeeper-server/src/main/java/org/apache/zookeeper/Quotas.java b/zookeeper-server/src/main/java/org/apache/zookeeper/Quotas.java
index b82e339..031ff36 100644
--- a/zookeeper-server/src/main/java/org/apache/zookeeper/Quotas.java
+++ b/zookeeper-server/src/main/java/org/apache/zookeeper/Quotas.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -51,8 +51,7 @@ public class Quotas {
      * @return the limit quota path
      */
     public static String quotaPath(String path) {
-        return quotaZookeeper + path +
-        "/" + limitNode;
+        return quotaZookeeper + path + "/" + limitNode;
     }
 
     /**
@@ -62,7 +61,7 @@ public class Quotas {
      * @return the stat quota path
      */
     public static String statPath(String path) {
-        return quotaZookeeper + path + "/" +
-        statNode;
+        return quotaZookeeper + path + "/" + statNode;
     }
+
 }
diff --git a/zookeeper-server/src/main/java/org/apache/zookeeper/SaslClientCallbackHandler.java b/zookeeper-server/src/main/java/org/apache/zookeeper/SaslClientCallbackHandler.java
index d6f5549..a204b06 100644
--- a/zookeeper-server/src/main/java/org/apache/zookeeper/SaslClientCallbackHandler.java
+++ b/zookeeper-server/src/main/java/org/apache/zookeeper/SaslClientCallbackHandler.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -15,6 +15,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.apache.zookeeper;
 
 import javax.security.auth.callback.Callback;
@@ -24,7 +25,6 @@ import javax.security.auth.callback.PasswordCallback;
 import javax.security.auth.callback.UnsupportedCallbackException;
 import javax.security.sasl.AuthorizeCallback;
 import javax.security.sasl.RealmCallback;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -37,6 +37,7 @@ import org.slf4j.LoggerFactory;
  * org.apache.zookeeper.server.auth.SaslServerCallbackHandler.
  */
 public class SaslClientCallbackHandler implements CallbackHandler {
+
     private String password = null;
     private static final Logger LOG = LoggerFactory.getLogger(SaslClientCallbackHandler.class);
     private final String entity;
@@ -50,36 +51,32 @@ public class SaslClientCallbackHandler implements CallbackHandler {
             if (callback instanceof NameCallback) {
                 NameCallback nc = (NameCallback) callback;
                 nc.setName(nc.getDefaultName());
-            }
-            else {
+            } else {
                 if (callback instanceof PasswordCallback) {
-                    PasswordCallback pc = (PasswordCallback)callback;
+                    PasswordCallback pc = (PasswordCallback) callback;
                     if (password != null) {
                         pc.setPassword(this.password.toCharArray());
                     } else {
-                        LOG.warn("Could not login: the {} is being asked for a password, but the ZooKeeper {}" +
-                          " code does not currently support obtaining a password from the user." +
-                          " Make sure that the {} is configured to use a ticket cache (using" +
-                          " the JAAS configuration setting 'useTicketCache=true)' and restart the {}. If" +
-                          " you still get this message after that, the TGT in the ticket cache has expired and must" +
-                          " be manually refreshed. To do so, first determine if you are using a password or a" +
-                          " keytab. If the former, run kinit in a Unix shell in the environment of the user who" +
-                          " is running this Zookeeper {} using the command" +
-                          " 'kinit <princ>' (where <princ> is the name of the {}'s Kerberos principal)." +
-                          " If the latter, do" +
-                          " 'kinit -k -t <keytab> <princ>' (where <princ> is the name of the Kerberos principal, and" +
-                          " <keytab> is the location of the keytab file). After manually refreshing your cache," +
-                          " restart this {}. If you continue to see this message after manually refreshing" +
-                          " your cache, ensure that your KDC host's clock is in sync with this host's clock.",
-                          new Object[]{entity, entity, entity, entity, entity, entity, entity});
+                        LOG.warn("Could not login: the {} is being asked for a password, but the ZooKeeper {}"
+                                 + " code does not currently support obtaining a password from the user."
+                                 + " Make sure that the {} is configured to use a ticket cache (using"
+                                 + " the JAAS configuration setting 'useTicketCache=true)' and restart the {}. If"
+                                 + " you still get this message after that, the TGT in the ticket cache has expired and must"
+                                 + " be manually refreshed. To do so, first determine if you are using a password or a"
+                                 + " keytab. If the former, run kinit in a Unix shell in the environment of the user who"
+                                 + " is running this Zookeeper {} using the command"
+                                 + " 'kinit <princ>' (where <princ> is the name of the {}'s Kerberos principal)."
+                                 + " If the latter, do"
+                                 + " 'kinit -k -t <keytab> <princ>' (where <princ> is the name of the Kerberos principal, and"
+                                 + " <keytab> is the location of the keytab file). After manually refreshing your cache,"
+                                 + " restart this {}. If you continue to see this message after manually refreshing"
+                                 + " your cache, ensure that your KDC host's clock is in sync with this host's clock.", entity, entity, entity, entity, entity, entity, entity);
                     }
-                }
-                else {
+                } else {
                     if (callback instanceof RealmCallback) {
                         RealmCallback rc = (RealmCallback) callback;
                         rc.setText(rc.getDefaultText());
-                    }
-                    else {
+                    } else {
                         if (callback instanceof AuthorizeCallback) {
                             AuthorizeCallback ac = (AuthorizeCallback) callback;
                             String authid = ac.getAuthenticationID();
@@ -92,13 +89,15 @@ public class SaslClientCallbackHandler implements CallbackHandler {
                             if (ac.isAuthorized()) {
                                 ac.setAuthorizedID(authzid);
                             }
-                        }
-                        else {
-                            throw new UnsupportedCallbackException(callback, "Unrecognized SASL " + entity + "Callback");
+                        } else {
+                            throw new UnsupportedCallbackException(
+                                callback,
+                                "Unrecognized SASL " + entity + "Callback");
                         }
                     }
                 }
             }
         }
     }
-}
\ No newline at end of file
+
+}
diff --git a/zookeeper-server/src/main/java/org/apache/zookeeper/SaslServerPrincipal.java b/zookeeper-server/src/main/java/org/apache/zookeeper/SaslServerPrincipal.java
index 403bf07..b2e8ac1 100644
--- a/zookeeper-server/src/main/java/org/apache/zookeeper/SaslServerPrincipal.java
+++ b/zookeeper-server/src/main/java/org/apache/zookeeper/SaslServerPrincipal.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -15,6 +15,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.apache.zookeeper;
 
 import java.net.InetAddress;
@@ -27,6 +28,7 @@ import org.slf4j.LoggerFactory;
  * Computes the Server Principal for a SASL client.
  */
 public class SaslServerPrincipal {
+
     private static final Logger LOG = LoggerFactory.getLogger(SaslServerPrincipal.class);
 
     /**
@@ -46,18 +48,22 @@ public class SaslServerPrincipal {
      * @return the name of the principal.
      */
     static String getServerPrincipal(WrapperInetSocketAddress addr, ZKClientConfig clientConfig) {
-        String principalUserName = clientConfig.getProperty(ZKClientConfig.ZK_SASL_CLIENT_USERNAME,
+        String principalUserName = clientConfig.getProperty(
+            ZKClientConfig.ZK_SASL_CLIENT_USERNAME,
             ZKClientConfig.ZK_SASL_CLIENT_USERNAME_DEFAULT);
         String hostName = addr.getHostName();
 
         boolean canonicalize = true;
-        String canonicalizeText = clientConfig.getProperty(ZKClientConfig.ZK_SASL_CLIENT_CANONICALIZE_HOSTNAME,
+        String canonicalizeText = clientConfig.getProperty(
+            ZKClientConfig.ZK_SASL_CLIENT_CANONICALIZE_HOSTNAME,
             ZKClientConfig.ZK_SASL_CLIENT_CANONICALIZE_HOSTNAME_DEFAULT);
         try {
             canonicalize = Boolean.parseBoolean(canonicalizeText);
         } catch (IllegalArgumentException ea) {
-            LOG.warn("Could not parse config {} \"{}\" into a boolean using default {}", ZKClientConfig
-                .ZK_SASL_CLIENT_CANONICALIZE_HOSTNAME, canonicalizeText, canonicalize);
+            LOG.warn("Could not parse config {} \"{}\" into a boolean using default {}",
+                     ZKClientConfig.ZK_SASL_CLIENT_CANONICALIZE_HOSTNAME,
+                     canonicalizeText,
+                     canonicalize);
         }
 
         if (canonicalize) {
@@ -82,6 +88,7 @@ public class SaslServerPrincipal {
      * InetSocketAddress are marked as final.
      */
     static class WrapperInetSocketAddress {
+
         private final InetSocketAddress addr;
 
         WrapperInetSocketAddress(InetSocketAddress addr) {
@@ -101,6 +108,7 @@ public class SaslServerPrincipal {
         public String toString() {
             return addr.toString();
         }
+
     }
 
     /**
@@ -108,6 +116,7 @@ public class SaslServerPrincipal {
      * InetAddress are marked as final.
      */
     static class WrapperInetAddress {
+
         private final InetAddress ia;
 
         WrapperInetAddress(InetAddress ia) {
@@ -126,5 +135,7 @@ public class SaslServerPrincipal {
         public String toString() {
             return ia.toString();
         }
+
     }
+
 }
diff --git a/zookeeper-server/src/main/java/org/apache/zookeeper/ServerAdminClient.java b/zookeeper-server/src/main/java/org/apache/zookeeper/ServerAdminClient.java
index 5efa53e..ab7b08a 100644
--- a/zookeeper-server/src/main/java/org/apache/zookeeper/ServerAdminClient.java
+++ b/zookeeper-server/src/main/java/org/apache/zookeeper/ServerAdminClient.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -24,13 +24,13 @@ import java.io.OutputStream;
 import java.net.InetSocketAddress;
 import java.net.Socket;
 import java.nio.ByteBuffer;
-
 import org.apache.yetus.audience.InterfaceAudience;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 @InterfaceAudience.Public
 public class ServerAdminClient {
+
     private static final Logger LOG = LoggerFactory.getLogger(ServerAdminClient.class);
 
     public static void ruok(String host, int port) {
@@ -192,9 +192,9 @@ public class ServerAdminClient {
             int rc = is.read(resBytes);
             ByteBuffer res = ByteBuffer.wrap(resBytes);
             long retv = res.getLong();
-            System.out.println("rc=" + rc + " retv=0"
-                    + Long.toOctalString(retv) + " masks=0"
-                    + Long.toOctalString(traceMask));
+            System.out.println("rc=" + rc
+                               + " retv=0" + Long.toOctalString(retv)
+                               + " masks=0" + Long.toOctalString(traceMask));
             assert (retv == traceMask);
         } catch (IOException e) {
             LOG.warn("Unexpected exception", e);
@@ -231,8 +231,7 @@ public class ServerAdminClient {
             int rc = is.read(resBytes);
             ByteBuffer res = ByteBuffer.wrap(resBytes);
             long retv = res.getLong();
-            System.out.println("rc=" + rc + " retv=0"
-                    + Long.toOctalString(retv));
+            System.out.println("rc=" + rc + " retv=0" + Long.toOctalString(retv));
         } catch (IOException e) {
             LOG.warn("Unexpected exception", e);
         } finally {
@@ -247,9 +246,8 @@ public class ServerAdminClient {
     }
 
     private static void usage() {
-        System.out
-                .println("usage: java [-cp CLASSPATH] org.apache.zookeeper.ServerAdminClient "
-                        + "host port op (ruok|stat|dump|kill|gettracemask|settracemask) [arguments]");
+        System.out.println("usage: java [-cp CLASSPATH] org.apache.zookeeper.ServerAdminClient "
+                           + "host port op (ruok|stat|dump|kill|gettracemask|settracemask) [arguments]");
 
     }
 
@@ -277,4 +275,5 @@ public class ServerAdminClient {
             System.out.println("Unrecognized op: " + op);
         }
     }
+
 }
diff --git a/zookeeper-server/src/main/java/org/apache/zookeeper/Shell.java b/zookeeper-server/src/main/java/org/apache/zookeeper/Shell.java
index ee6ea12..d59079f 100644
--- a/zookeeper-server/src/main/java/org/apache/zookeeper/Shell.java
+++ b/zookeeper-server/src/main/java/org/apache/zookeeper/Shell.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -17,16 +17,15 @@
  */
 
 /* This file copied from Hadoop's security branch,
-  * with the following changes:
-  * 1. package changed from org.apache.hadoop.util to
-  *    org.apache.zookeeper.
-  * 2. Usage of Hadoop's Configuration class removed since
-  *    it is not available in Zookeeper: instead, system properties
-  *    are used.
-  * 3. The deprecated getUlimitMemoryCommand() method removed since
-  *    it is not needed.
-  */
-
+ * with the following changes:
+ * 1. package changed from org.apache.hadoop.util to
+ *    org.apache.zookeeper.
+ * 2. Usage of Hadoop's Configuration class removed since
+ *    it is not available in Zookeeper: instead, system properties
+ *    are used.
+ * 3. The deprecated getUlimitMemoryCommand() method removed since
+ *    it is not needed.
+ */
 
 package org.apache.zookeeper;
 
@@ -38,7 +37,6 @@ import java.util.Map;
 import java.util.Timer;
 import java.util.TimerTask;
 import java.util.concurrent.atomic.AtomicBoolean;
-
 import org.apache.zookeeper.common.Time;
 import org.apache.zookeeper.server.ExitCode;
 import org.slf4j.Logger;
@@ -48,433 +46,426 @@ import org.slf4j.LoggerFactory;
  * A base class for running a Unix command.
  *
  * <code>Shell</code> can be used to run unix commands like <code>du</code> or
- * <code>df</code>. It also offers facilities to gate commands by 
+ * <code>df</code>. It also offers facilities to gate commands by
  * time-intervals.
  */
-abstract public class Shell {
-  
+public abstract class Shell {
+
     private static final Logger LOG = LoggerFactory.getLogger(Shell.class);
-  
-  /** a Unix command to get the current user's name */
-  public final static String USER_NAME_COMMAND = "whoami";
-  /** a Unix command to get the current user's groups list */
-  public static String[] getGroupsCommand() {
-    return new String[]{"bash", "-c", "groups"};
-  }
-  /** a Unix command to get a given user's groups list */
-  public static String[] getGroupsForUserCommand(final String user) {
-    //'groups username' command return is non-consistent across different unixes
-    return new String [] {"bash", "-c", "id -Gn " + user};
-  }
-  /** a Unix command to set permission */
-  public static final String SET_PERMISSION_COMMAND = "chmod";
-  /** a Unix command to set owner */
-  public static final String SET_OWNER_COMMAND = "chown";
-  public static final String SET_GROUP_COMMAND = "chgrp";
-  /** Return a Unix command to get permission information. */
-  public static String[] getGET_PERMISSION_COMMAND() {
-    //force /bin/ls, except on windows.
-    return new String[] {(WINDOWS ? "ls" : "/bin/ls"), "-ld"};
-  }
-
-  /**Time after which the executing script would be timedout*/
-  protected long timeOutInterval = 0L;
-  /** If or not script timed out*/
-  private AtomicBoolean timedOut;
-
-  /** a Unix command to get ulimit of a process. */
-  public static final String ULIMIT_COMMAND = "ulimit";
-  
-  /** 
-   * Get the Unix command for setting the maximum virtual memory available
-   * to a given child process. This is only relevant when we are forking a
-   * process from within the Mapper or the Reducer implementations.
-   * Also see Hadoop Pipes and Hadoop Streaming.
-   * 
-   * It also checks to ensure that we are running on a *nix platform else 
-   * (e.g. in Cygwin/Windows) it returns <code>null</code>.
-   * @param memoryLimit virtual memory limit
-   * @return a <code>String[]</code> with the ulimit command arguments or 
-   *         <code>null</code> if we are running on a non *nix platform or
-   *         if the limit is unspecified.
-   */
-  public static String[] getUlimitMemoryCommand(int memoryLimit) {
-    // ulimit isn't supported on Windows
-    if (WINDOWS) {
-      return null;
+
+    /** a Unix command to get the current user's name */
+    public static final String USER_NAME_COMMAND = "whoami";
+    /** a Unix command to get the current user's groups list */
+    public static String[] getGroupsCommand() {
+        return new String[]{"bash", "-c", "groups"};
+    }
+    /** a Unix command to get a given user's groups list */
+    public static String[] getGroupsForUserCommand(final String user) {
+        //'groups username' command return is non-consistent across different unixes
+        return new String[]{"bash", "-c", "id -Gn " + user};
+    }
+    /** a Unix command to set permission */
+    public static final String SET_PERMISSION_COMMAND = "chmod";
+    /** a Unix command to set owner */
+    public static final String SET_OWNER_COMMAND = "chown";
+    public static final String SET_GROUP_COMMAND = "chgrp";
+    /** Return a Unix command to get permission information. */
+    public static String[] getGET_PERMISSION_COMMAND() {
+        //force /bin/ls, except on windows.
+        return new String[]{(WINDOWS ? "ls" : "/bin/ls"), "-ld"};
+    }
+
+    /**Time after which the executing script would be timedout*/
+    protected long timeOutInterval = 0L;
+    /** If or not script timed out*/
+    private AtomicBoolean timedOut;
+
+    /** a Unix command to get ulimit of a process. */
+    public static final String ULIMIT_COMMAND = "ulimit";
+
+    /**
+     * Get the Unix command for setting the maximum virtual memory available
+     * to a given child process. This is only relevant when we are forking a
+     * process from within the Mapper or the Reducer implementations.
+     * Also see Hadoop Pipes and Hadoop Streaming.
+     *
+     * It also checks to ensure that we are running on a *nix platform else
+     * (e.g. in Cygwin/Windows) it returns <code>null</code>.
+     * @param memoryLimit virtual memory limit
+     * @return a <code>String[]</code> with the ulimit command arguments or
+     *         <code>null</code> if we are running on a non *nix platform or
+     *         if the limit is unspecified.
+     */
+    public static String[] getUlimitMemoryCommand(int memoryLimit) {
+        // ulimit isn't supported on Windows
+        if (WINDOWS) {
+            return null;
+        }
+
+        return new String[]{ULIMIT_COMMAND, "-v", String.valueOf(memoryLimit)};
+    }
+
+    /** Set to true on Windows platforms */
+    public static final boolean WINDOWS /* borrowed from Path.WINDOWS */ = System.getProperty("os.name").startsWith("Windows");
+
+    private long interval;   // refresh interval in msec
+    private long lastTime;   // last time the command was performed
+    private Map<String, String> environment; // env for the command execution
+    private File dir;
+    private Process process; // sub process used to execute the command
+    private int exitCode;
+
+    /**If or not script finished executing*/
+    private volatile AtomicBoolean completed;
+
+    public Shell() {
+        this(0L);
+    }
+
+    /**
+     * @param interval the minimum duration to wait before re-executing the
+     *        command.
+     */
+    public Shell(long interval) {
+        this.interval = interval;
+        this.lastTime = (interval < 0) ? 0 : -interval;
     }
-    
-    return new String[] {ULIMIT_COMMAND, "-v", String.valueOf(memoryLimit)};
-  }
-
-  /** Set to true on Windows platforms */
-  public static final boolean WINDOWS /* borrowed from Path.WINDOWS */
-                = System.getProperty("os.name").startsWith("Windows");
-  
-  private long    interval;   // refresh interval in msec
-  private long    lastTime;   // last time the command was performed
-  private Map<String, String> environment; // env for the command execution
-  private File dir;
-  private Process process; // sub process used to execute the command
-  private int exitCode;
-
-  /**If or not script finished executing*/
-  private volatile AtomicBoolean completed;
-  
-  public Shell() {
-    this(0L);
-  }
-  
-  /**
-   * @param interval the minimum duration to wait before re-executing the 
-   *        command.
-   */
-  public Shell( long interval ) {
-    this.interval = interval;
-    this.lastTime = (interval<0) ? 0 : -interval;
-  }
-  
-  /** set the environment for the command 
-   * @param env Mapping of environment variables
-   */
-  protected void setEnvironment(Map<String, String> env) {
-    this.environment = env;
-  }
-
-  /** set the working directory 
-   * @param dir The directory where the command would be executed
-   */
-  protected void setWorkingDirectory(File dir) {
-    this.dir = dir;
-  }
-
-  /** check to see if a command needs to be executed and execute if needed */
-  protected void run() throws IOException {
-    if (lastTime + interval > Time.currentElapsedTime())
-      return;
-    exitCode = ExitCode.EXECUTION_FINISHED.getValue(); // reset for next run
-    runCommand();
-  }
-
-  /** Run a command */
-  private void runCommand() throws IOException { 
-    ProcessBuilder builder = new ProcessBuilder(getExecString());
-    Timer timeOutTimer = null;
-    ShellTimeoutTimerTask timeoutTimerTask = null;
-    timedOut = new AtomicBoolean(false);
-    completed = new AtomicBoolean(false);
-    
-    if (environment != null) {
-      builder.environment().putAll(this.environment);
+
+    /** set the environment for the command
+     * @param env Mapping of environment variables
+     */
+    protected void setEnvironment(Map<String, String> env) {
+        this.environment = env;
     }
-    if (dir != null) {
-      builder.directory(this.dir);
+
+    /** set the working directory
+     * @param dir The directory where the command would be executed
+     */
+    protected void setWorkingDirectory(File dir) {
+        this.dir = dir;
     }
-    
-    process = builder.start();
-    if (timeOutInterval > 0) {
-      timeOutTimer = new Timer();
-      timeoutTimerTask = new ShellTimeoutTimerTask(
-          this);
-      //One time scheduling.
-      timeOutTimer.schedule(timeoutTimerTask, timeOutInterval);
+
+    /** check to see if a command needs to be executed and execute if needed */
+    protected void run() throws IOException {
+        if (lastTime + interval > Time.currentElapsedTime()) {
+            return;
+        }
+        exitCode = ExitCode.EXECUTION_FINISHED.getValue(); // reset for next run
+        runCommand();
     }
-    final BufferedReader errReader = 
-            new BufferedReader(new InputStreamReader(process
-                                                     .getErrorStream()));
-    BufferedReader inReader = 
-            new BufferedReader(new InputStreamReader(process
-                                                     .getInputStream()));
-    final StringBuffer errMsg = new StringBuffer();
-    
-    // read error and input streams as this would free up the buffers
-    // free the error stream buffer
-    Thread errThread = new Thread() {
-      @Override
-      public void run() {
+
+    /** Run a command */
+    private void runCommand() throws IOException {
+        ProcessBuilder builder = new ProcessBuilder(getExecString());
+        Timer timeOutTimer = null;
+        ShellTimeoutTimerTask timeoutTimerTask = null;
+        timedOut = new AtomicBoolean(false);
+        completed = new AtomicBoolean(false);
+
+        if (environment != null) {
+            builder.environment().putAll(this.environment);
+        }
+        if (dir != null) {
+            builder.directory(this.dir);
+        }
+
+        process = builder.start();
+        if (timeOutInterval > 0) {
+            timeOutTimer = new Timer();
+            timeoutTimerTask = new ShellTimeoutTimerTask(this);
+            //One time scheduling.
+            timeOutTimer.schedule(timeoutTimerTask, timeOutInterval);
+        }
+        final BufferedReader errReader = new BufferedReader(new InputStreamReader(process.getErrorStream()));
+        BufferedReader inReader = new BufferedReader(new InputStreamReader(process.getInputStream()));
+        final StringBuffer errMsg = new StringBuffer();
+
+        // read error and input streams as this would free up the buffers
+        // free the error stream buffer
+        Thread errThread = new Thread() {
+            @Override
+            public void run() {
+                try {
+                    String line = errReader.readLine();
+                    while ((line != null) && !isInterrupted()) {
+                        errMsg.append(line);
+                        errMsg.append(System.getProperty("line.separator"));
+                        line = errReader.readLine();
+                    }
+                } catch (IOException ioe) {
+                    LOG.warn("Error reading the error stream", ioe);
+                }
+            }
+        };
+        try {
+            errThread.start();
+        } catch (IllegalStateException ise) {
+        }
         try {
-          String line = errReader.readLine();
-          while((line != null) && !isInterrupted()) {
-            errMsg.append(line);
-            errMsg.append(System.getProperty("line.separator"));
-            line = errReader.readLine();
-          }
-        } catch(IOException ioe) {
-          LOG.warn("Error reading the error stream", ioe);
+            parseExecResult(inReader); // parse the output
+            // clear the input stream buffer
+            String line = inReader.readLine();
+            while (line != null) {
+                line = inReader.readLine();
+            }
+            // wait for the process to finish and check the exit code
+            exitCode = process.waitFor();
+            try {
+                // make sure that the error thread exits
+                errThread.join();
+            } catch (InterruptedException ie) {
+                LOG.warn("Interrupted while reading the error stream", ie);
+            }
+            completed.set(true);
+            //the timeout thread handling
+            //taken care in finally block
+            if (exitCode != ExitCode.EXECUTION_FINISHED.getValue()) {
+                throw new ExitCodeException(exitCode, errMsg.toString());
+            }
+        } catch (InterruptedException ie) {
+            throw new IOException(ie.toString());
+        } finally {
+            if ((timeOutTimer != null) && !timedOut.get()) {
+                timeOutTimer.cancel();
+            }
+            // close the input stream
+            try {
+                inReader.close();
+            } catch (IOException ioe) {
+                LOG.warn("Error while closing the input stream", ioe);
+            }
+            if (!completed.get()) {
+                errThread.interrupt();
+            }
+            try {
+                errReader.close();
+            } catch (IOException ioe) {
+                LOG.warn("Error while closing the error stream", ioe);
+            }
+            process.destroy();
+            lastTime = Time.currentElapsedTime();
         }
-      }
-    };
-    try {
-      errThread.start();
-    } catch (IllegalStateException ise) { }
-    try {
-      parseExecResult(inReader); // parse the output
-      // clear the input stream buffer
-      String line = inReader.readLine();
-      while(line != null) { 
-        line = inReader.readLine();
-      }
-      // wait for the process to finish and check the exit code
-      exitCode  = process.waitFor();
-      try {
-        // make sure that the error thread exits
-        errThread.join();
-      } catch (InterruptedException ie) {
-        LOG.warn("Interrupted while reading the error stream", ie);
-      }
-      completed.set(true);
-      //the timeout thread handling
-      //taken care in finally block
-      if (exitCode != ExitCode.EXECUTION_FINISHED.getValue()) {
-        throw new ExitCodeException(exitCode, errMsg.toString());
-      }
-    } catch (InterruptedException ie) {
-      throw new IOException(ie.toString());
-    } finally {
-      if ((timeOutTimer!=null) && !timedOut.get()) {
-        timeOutTimer.cancel();
-      }
-      // close the input stream
-      try {
-        inReader.close();
-      } catch (IOException ioe) {
-        LOG.warn("Error while closing the input stream", ioe);
-      }
-      if (!completed.get()) {
-        errThread.interrupt();
-      }
-      try {
-        errReader.close();
-      } catch (IOException ioe) {
-        LOG.warn("Error while closing the error stream", ioe);
-      }
-      process.destroy();
-      lastTime = Time.currentElapsedTime();
     }
-  }
-
-  /** return an array containing the command name and its parameters */ 
-  protected abstract String[] getExecString();
-  
-  /** Parse the execution result */
-  protected abstract void parseExecResult(BufferedReader lines)
-  throws IOException;
-
-  /** get the current sub-process executing the given command 
-   * @return process executing the command
-   */
-  public Process getProcess() {
-    return process;
-  }
-
-  /** get the exit code 
-   * @return the exit code of the process
-   */
-  public int getExitCode() {
-    return exitCode;
-  }
-
-  /**
-   * This is an IOException with exit code added.
-   */
-  @SuppressWarnings("serial")
-  public static class ExitCodeException extends IOException {
-    int exitCode;
-    
-    public ExitCodeException(int exitCode, String message) {
-      super(message);
-      this.exitCode = exitCode;
+
+    /** return an array containing the command name and its parameters */
+    protected abstract String[] getExecString();
+
+    /** Parse the execution result */
+    protected abstract void parseExecResult(BufferedReader lines) throws IOException;
+
+    /** get the current sub-process executing the given command
+     * @return process executing the command
+     */
+    public Process getProcess() {
+        return process;
     }
-    
+
+    /** get the exit code
+     * @return the exit code of the process
+     */
     public int getExitCode() {
-      return exitCode;
+        return exitCode;
     }
-  }
-  
-  /**
-   * A simple shell command executor.
-   * 
-   * <code>ShellCommandExecutor</code>should be used in cases where the output 
-   * of the command needs no explicit parsing and where the command, working 
-   * directory and the environment remains unchanged. The output of the command 
-   * is stored as-is and is expected to be small.
-   */
-  public static class ShellCommandExecutor extends Shell {
-    
-    private String[] command;
-    private StringBuffer output;
-    
-    
-    public ShellCommandExecutor(String[] execString) {
-      this(execString, null);
-    }
-    
-    public ShellCommandExecutor(String[] execString, File dir) {
-      this(execString, dir, null);
+
+    /**
+     * This is an IOException with exit code added.
+     */
+    @SuppressWarnings("serial")
+    public static class ExitCodeException extends IOException {
+
+        int exitCode;
+
+        public ExitCodeException(int exitCode, String message) {
+            super(message);
+            this.exitCode = exitCode;
+        }
+
+        public int getExitCode() {
+            return exitCode;
+        }
+
     }
-   
-    public ShellCommandExecutor(String[] execString, File dir, 
-                                 Map<String, String> env) {
-      this(execString, dir, env , 0L);
+
+    /**
+     * A simple shell command executor.
+     *
+     * <code>ShellCommandExecutor</code>should be used in cases where the output
+     * of the command needs no explicit parsing and where the command, working
+     * directory and the environment remains unchanged. The output of the command
+     * is stored as-is and is expected to be small.
+     */
+    public static class ShellCommandExecutor extends Shell {
+
+        private String[] command;
+        private StringBuffer output;
+
+        public ShellCommandExecutor(String[] execString) {
+            this(execString, null);
+        }
+
+        public ShellCommandExecutor(String[] execString, File dir) {
+            this(execString, dir, null);
+        }
+
+        public ShellCommandExecutor(String[] execString, File dir, Map<String, String> env) {
+            this(execString, dir, env, 0L);
+        }
+
+        /**
+         * Create a new instance of the ShellCommandExecutor to execute a command.
+         *
+         * @param execString The command to execute with arguments
+         * @param dir If not-null, specifies the directory which should be set
+         *            as the current working directory for the command.
+         *            If null, the current working directory is not modified.
+         * @param env If not-null, environment of the command will include the
+         *            key-value pairs specified in the map. If null, the current
+         *            environment is not modified.
+         * @param timeout Specifies the time in milliseconds, after which the
+         *                command will be killed and the status marked as timedout.
+         *                If 0, the command will not be timed out.
+         */
+        public ShellCommandExecutor(String[] execString, File dir, Map<String, String> env, long timeout) {
+            command = execString.clone();
+            if (dir != null) {
+                setWorkingDirectory(dir);
+            }
+            if (env != null) {
+                setEnvironment(env);
+            }
+            timeOutInterval = timeout;
+        }
+
+        /** Execute the shell command. */
+        public void execute() throws IOException {
+            this.run();
+        }
+
+        protected String[] getExecString() {
+            return command;
+        }
+
+        protected void parseExecResult(BufferedReader lines) throws IOException {
+            output = new StringBuffer();
+            char[] buf = new char[512];
+            int nRead;
+            while ((nRead = lines.read(buf, 0, buf.length)) > 0) {
+                output.append(buf, 0, nRead);
+            }
+        }
+
+        /** Get the output of the shell command.*/
+        public String getOutput() {
+            return (output == null) ? "" : output.toString();
+        }
+
+        /**
+         * Returns the commands of this instance.
+         * Arguments with spaces in are presented with quotes round; other
+         * arguments are presented raw
+         *
+         * @return a string representation of the object.
+         */
+        public String toString() {
+            StringBuilder builder = new StringBuilder();
+            String[] args = getExecString();
+            for (String s : args) {
+                if (s.indexOf(' ') >= 0) {
+                    builder.append('"').append(s).append('"');
+                } else {
+                    builder.append(s);
+                }
+                builder.append(' ');
+            }
+            return builder.toString();
+        }
+
     }
 
     /**
-     * Create a new instance of the ShellCommandExecutor to execute a command.
-     * 
-     * @param execString The command to execute with arguments
-     * @param dir If not-null, specifies the directory which should be set
-     *            as the current working directory for the command.
-     *            If null, the current working directory is not modified.
-     * @param env If not-null, environment of the command will include the
-     *            key-value pairs specified in the map. If null, the current
-     *            environment is not modified.
-     * @param timeout Specifies the time in milliseconds, after which the
-     *                command will be killed and the status marked as timedout.
-     *                If 0, the command will not be timed out. 
+     * To check if the passed script to shell command executor timed out or
+     * not.
+     *
+     * @return if the script timed out.
      */
-    public ShellCommandExecutor(String[] execString, File dir, 
-        Map<String, String> env, long timeout) {
-      command = execString.clone();
-      if (dir != null) {
-        setWorkingDirectory(dir);
-      }
-      if (env != null) {
-        setEnvironment(env);
-      }
-      timeOutInterval = timeout;
+    public boolean isTimedOut() {
+        return timedOut.get();
     }
-        
 
-    /** Execute the shell command. */
-    public void execute() throws IOException {
-      this.run();    
+    /**
+     * Set if the command has timed out.
+     *
+     */
+    private void setTimedOut() {
+        this.timedOut.set(true);
     }
 
-    protected String[] getExecString() {
-      return command;
+    /**
+     * Static method to execute a shell command.
+     * Covers most of the simple cases without requiring the user to implement
+     * the <code>Shell</code> interface.
+     * @param cmd shell command to execute.
+     * @return the output of the executed command.
+     */
+    public static String execCommand(String... cmd) throws IOException {
+        return execCommand(null, cmd, 0L);
     }
 
-    protected void parseExecResult(BufferedReader lines) throws IOException {
-      output = new StringBuffer();
-      char[] buf = new char[512];
-      int nRead;
-      while ( (nRead = lines.read(buf, 0, buf.length)) > 0 ) {
-        output.append(buf, 0, nRead);
-      }
+    /**
+     * Static method to execute a shell command.
+     * Covers most of the simple cases without requiring the user to implement
+     * the <code>Shell</code> interface.
+     * @param env the map of environment key=value
+     * @param cmd shell command to execute.
+     * @param timeout time in milliseconds after which script should be marked timeout
+     * @return the output of the executed command.o
+     */
+
+    public static String execCommand(Map<String, String> env, String[] cmd, long timeout) throws IOException {
+        ShellCommandExecutor exec = new ShellCommandExecutor(cmd, null, env, timeout);
+        exec.execute();
+        return exec.getOutput();
     }
-    
-    /** Get the output of the shell command.*/
-    public String getOutput() {
-      return (output == null) ? "" : output.toString();
+
+    /**
+     * Static method to execute a shell command.
+     * Covers most of the simple cases without requiring the user to implement
+     * the <code>Shell</code> interface.
+     * @param env the map of environment key=value
+     * @param cmd shell command to execute.
+     * @return the output of the executed command.
+     */
+    public static String execCommand(Map<String, String> env, String... cmd) throws IOException {
+        return execCommand(env, cmd, 0L);
     }
 
     /**
-     * Returns the commands of this instance.
-     * Arguments with spaces in are presented with quotes round; other
-     * arguments are presented raw
-     *
-     * @return a string representation of the object.
+     * Timer which is used to timeout scripts spawned off by shell.
      */
-    public String toString() {
-      StringBuilder builder = new StringBuilder();
-      String[] args = getExecString();
-      for (String s : args) {
-        if (s.indexOf(' ') >= 0) {
-          builder.append('"').append(s).append('"');
-        } else {
-          builder.append(s);
+    private static class ShellTimeoutTimerTask extends TimerTask {
+
+        private Shell shell;
+
+        public ShellTimeoutTimerTask(Shell shell) {
+            this.shell = shell;
         }
-        builder.append(' ');
-      }
-      return builder.toString();
-    }
-  }
-  
-  /**
-   * To check if the passed script to shell command executor timed out or
-   * not.
-   * 
-   * @return if the script timed out.
-   */
-  public boolean isTimedOut() {
-    return timedOut.get();
-  }
-  
-  /**
-   * Set if the command has timed out.
-   * 
-   */
-  private void setTimedOut() {
-    this.timedOut.set(true);
-  }
-  
-  /** 
-   * Static method to execute a shell command. 
-   * Covers most of the simple cases without requiring the user to implement  
-   * the <code>Shell</code> interface.
-   * @param cmd shell command to execute.
-   * @return the output of the executed command.
-   */
-  public static String execCommand(String ... cmd) throws IOException {
-    return execCommand(null, cmd, 0L);
-  }
-  
-  /** 
-   * Static method to execute a shell command. 
-   * Covers most of the simple cases without requiring the user to implement  
-   * the <code>Shell</code> interface.
-   * @param env the map of environment key=value
-   * @param cmd shell command to execute.
-   * @param timeout time in milliseconds after which script should be marked timeout
-   * @return the output of the executed command.o
-   */
-  
-  public static String execCommand(Map<String, String> env, String[] cmd,
-      long timeout) throws IOException {
-    ShellCommandExecutor exec = new ShellCommandExecutor(cmd, null, env, 
-                                                          timeout);
-    exec.execute();
-    return exec.getOutput();
-  }
-
-  /** 
-   * Static method to execute a shell command. 
-   * Covers most of the simple cases without requiring the user to implement  
-   * the <code>Shell</code> interface.
-   * @param env the map of environment key=value
-   * @param cmd shell command to execute.
-   * @return the output of the executed command.
-   */
-  public static String execCommand(Map<String,String> env, String ... cmd) 
-  throws IOException {
-    return execCommand(env, cmd, 0L);
-  }
-  
-  /**
-   * Timer which is used to timeout scripts spawned off by shell.
-   */
-  private static class ShellTimeoutTimerTask extends TimerTask {
-
-    private Shell shell;
-
-    public ShellTimeoutTimerTask(Shell shell) {
-      this.shell = shell;
-    }
 
-    @Override
-    public void run() {
-      Process p = shell.getProcess();
-      try {
-        p.exitValue();
-      } catch (Exception e) {
-        //Process has not terminated.
-        //So check if it has completed 
-        //if not just destroy it.
-        if (p != null && !shell.completed.get()) {
-          shell.setTimedOut();
-          p.destroy();
+        @Override
+        public void run() {
+            Process p = shell.getProcess();
+            try {
+                p.exitValue();
+            } catch (Exception e) {
+                //Process has not terminated.
+                //So check if it has completed
+                //if not just destroy it.
+                if (p != null && !shell.completed.get()) {
+                    shell.setTimedOut();
+                    p.destroy();
+                }
+            }
         }
-      }
+
     }
-  }
+
 }
diff --git a/zookeeper-server/src/main/java/org/apache/zookeeper/StatsTrack.java b/zookeeper-server/src/main/java/org/apache/zookeeper/StatsTrack.java
index 623c6d4..4bd88e3 100644
--- a/zookeeper-server/src/main/java/org/apache/zookeeper/StatsTrack.java
+++ b/zookeeper-server/src/main/java/org/apache/zookeeper/StatsTrack.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -22,6 +22,7 @@ package org.apache.zookeeper;
  * a class that represents the stats associated with quotas
  */
 public class StatsTrack {
+
     private int count;
     private long bytes;
     private String countStr = "count";
@@ -52,7 +53,6 @@ public class StatsTrack {
         bytes = Long.parseLong(split[1].split("=")[1]);
     }
 
-
     /**
      * get the count of nodes allowed as part of quota
      *
@@ -94,8 +94,8 @@ public class StatsTrack {
     @Override
     /*
      * returns the string that maps to this stat tracking.
-     */
-    public String toString() {
+     */ public String toString() {
         return countStr + "=" + count + "," + byteStr + "=" + bytes;
     }
+
 }
diff --git a/zookeeper-server/src/main/java/org/apache/zookeeper/Testable.java b/zookeeper-server/src/main/java/org/apache/zookeeper/Testable.java
index 023f525..780cbe8 100644
--- a/zookeeper-server/src/main/java/org/apache/zookeeper/Testable.java
+++ b/zookeeper-server/src/main/java/org/apache/zookeeper/Testable.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -22,6 +22,7 @@ package org.apache.zookeeper;
  * Abstraction that exposes various methods useful for testing ZooKeeper
  */
 public interface Testable {
+
     /**
      * Cause the ZooKeeper instance to behave as if the session expired
      */
@@ -33,4 +34,5 @@ public interface Testable {
      * @param event event to insert
      */
     void queueEvent(WatchedEvent event);
+
 }
diff --git a/zookeeper-server/src/main/java/org/apache/zookeeper/Transaction.java b/zookeeper-server/src/main/java/org/apache/zookeeper/Transaction.java
index d8f0e01..7a6ba73 100644
--- a/zookeeper-server/src/main/java/org/apache/zookeeper/Transaction.java
+++ b/zookeeper-server/src/main/java/org/apache/zookeeper/Transaction.java
@@ -17,11 +17,11 @@
 
 package org.apache.zookeeper;
 
+import java.util.ArrayList;
+import java.util.List;
 import org.apache.yetus.audience.InterfaceAudience;
 import org.apache.zookeeper.AsyncCallback.MultiCallback;
 import org.apache.zookeeper.data.ACL;
-import java.util.ArrayList;
-import java.util.List;
 
 /**
  * Provides a builder style interface for doing multiple updates.  This is
@@ -32,6 +32,7 @@ import java.util.List;
  */
 @InterfaceAudience.Public
 public class Transaction {
+
     private ZooKeeper zk;
     private List<Op> ops = new ArrayList<Op>();
 
@@ -39,8 +40,7 @@ public class Transaction {
         this.zk = zk;
     }
 
-    public Transaction create(final String path, byte data[], List<ACL> acl,
-                              CreateMode createMode) {
+    public Transaction create(final String path, byte[] data, List<ACL> acl, CreateMode createMode) {
         ops.add(Op.create(path, data, acl, createMode.toFlag()));
         return this;
     }
@@ -55,7 +55,7 @@ public class Transaction {
         return this;
     }
 
-    public Transaction setData(final String path, byte data[], int version) {
+    public Transaction setData(final String path, byte[] data, int version) {
         ops.add(Op.setData(path, data, version));
         return this;
     }
@@ -67,4 +67,5 @@ public class Transaction {
     public void commit(MultiCallback cb, Object ctx) {
         zk.multi(ops, cb, ctx);
     }
+
 }
diff --git a/zookeeper-server/src/main/java/org/apache/zookeeper/Version.java b/zookeeper-server/src/main/java/org/apache/zookeeper/Version.java
index 70f2e92..181e463 100644
--- a/zookeeper-server/src/main/java/org/apache/zookeeper/Version.java
+++ b/zookeeper-server/src/main/java/org/apache/zookeeper/Version.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -31,11 +31,9 @@ public class Version implements org.apache.zookeeper.version.Info {
         return BUILD_DATE;
     }
 
-    @SuppressFBWarnings(value = "RCN_REDUNDANT_NULLCHECK_OF_NULL_VALUE",
-            justification = "Missing QUALIFIER causes redundant null-check")
+    @SuppressFBWarnings(value = "RCN_REDUNDANT_NULLCHECK_OF_NULL_VALUE", justification = "Missing QUALIFIER causes redundant null-check")
     public static String getVersion() {
-        return MAJOR + "." + MINOR + "." + MICRO
-            + (QUALIFIER == null ? "" : "-" + QUALIFIER);
+        return MAJOR + "." + MINOR + "." + MICRO + (QUALIFIER == null ? "" : "-" + QUALIFIER);
     }
 
     public static String getVersionRevision() {
@@ -47,16 +45,15 @@ public class Version implements org.apache.zookeeper.version.Info {
     }
 
     public static void printUsage() {
-        System.out
-                .print("Usage:\tjava -cp ... org.apache.zookeeper.Version "
-                        + "[--full | --short | --revision],\n\tPrints --full version "
-                        + "info if no arg specified.");
+        System.out.print("Usage:\tjava -cp ... org.apache.zookeeper.Version "
+                         + "[--full | --short | --revision],\n\tPrints --full version "
+                         + "info if no arg specified.");
         System.exit(ExitCode.UNEXPECTED_ERROR.getValue());
     }
 
     /**
      * Prints the current version, revision and build date to the standard out.
-     * 
+     *
      * @param args
      *            <ul>
      *            <li> --short - prints a short version string "1.2.3"
@@ -73,12 +70,14 @@ public class Version implements org.apache.zookeeper.version.Info {
             System.out.println(getFullVersion());
             System.exit(ExitCode.EXECUTION_FINISHED.getValue());
         }
-        if (args[0].equals("--short"))
+        if (args[0].equals("--short")) {
             System.out.println(getVersion());
-        else if (args[0].equals("--revision"))
+        } else if (args[0].equals("--revision")) {
             System.out.println(getVersionRevision());
-        else
+        } else {
             printUsage();
+        }
         System.exit(ExitCode.EXECUTION_FINISHED.getValue());
     }
+
 }
diff --git a/zookeeper-server/src/main/java/org/apache/zookeeper/WatchDeregistration.java b/zookeeper-server/src/main/java/org/apache/zookeeper/WatchDeregistration.java
index 7c91f1c..16c7f84 100644
--- a/zookeeper-server/src/main/java/org/apache/zookeeper/WatchDeregistration.java
+++ b/zookeeper-server/src/main/java/org/apache/zookeeper/WatchDeregistration.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -20,9 +20,8 @@ package org.apache.zookeeper;
 
 import java.util.Map;
 import java.util.Set;
-
-import org.apache.zookeeper.Watcher.WatcherType;
 import org.apache.zookeeper.Watcher.Event.EventType;
+import org.apache.zookeeper.Watcher.WatcherType;
 import org.apache.zookeeper.ZooKeeper.ZKWatchManager;
 
 /**
@@ -37,8 +36,12 @@ public class WatchDeregistration {
     private final boolean local;
     private final ZKWatchManager zkManager;
 
-    public WatchDeregistration(String clientPath, Watcher watcher,
-            WatcherType watcherType, boolean local, ZKWatchManager zkManager) {
+    public WatchDeregistration(
+        String clientPath,
+        Watcher watcher,
+        WatcherType watcherType,
+        boolean local,
+        ZKWatchManager zkManager) {
         this.clientPath = clientPath;
         this.watcher = watcher;
         this.watcherType = watcherType;
@@ -48,23 +51,22 @@ public class WatchDeregistration {
 
     /**
      * Unregistering watcher that was added on path.
-     * 
+     *
      * @param rc
      *            the result code of the operation that attempted to remove
      *            watch on the path.
      */
-    public Map<EventType, Set<Watcher>> unregister(int rc)
-            throws KeeperException {
-        return zkManager.removeWatcher(clientPath, watcher, watcherType, local,
-                rc);
+    public Map<EventType, Set<Watcher>> unregister(int rc) throws KeeperException {
+        return zkManager.removeWatcher(clientPath, watcher, watcherType, local, rc);
     }
 
     /**
      * Returns client path which has specified for unregistering its watcher
-     * 
+     *
      * @return client path
      */
     public String getClientPath() {
         return clientPath;
     }
+
 }
diff --git a/zookeeper-server/src/main/java/org/apache/zookeeper/WatchedEvent.java b/zookeeper-server/src/main/java/org/apache/zookeeper/WatchedEvent.java
index 851fc6c..1de3d3d 100644
--- a/zookeeper-server/src/main/java/org/apache/zookeeper/WatchedEvent.java
+++ b/zookeeper-server/src/main/java/org/apache/zookeeper/WatchedEvent.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -15,12 +15,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.apache.zookeeper;
 
 import org.apache.yetus.audience.InterfaceAudience;
-import org.apache.zookeeper.proto.WatcherEvent;
 import org.apache.zookeeper.Watcher.Event.EventType;
 import org.apache.zookeeper.Watcher.Event.KeeperState;
+import org.apache.zookeeper.proto.WatcherEvent;
 
 /**
  *  A WatchedEvent represents a change on the ZooKeeper that a Watcher
@@ -30,10 +31,11 @@ import org.apache.zookeeper.Watcher.Event.KeeperState;
  */
 @InterfaceAudience.Public
 public class WatchedEvent {
-    final private KeeperState keeperState;
-    final private EventType eventType;
+
+    private final KeeperState keeperState;
+    private final EventType eventType;
     private String path;
-    
+
     /**
      * Create a WatchedEvent with specified type, state and path
      */
@@ -42,7 +44,7 @@ public class WatchedEvent {
         this.eventType = eventType;
         this.path = path;
     }
-    
+
     /**
      * Convert a WatcherEvent sent over the wire into a full-fledged WatcherEvent
      */
@@ -51,31 +53,29 @@ public class WatchedEvent {
         eventType = EventType.fromInt(eventMessage.getType());
         path = eventMessage.getPath();
     }
-    
+
     public KeeperState getState() {
         return keeperState;
     }
-    
+
     public EventType getType() {
         return eventType;
     }
-    
+
     public String getPath() {
         return path;
     }
 
     @Override
     public String toString() {
-        return "WatchedEvent state:" + keeperState
-            + " type:" + eventType + " path:" + path;
+        return "WatchedEvent state:" + keeperState + " type:" + eventType + " path:" + path;
     }
 
     /**
      *  Convert WatchedEvent to type that can be sent over network
      */
     public WatcherEvent getWrapper() {
-        return new WatcherEvent(eventType.getIntValue(), 
-                                keeperState.getIntValue(), 
-                                path);
+        return new WatcherEvent(eventType.getIntValue(), keeperState.getIntValue(), path);
     }
+
 }
diff --git a/zookeeper-server/src/main/java/org/apache/zookeeper/Watcher.java b/zookeeper-server/src/main/java/org/apache/zookeeper/Watcher.java
index 245978a..db81fdf 100644
--- a/zookeeper-server/src/main/java/org/apache/zookeeper/Watcher.java
+++ b/zookeeper-server/src/main/java/org/apache/zookeeper/Watcher.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -26,7 +26,7 @@ import org.apache.yetus.audience.InterfaceAudience;
  * server it connects to. An application using such a client handles these
  * events by registering a callback object with the client. The callback object
  * is expected to be an instance of a class that implements Watcher interface.
- * 
+ *
  */
 @InterfaceAudience.Public
 public interface Watcher {
@@ -35,34 +35,35 @@ public interface Watcher {
      * This interface defines the possible states an Event may represent
      */
     @InterfaceAudience.Public
-    public interface Event {
+    interface Event {
+
         /**
          * Enumeration of states the ZooKeeper may be at the event
          */
         @InterfaceAudience.Public
-        public enum KeeperState {
+        enum KeeperState {
             /** Unused, this state is never generated by the server */
             @Deprecated
-            Unknown (-1),
+            Unknown(-1),
 
             /** The client is in the disconnected state - it is not connected
              * to any server in the ensemble. */
-            Disconnected (0),
+            Disconnected(0),
 
             /** Unused, this state is never generated by the server */
             @Deprecated
-            NoSyncConnected (1),
+            NoSyncConnected(1),
 
             /** The client is in the connected state - it is connected
              * to a server in the ensemble (one of the servers specified
              * in the host connection parameter during ZooKeeper client
              * creation). */
-            SyncConnected (3),
+            SyncConnected(3),
 
             /**
              * Auth failed state
              */
-            AuthFailed (4),
+            AuthFailed(4),
 
             /**
              * The client is connected to a read-only server, that is the
@@ -72,29 +73,29 @@ public interface Watcher {
              * This state is generated for read-only clients only since
              * read/write clients aren't allowed to connect to r/o servers.
              */
-            ConnectedReadOnly (5),
+            ConnectedReadOnly(5),
 
             /**
-              * SaslAuthenticated: used to notify clients that they are SASL-authenticated,
-              * so that they can perform Zookeeper actions with their SASL-authorized permissions.
-              */
+             * SaslAuthenticated: used to notify clients that they are SASL-authenticated,
+             * so that they can perform Zookeeper actions with their SASL-authorized permissions.
+             */
             SaslAuthenticated(6),
 
             /** The serving cluster has expired this session. The ZooKeeper
              * client connection (the session) is no longer valid. You must
              * create a new client connection (instantiate a new ZooKeeper
              * instance) if you with to access the ensemble. */
-            Expired (-112),
-            
-            /** 
+            Expired(-112),
+
+            /**
              * The client has been closed. This state is never generated by
              * the server, but is generated locally when a client calls
              * {@link ZooKeeper#close()} or {@link ZooKeeper#close(int)}
              */
-            Closed (7);
+            Closed(7);
 
             private final int intValue;     // Integer representation of value
-                                            // for sending over wire
+            // for sending over wire
 
             KeeperState(int intValue) {
                 this.intValue = intValue;
@@ -105,19 +106,28 @@ public interface Watcher {
             }
 
             public static KeeperState fromInt(int intValue) {
-                switch(intValue) {
-                    case   -1: return KeeperState.Unknown;
-                    case    0: return KeeperState.Disconnected;
-                    case    1: return KeeperState.NoSyncConnected;
-                    case    3: return KeeperState.SyncConnected;
-                    case    4: return KeeperState.AuthFailed;
-                    case    5: return KeeperState.ConnectedReadOnly;
-                    case    6: return KeeperState.SaslAuthenticated;
-                    case -112: return KeeperState.Expired;
-                    case   7: return KeeperState.Closed;
-
-                    default:
-                        throw new RuntimeException("Invalid integer value for conversion to KeeperState");
+                switch (intValue) {
+                case -1:
+                    return KeeperState.Unknown;
+                case 0:
+                    return KeeperState.Disconnected;
+                case 1:
+                    return KeeperState.NoSyncConnected;
+                case 3:
+                    return KeeperState.SyncConnected;
+                case 4:
+                    return KeeperState.AuthFailed;
+                case 5:
+                    return KeeperState.ConnectedReadOnly;
+                case 6:
+                    return KeeperState.SaslAuthenticated;
+                case -112:
+                    return KeeperState.Expired;
+                case 7:
+                    return KeeperState.Closed;
+
+                default:
+                    throw new RuntimeException("Invalid integer value for conversion to KeeperState");
                 }
             }
         }
@@ -126,17 +136,17 @@ public interface Watcher {
          * Enumeration of types of events that may occur on the ZooKeeper
          */
         @InterfaceAudience.Public
-        public enum EventType {
-            None (-1),
-            NodeCreated (1),
-            NodeDeleted (2),
-            NodeDataChanged (3),
-            NodeChildrenChanged (4),
-            DataWatchRemoved (5),
-            ChildWatchRemoved (6);
+        enum EventType {
+            None(-1),
+            NodeCreated(1),
+            NodeDeleted(2),
+            NodeDataChanged(3),
+            NodeChildrenChanged(4),
+            DataWatchRemoved(5),
+            ChildWatchRemoved(6);
 
             private final int intValue;     // Integer representation of value
-                                            // for sending over wire
+            // for sending over wire
 
             EventType(int intValue) {
                 this.intValue = intValue;
@@ -147,33 +157,43 @@ public interface Watcher {
             }
 
             public static EventType fromInt(int intValue) {
-                switch(intValue) {
-                    case -1: return EventType.None;
-                    case  1: return EventType.NodeCreated;
-                    case  2: return EventType.NodeDeleted;
-                    case  3: return EventType.NodeDataChanged;
-                    case  4: return EventType.NodeChildrenChanged;
-                    case  5: return EventType.DataWatchRemoved;
-                    case  6: return EventType.ChildWatchRemoved;
-
-                    default:
-                        throw new RuntimeException("Invalid integer value for conversion to EventType");
+                switch (intValue) {
+                case -1:
+                    return EventType.None;
+                case 1:
+                    return EventType.NodeCreated;
+                case 2:
+                    return EventType.NodeDeleted;
+                case 3:
+                    return EventType.NodeDataChanged;
+                case 4:
+                    return EventType.NodeChildrenChanged;
+                case 5:
+                    return EventType.DataWatchRemoved;
+                case 6:
+                    return EventType.ChildWatchRemoved;
+
+                default:
+                    throw new RuntimeException("Invalid integer value for conversion to EventType");
                 }
-            }           
+            }
         }
+
     }
 
     /**
      * Enumeration of types of watchers
      */
     @InterfaceAudience.Public
-    public enum WatcherType {
-        Children(1), Data(2), Any(3);
+    enum WatcherType {
+        Children(1),
+        Data(2),
+        Any(3);
 
         // Integer representation of value
         private final int intValue;
 
-        private WatcherType(int intValue) {
+        WatcherType(int intValue) {
             this.intValue = intValue;
         }
 
@@ -191,11 +211,11 @@ public interface Watcher {
                 return WatcherType.Any;
 
             default:
-                throw new RuntimeException(
-                        "Invalid integer value for conversion to WatcherType");
+                throw new RuntimeException("Invalid integer value for conversion to WatcherType");
             }
         }
     }
 
-    abstract public void process(WatchedEvent event);
+    void process(WatchedEvent event);
+
 }
diff --git a/zookeeper-server/src/main/java/org/apache/zookeeper/ZKUtil.java b/zookeeper-server/src/main/java/org/apache/zookeeper/ZKUtil.java
index b1bad3f..c6b1ff5 100644
--- a/zookeeper-server/src/main/java/org/apache/zookeeper/ZKUtil.java
+++ b/zookeeper-server/src/main/java/org/apache/zookeeper/ZKUtil.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -15,6 +15,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.apache.zookeeper;
 
 import java.io.File;
@@ -23,9 +24,8 @@ import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 import java.util.Queue;
-
-import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.Semaphore;
+import java.util.concurrent.atomic.AtomicBoolean;
 import org.apache.zookeeper.AsyncCallback.MultiCallback;
 import org.apache.zookeeper.AsyncCallback.StringCallback;
 import org.apache.zookeeper.AsyncCallback.VoidCallback;
@@ -35,6 +35,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public class ZKUtil {
+
     private static final Logger LOG = LoggerFactory.getLogger(ZKUtil.class);
     /**
      * Recursively delete the node with the given path.
@@ -47,9 +48,10 @@ public class ZKUtil {
      *
      * @throws IllegalArgumentException if an invalid path is specified
      */
-    public static boolean deleteRecursive(ZooKeeper zk, final String pathRoot, final int batchSize)
-        throws InterruptedException, KeeperException
-    {
+    public static boolean deleteRecursive(
+        ZooKeeper zk,
+        final String pathRoot,
+        final int batchSize) throws InterruptedException, KeeperException {
         PathUtils.validatePath(pathRoot);
 
         List<String> tree = listSubTreeBFS(zk, pathRoot);
@@ -59,6 +61,7 @@ public class ZKUtil {
     }
 
     private static class BatchedDeleteCbContext {
+
         public Semaphore sem;
         public AtomicBoolean success;
 
@@ -66,23 +69,22 @@ public class ZKUtil {
             sem = new Semaphore(rateLimit);
             success = new AtomicBoolean(true);
         }
+
     }
 
-    private static boolean deleteInBatch(ZooKeeper zk, List<String> tree, int batchSize)
-        throws InterruptedException
-    {
+    private static boolean deleteInBatch(ZooKeeper zk, List<String> tree, int batchSize) throws InterruptedException {
         int rateLimit = 10;
         List<Op> ops = new ArrayList<>();
         BatchedDeleteCbContext context = new BatchedDeleteCbContext(rateLimit);
         MultiCallback cb = (rc, path, ctx, opResults) -> {
-            ((BatchedDeleteCbContext)ctx).sem.release();
+            ((BatchedDeleteCbContext) ctx).sem.release();
             if (rc != Code.OK.intValue()) {
-                ((BatchedDeleteCbContext)ctx).success.set(false);
+                ((BatchedDeleteCbContext) ctx).success.set(false);
             }
         };
 
         // Delete the leaves first and eventually get rid of the root
-        for (int i = tree.size() - 1; i >= 0 ; --i) {
+        for (int i = tree.size() - 1; i >= 0; --i) {
             // Create Op to delete all versions of the node with -1.
             ops.add(Op.delete(tree.get(i), -1));
 
@@ -117,20 +119,21 @@ public class ZKUtil {
      * @param ctx the context the callback method is called with
      * @throws IllegalArgumentException if an invalid path is specified
      */
-    public static void deleteRecursive(ZooKeeper zk, final String pathRoot, VoidCallback cb,
-        Object ctx)
-        throws InterruptedException, KeeperException
-    {
+    public static void deleteRecursive(
+        ZooKeeper zk,
+        final String pathRoot,
+        VoidCallback cb,
+        Object ctx) throws InterruptedException, KeeperException {
         PathUtils.validatePath(pathRoot);
 
         List<String> tree = listSubTreeBFS(zk, pathRoot);
         LOG.debug("Deleting tree: {}", tree);
-        for (int i = tree.size() - 1; i >= 0 ; --i) {
+        for (int i = tree.size() - 1; i >= 0; --i) {
             //Delete the leaves first and eventually get rid of the root
             zk.delete(tree.get(i), -1, cb, ctx); //Delete all versions of the node with -1.
         }
     }
-    
+
     /**
      * @param filePath the file path to be validated
      * @return Returns null if valid otherwise error message
@@ -163,8 +166,9 @@ public class ZKUtil {
      * @throws InterruptedException
      * @throws KeeperException
      */
-    public static List<String> listSubTreeBFS(ZooKeeper zk, final String pathRoot) throws
-        KeeperException, InterruptedException {
+    public static List<String> listSubTreeBFS(
+        ZooKeeper zk,
+        final String pathRoot) throws KeeperException, InterruptedException {
         Queue<String> queue = new ArrayDeque<>();
         List<String> tree = new ArrayList<String>();
         queue.add(pathRoot);
@@ -190,7 +194,10 @@ public class ZKUtil {
      * For practical purposes, it is suggested to bring the clients to the ensemble
      * down (i.e. prevent writes to pathRoot) to 'simulate' a snapshot behavior.
      */
-    public static void visitSubTreeDFS(ZooKeeper zk, final String path, boolean watch,
+    public static void visitSubTreeDFS(
+        ZooKeeper zk,
+        final String path,
+        boolean watch,
         StringCallback cb) throws KeeperException, InterruptedException {
         PathUtils.validatePath(path);
 
@@ -200,9 +207,11 @@ public class ZKUtil {
     }
 
     @SuppressWarnings("unchecked")
-    private static void visitSubTreeDFSHelper(ZooKeeper zk, final String path,
-        boolean watch, StringCallback cb)
-            throws KeeperException, InterruptedException {
+    private static void visitSubTreeDFSHelper(
+        ZooKeeper zk,
+        final String path,
+        boolean watch,
+        StringCallback cb) throws KeeperException, InterruptedException {
         // we've already validated, therefore if the path is of length 1 it's the root
         final boolean isRoot = path.length() == 1;
         try {
@@ -218,11 +227,11 @@ public class ZKUtil {
                 String childPath = (isRoot ? path : path + "/") + child;
                 visitSubTreeDFSHelper(zk, childPath, watch, cb);
             }
-        }
-        catch (KeeperException.NoNodeException e) {
+        } catch (KeeperException.NoNodeException e) {
             // Handle race condition where a node is listed
             // but gets deleted before it can be queried
             return; // ignore
         }
     }
-}
\ No newline at end of file
+
+}
diff --git a/zookeeper-server/src/main/java/org/apache/zookeeper/ZooDefs.java b/zookeeper-server/src/main/java/org/apache/zookeeper/ZooDefs.java
index 1f44c1e..db176f5 100644
--- a/zookeeper-server/src/main/java/org/apache/zookeeper/ZooDefs.java
+++ b/zookeeper-server/src/main/java/org/apache/zookeeper/ZooDefs.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -21,83 +21,85 @@ package org.apache.zookeeper;
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.util.ArrayList;
 import java.util.Collections;
-
 import org.apache.yetus.audience.InterfaceAudience;
 import org.apache.zookeeper.data.ACL;
 import org.apache.zookeeper.data.Id;
 
 @InterfaceAudience.Public
 public class ZooDefs {
-   
-   final public static String CONFIG_NODE = "/zookeeper/config";
 
-   final public static String ZOOKEEPER_NODE_SUBTREE = "/zookeeper/";
+    public static final String CONFIG_NODE = "/zookeeper/config";
+
+    public static final String ZOOKEEPER_NODE_SUBTREE = "/zookeeper/";
 
-   @InterfaceAudience.Public
+    @InterfaceAudience.Public
     public interface OpCode {
-        public final int notification = 0;
 
-        public final int create = 1;
+        int notification = 0;
+
+        int create = 1;
+
+        int delete = 2;
+
+        int exists = 3;
 
-        public final int delete = 2;
+        int getData = 4;
 
-        public final int exists = 3;
+        int setData = 5;
 
-        public final int getData = 4;
+        int getACL = 6;
 
-        public final int setData = 5;
+        int setACL = 7;
 
-        public final int getACL = 6;
+        int getChildren = 8;
 
-        public final int setACL = 7;
+        int sync = 9;
 
-        public final int getChildren = 8;
+        int ping = 11;
 
-        public final int sync = 9;
+        int getChildren2 = 12;
 
-        public final int ping = 11;
+        int check = 13;
 
-        public final int getChildren2 = 12;
+        int multi = 14;
 
-        public final int check = 13;
+        int create2 = 15;
 
-        public final int multi = 14;
-        
-        public final int create2 = 15;
+        int reconfig = 16;
 
-        public final int reconfig = 16;
+        int checkWatches = 17;
 
-        public final int checkWatches = 17;
+        int removeWatches = 18;
 
-        public final int removeWatches = 18;
+        int createContainer = 19;
 
-        public final int createContainer = 19;
+        int deleteContainer = 20;
 
-        public final int deleteContainer = 20;
+        int createTTL = 21;
 
-        public final int createTTL = 21;
+        int multiRead = 22;
 
-        public final int multiRead = 22;
+        int auth = 100;
 
-        public final int auth = 100;
+        int setWatches = 101;
 
-        public final int setWatches = 101;
+        int sasl = 102;
 
-        public final int sasl = 102;
+        int getEphemerals = 103;
 
-        public final int getEphemerals = 103;
+        int getAllChildrenNumber = 104;
 
-        public final int getAllChildrenNumber = 104;
+        int createSession = -10;
 
-        public final int createSession = -10;
+        int closeSession = -11;
 
-        public final int closeSession = -11;
+        int error = -1;
 
-        public final int error = -1;
     }
 
     @InterfaceAudience.Public
     public interface Perms {
+
         int READ = 1 << 0;
 
         int WRITE = 1 << 1;
@@ -109,45 +111,43 @@ public class ZooDefs {
         int ADMIN = 1 << 4;
 
         int ALL = READ | WRITE | CREATE | DELETE | ADMIN;
+
     }
 
     @InterfaceAudience.Public
     public interface Ids {
+
         /**
          * This Id represents anyone.
          */
-        public final Id ANYONE_ID_UNSAFE = new Id("world", "anyone");
+        Id ANYONE_ID_UNSAFE = new Id("world", "anyone");
 
         /**
          * This Id is only usable to set ACLs. It will get substituted with the
          * Id's the client authenticated with.
          */
-        public final Id AUTH_IDS = new Id("auth", "");
+        Id AUTH_IDS = new Id("auth", "");
 
         /**
          * This is a completely open ACL .
          */
         @SuppressFBWarnings(value = "MS_MUTABLE_COLLECTION", justification = "Cannot break API")
-        public final ArrayList<ACL> OPEN_ACL_UNSAFE = new ArrayList<ACL>(
-                Collections.singletonList(new ACL(Perms.ALL, ANYONE_ID_UNSAFE)));
+        ArrayList<ACL> OPEN_ACL_UNSAFE = new ArrayList<ACL>(Collections.singletonList(new ACL(Perms.ALL, ANYONE_ID_UNSAFE)));
 
         /**
          * This ACL gives the creators authentication id's all permissions.
          */
         @SuppressFBWarnings(value = "MS_MUTABLE_COLLECTION", justification = "Cannot break API")
-        public final ArrayList<ACL> CREATOR_ALL_ACL = new ArrayList<ACL>(
-                Collections.singletonList(new ACL(Perms.ALL, AUTH_IDS)));
+        ArrayList<ACL> CREATOR_ALL_ACL = new ArrayList<ACL>(Collections.singletonList(new ACL(Perms.ALL, AUTH_IDS)));
 
         /**
          * This ACL gives the world the ability to read.
          */
         @SuppressFBWarnings(value = "MS_MUTABLE_COLLECTION", justification = "Cannot break API")
-        public final ArrayList<ACL> READ_ACL_UNSAFE = new ArrayList<ACL>(
-                Collections
-                        .singletonList(new ACL(Perms.READ, ANYONE_ID_UNSAFE)));
+        ArrayList<ACL> READ_ACL_UNSAFE = new ArrayList<ACL>(Collections.singletonList(new ACL(Perms.READ, ANYONE_ID_UNSAFE)));
+
     }
 
-    final public static String[] opNames = { "notification", "create",
-            "delete", "exists", "getData", "setData", "getACL", "setACL",
-            "getChildren", "getChildren2", "getMaxChildren", "setMaxChildren", "ping", "reconfig", "getConfig" };
+    public static final String[] opNames = {"notification", "create", "delete", "exists", "getData", "setData", "getACL", "setACL", "getChildren", "getChildren2", "getMaxChildren", "setMaxChildren", "ping", "reconfig", "getConfig"};
+
 }
diff --git a/zookeeper-server/src/main/java/org/apache/zookeeper/ZooKeeper.java b/zookeeper-server/src/main/java/org/apache/zookeeper/ZooKeeper.java
index ab45061..0a140c8 100644
--- a/zookeeper-server/src/main/java/org/apache/zookeeper/ZooKeeper.java
+++ b/zookeeper-server/src/main/java/org/apache/zookeeper/ZooKeeper.java
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -18,6 +18,17 @@
 
 package org.apache.zookeeper;
 
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.net.InetSocketAddress;
+import java.net.SocketAddress;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 import org.apache.jute.Record;
 import org.apache.yetus.audience.InterfaceAudience;
 import org.apache.zookeeper.AsyncCallback.ACLCallback;
@@ -51,17 +62,16 @@ import org.apache.zookeeper.proto.DeleteRequest;
 import org.apache.zookeeper.proto.ExistsRequest;
 import org.apache.zookeeper.proto.GetACLRequest;
 import org.apache.zookeeper.proto.GetACLResponse;
-import org.apache.zookeeper.proto.GetChildren2Request;
-import org.apache.zookeeper.proto.GetChildren2Response;
 import org.apache.zookeeper.proto.GetAllChildrenNumberRequest;
 import org.apache.zookeeper.proto.GetAllChildrenNumberResponse;
+import org.apache.zookeeper.proto.GetChildren2Request;
+import org.apache.zookeeper.proto.GetChildren2Response;
 import org.apache.zookeeper.proto.GetChildrenRequest;
 import org.apache.zookeeper.proto.GetChildrenResponse;
 import org.apache.zookeeper.proto.GetDataRequest;
 import org.apache.zookeeper.proto.GetDataResponse;
 import org.apache.zookeeper.proto.GetEphemeralsRequest;
 import org.apache.zookeeper.proto.GetEphemeralsResponse;
-import org.apache.zookeeper.proto.ReconfigRequest;
 import org.apache.zookeeper.proto.RemoveWatchesRequest;
 import org.apache.zookeeper.proto.ReplyHeader;
 import org.apache.zookeeper.proto.RequestHeader;
@@ -76,20 +86,6 @@ import org.apache.zookeeper.server.EphemeralType;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.IOException;
-import java.lang.reflect.Constructor;
-import java.net.InetSocketAddress;
-import java.net.SocketAddress;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import static org.apache.zookeeper.Op.OpKind.READ;
-
 /**
  * This is the main class of ZooKeeper client library. To use a ZooKeeper
  * service, an application must first instantiate an object of ZooKeeper class.
@@ -143,7 +139,7 @@ import static org.apache.zookeeper.Op.OpKind.READ;
  * by AutoCloseable (see: http://docs.oracle.com/javase/7/docs/api/java/lang/AutoCloseable.html#close()).
  * close() will never throw an InterruptedException but the exception remains in the
  * signature for backwards compatibility purposes.
-*/
+ */
 @SuppressWarnings("try")
 @InterfaceAudience.Public
 public class ZooKeeper implements AutoCloseable {
@@ -165,6 +161,7 @@ public class ZooKeeper implements AutoCloseable {
 
     protected final ClientCnxn cnxn;
     private static final Logger LOG;
+
     static {
         //Keep these two lines together to keep the initialization order explicit
         LOG = LoggerFactory.getLogger(ZooKeeper.class);
@@ -174,20 +171,20 @@ public class ZooKeeper implements AutoCloseable {
     protected final HostProvider hostProvider;
 
     /**
-     * This function allows a client to update the connection string by providing 
-     * a new comma separated list of host:port pairs, each corresponding to a 
-     * ZooKeeper server. 
+     * This function allows a client to update the connection string by providing
+     * a new comma separated list of host:port pairs, each corresponding to a
+     * ZooKeeper server.
      * <p>
      * The function invokes a <a href="https://issues.apache.org/jira/browse/ZOOKEEPER-1355">
-     * probabilistic load-balancing algorithm</a> which may cause the client to disconnect from 
-     * its current host with the goal to achieve expected uniform number of connections per server 
+     * probabilistic load-balancing algorithm</a> which may cause the client to disconnect from
+     * its current host with the goal to achieve expected uniform number of connections per server
      * in the new list. In case the current host to which the client is connected is not in the new
      * list this call will always cause the connection to be dropped. Otherwise, the decision
      * is based on whether the number of servers has increased or decreased and by how much.
      * For example, if the previous connection string contained 3 hosts and now the list contains
      * these 3 hosts and 2 more hosts, 40% of clients connected to each of the 3 hosts will
-     * move to one of the new hosts in order to balance the load. The algorithm will disconnect 
-     * from the current host with probability 0.4 and in this case cause the client to connect 
+     * move to one of the new hosts in order to balance the load. The algorithm will disconnect
+     * from the current host with probability 0.4 and in this case cause the client to connect
      * to one of the 2 new hosts, chosen at random.
      * <p>
      * If the connection is dropped, the client moves to a special mode "reconfigMode" where he chooses
@@ -199,7 +196,6 @@ public class ZooKeeper implements AutoCloseable {
      * (the order is non-deterministic, as we random shuffle the list), until a
      * connection is established. The client will continue attempts until the
      * session is explicitly closed (or the session is expired by the server).
-
      * @param connectString
      *            comma separated host:port pairs, each corresponding to a zk
      *            server. e.g. "127.0.0.1:3000,127.0.0.1:3001,127.0.0.1:3002"
@@ -208,9 +204,9 @@ public class ZooKeeper implements AutoCloseable {
      *            where the client would be rooted at "/app/a" and all paths
      *            would be relative to this root - ie getting/setting/etc...
      *            "/foo/bar" would result in operations being run on
-     *            "/app/a/foo/bar" (from the server perspective).     
+     *            "/app/a/foo/bar" (from the server perspective).
      *
-     * @throws IOException in cases of network failure     
+     * @throws IOException in cases of network failure
      */
     public void updateServerList(String connectString) throws IOException {
         ConnectStringParser connectStringParser = new ConnectStringParser(connectString);
@@ -223,7 +219,9 @@ public class ZooKeeper implements AutoCloseable {
 
         // cause disconnection - this will cause next to be called
         // which will in turn call nextReconfigMode
-        if (reconfigMode) clientCnxnSocket.testableCloseSocket();
+        if (reconfigMode) {
+            clientCnxnSocket.testableCloseSocket();
+        }
     }
 
     public ZooKeeperSaslClient getSaslClient() {
@@ -239,19 +237,19 @@ public class ZooKeeper implements AutoCloseable {
     }
 
     protected List<String> getDataWatches() {
-        synchronized(watchManager.dataWatches) {
+        synchronized (watchManager.dataWatches) {
             List<String> rc = new ArrayList<String>(watchManager.dataWatches.keySet());
             return rc;
         }
     }
     protected List<String> getExistWatches() {
-        synchronized(watchManager.existWatches) {
-            List<String> rc =  new ArrayList<String>(watchManager.existWatches.keySet());
+        synchronized (watchManager.existWatches) {
+            List<String> rc = new ArrayList<String>(watchManager.existWatches.keySet());
             return rc;
         }
     }
     protected List<String> getChildWatches() {
-        synchronized(watchManager.childWatches) {
+        synchronized (watchManager.childWatches) {
             List<String> rc = new ArrayList<String>(watchManager.childWatches.keySet());
             return rc;
         }
@@ -265,12 +263,10 @@ public class ZooKeeper implements AutoCloseable {
      * API.
      */
     static class ZKWatchManager implements ClientWatchManager {
-        private final Map<String, Set<Watcher>> dataWatches =
-            new HashMap<String, Set<Watcher>>();
-        private final Map<String, Set<Watcher>> existWatches =
-            new HashMap<String, Set<Watcher>>();
-        private final Map<String, Set<Watcher>> childWatches =
-            new HashMap<String, Set<Watcher>>();
+
+        private final Map<String, Set<Watcher>> dataWatches = new HashMap<String, Set<Watcher>>();
+        private final Map<String, Set<Watcher>> existWatches = new HashMap<String, Set<Watcher>>();
+        private final Map<String, Set<Watcher>> childWatches = new HashMap<String, Set<Watcher>>();
         private boolean disableAutoWatchReset;
 
         ZKWatchManager(boolean disableAutoWatchReset) {
@@ -279,61 +275,57 @@ public class ZooKeeper implements AutoCloseable {
 
         protected volatile Watcher defaultWatcher;
 
-        final private void addTo(Set<Watcher> from, Set<Watcher> to) {
+        private void addTo(Set<Watcher> from, Set<Watcher> to) {
             if (from != null) {
                 to.addAll(from);
             }
         }
 
-        public Map<EventType, Set<Watcher>> removeWatcher(String clientPath,
-                Watcher watcher, WatcherType watcherType, boolean local, int rc)
-                throws KeeperException {
+        public Map<EventType, Set<Watcher>> removeWatcher(
+            String clientPath,
+            Watcher watcher,
+            WatcherType watcherType,
+            boolean local,
+            int rc) throws KeeperException {
             // Validate the provided znode path contains the given watcher of
             // watcherType
             containsWatcher(clientPath, watcher, watcherType);
 
-            Map<EventType, Set<Watcher>> removedWatchers = new HashMap<EventType, Set<Watcher>>();
-            HashSet<Watcher> childWatchersToRem = new HashSet<Watcher>();
-            removedWatchers
-                    .put(EventType.ChildWatchRemoved, childWatchersToRem);
-            HashSet<Watcher> dataWatchersToRem = new HashSet<Watcher>();
+            Map<EventType, Set<Watcher>> removedWatchers = new HashMap<>();
+            HashSet<Watcher> childWatchersToRem = new HashSet<>();
+            removedWatchers.put(EventType.ChildWatchRemoved, childWatchersToRem);
+            HashSet<Watcher> dataWatchersToRem = new HashSet<>();
             removedWatchers.put(EventType.DataWatchRemoved, dataWatchersToRem);
             boolean removedWatcher = false;
             switch (watcherType) {
             case Children: {
                 synchronized (childWatches) {
-                    removedWatcher = removeWatches(childWatches, watcher,
-                            clientPath, local, rc, childWatchersToRem);
+                    removedWatcher = removeWatches(childWatches, watcher, clientPath, local, rc, childWatchersToRem);
                 }
                 break;
             }
             case Data: {
                 synchronized (dataWatches) {
-                    removedWatcher = removeWatches(dataWatches, watcher,
-                            clientPath, local, rc, dataWatchersToRem);
+                    removedWatcher = removeWatches(dataWatches, watcher, clientPath, local, rc, dataWatchersToRem);
                 }
 
                 synchronized (existWatches) {
-                    boolean removedDataWatcher = removeWatches(existWatches,
-                            watcher, clientPath, local, rc, dataWatchersToRem);
+                    boolean removedDataWatcher = removeWatches(existWatches, watcher, clientPath, local, rc, dataWatchersToRem);
                     removedWatcher |= removedDataWatcher;
                 }
                 break;
             }
             case Any: {
                 synchronized (childWatches) {
-                    removedWatcher = removeWatches(childWatches, watcher,
-                            clientPath, local, rc, childWatchersToRem);
+                    removedWatcher = removeWatches(childWatches, watcher, clientPath, local, rc, childWatchersToRem);
                 }
 
                 synchronized (dataWatches) {
-                    boolean removedDataWatcher = removeWatches(dataWatches,
-                            watcher, clientPath, local, rc, dataWatchersToRem);
+                    boolean removedDataWatcher = removeWatches(dataWatches, watcher, clientPath, local, rc, dataWatchersToRem);
                     removedWatcher |= removedDataWatcher;
                 }
                 synchronized (existWatches) {
-                    boolean removedDataWatcher = removeWatches(existWatches,
-                            watcher, clientPath, local, rc, dataWatchersToRem);
+                    boolean removedDataWatcher = removeWatches(existWatches, watcher, clientPath, local, rc, dataWatchersToRem);
                     removedWatcher |= removedDataWatcher;
                 }
             }
@@ -345,8 +337,7 @@ public class ZooKeeper implements AutoCloseable {
             return removedWatchers;
         }
 
-        private boolean contains(String path, Watcher watcherObj,
-                Map<String, Set<Watcher>> pathVsWatchers) {
+        private boolean contains(String path, Watcher watcherObj, Map<String, Set<Watcher>> pathVsWatchers) {
             boolean watcherExists = true;
             if (pathVsWatchers == null || pathVsWatchers.size() == 0) {
                 watcherExists = false;
@@ -366,7 +357,7 @@ public class ZooKeeper implements AutoCloseable {
         /**
          * Validate the provided znode path contains the given watcher and
          * watcherType
-         * 
+         *
          * @param path
          *            - client path
          * @param watcher
@@ -374,9 +365,8 @@ public class ZooKeeper implements AutoCloseable {
          * @param watcherType
          *            - type of the watcher
          * @throws NoWatcherException
-        */
-        void containsWatcher(String path, Watcher watcher,
-                WatcherType watcherType) throws NoWatcherException{
+         */
+        void containsWatcher(String path, Watcher watcher, WatcherType watcherType) throws NoWatcherException {
             boolean containsWatcher = false;
             switch (watcherType) {
             case Children: {
@@ -391,8 +381,7 @@ public class ZooKeeper implements AutoCloseable {
                 }
 
                 synchronized (existWatches) {
-                    boolean contains_temp = contains(path, watcher,
-                            existWatches);
+                    boolean contains_temp = contains(path, watcher, existWatches);
                     containsWatcher |= contains_temp;
                 }
                 break;
@@ -407,8 +396,7 @@ public class ZooKeeper implements AutoCloseable {
                     containsWatcher |= contains_temp;
                 }
                 synchronized (existWatches) {
-                    boolean contains_temp = contains(path, watcher,
-                            existWatches);
+                    boolean contains_temp = contains(path, watcher, existWatches);
                     containsWatcher |= contains_temp;
                 }
             }
@@ -419,12 +407,15 @@ public class ZooKeeper implements AutoCloseable {
             }
         }
 
-        protected boolean removeWatches(Map<String, Set<Watcher>> pathVsWatcher,
-                Watcher watcher, String path, boolean local, int rc,
-                Set<Watcher> removedWatchers) throws KeeperException {
+        protected boolean removeWatches(
+            Map<String, Set<Watcher>> pathVsWatcher,
+            Watcher watcher,
+            String path,
+            boolean local,
+            int rc,
+            Set<Watcher> removedWatchers) throws KeeperException {
             if (!local && rc != Code.OK.intValue()) {
-                throw KeeperException
-                        .create(KeeperException.Code.get(rc), path);
+                throw KeeperException.create(KeeperException.Code.get(rc), path);
             }
             boolean success = false;
             // When local flag is true, remove watchers for the given path
@@ -456,24 +447,24 @@ public class ZooKeeper implements AutoCloseable {
             }
             return success;
         }
-        
+
         /* (non-Javadoc)
-         * @see org.apache.zookeeper.ClientWatchManager#materialize(Event.KeeperState, 
+         * @see org.apache.zookeeper.ClientWatchManager#materialize(Event.KeeperState,
          *                                                        Event.EventType, java.lang.String)
          */
         @Override
-        public Set<Watcher> materialize(Watcher.Event.KeeperState state,
-                                        Watcher.Event.EventType type,
-                                        String clientPath)
-        {
+        public Set<Watcher> materialize(
+            Watcher.Event.KeeperState state,
+            Watcher.Event.EventType type,
+            String clientPath) {
             Set<Watcher> result = new HashSet<Watcher>();
 
             switch (type) {
             case None:
                 result.add(defaultWatcher);
                 boolean clear = disableAutoWatchReset && state != Watcher.Event.KeeperState.SyncConnected;
-                synchronized(dataWatches) {
-                    for(Set<Watcher> ws: dataWatches.values()) {
+                synchronized (dataWatches) {
+                    for (Set<Watcher> ws : dataWatches.values()) {
                         result.addAll(ws);
                     }
                     if (clear) {
@@ -481,8 +472,8 @@ public class ZooKeeper implements AutoCloseable {
                     }
                 }
 
-                synchronized(existWatches) {
-                    for(Set<Watcher> ws: existWatches.values()) {
+                synchronized (existWatches) {
+                    for (Set<Watcher> ws : existWatches.values()) {
                         result.addAll(ws);
                     }
                     if (clear) {
@@ -490,8 +481,8 @@ public class ZooKeeper implements AutoCloseable {
                     }
                 }
 
-                synchronized(childWatches) {
-                    for(Set<Watcher> ws: childWatches.values()) {
+                synchronized (childWatches) {
+                    for (Set<Watcher> ws : childWatches.values()) {
                         result.addAll(ws);
                     }
                     if (clear) {
@@ -518,7 +509,7 @@ public class ZooKeeper implements AutoCloseable {
                 synchronized (dataWatches) {
                     addTo(dataWatches.remove(clientPath), result);
                 }
-                // XXX This shouldn't be needed, but just in case
+                // TODO This shouldn't be needed, but just in case
                 synchronized (existWatches) {
                     Set<Watcher> list = existWatches.remove(clientPath);
                     if (list != null) {
@@ -531,29 +522,29 @@ public class ZooKeeper implements AutoCloseable {
                 }
                 break;
             default:
-                String msg = "Unhandled watch event type " + type
-                    + " with state " + state + " on path " + clientPath;
+                String msg = "Unhandled watch event type " + type + " with state " + state + " on path " + clientPath;
                 LOG.error(msg);
                 throw new RuntimeException(msg);
             }
 
             return result;
         }
+
     }
 
     /**
      * Register a watcher for a particular path.
      */
     public abstract class WatchRegistration {
+
         private Watcher watcher;
         private String clientPath;
-        public WatchRegistration(Watcher watcher, String clientPath)
-        {
+        public WatchRegistration(Watcher watcher, String clientPath) {
             this.watcher = watcher;
             this.clientPath = clientPath;
         }
 
-        abstract protected Map<String, Set<Watcher>> getWatches(int rc);
+        protected abstract Map<String, Set<Watcher>> getWatches(int rc);
 
         /**
          * Register the watcher with the set of watches on path.
@@ -563,7 +554,7 @@ public class ZooKeeper implements AutoCloseable {
         public void register(int rc) {
             if (shouldAddWatch(rc)) {
                 Map<String, Set<Watcher>> watches = getWatches(rc);
-                synchronized(watches) {
+                synchronized (watches) {
                     Set<Watcher> watchers = watches.get(clientPath);
                     if (watchers == null) {
                         watchers = new HashSet<Watcher>();
@@ -582,28 +573,32 @@ public class ZooKeeper implements AutoCloseable {
         protected boolean shouldAddWatch(int rc) {
             return rc == 0;
         }
+
     }
 
     /** Handle the special case of exists watches - they add a watcher
      * even in the case where NONODE result code is returned.
      */
     class ExistsWatchRegistration extends WatchRegistration {
+
         public ExistsWatchRegistration(Watcher watcher, String clientPath) {
             super(watcher, clientPath);
         }
 
         @Override
         protected Map<String, Set<Watcher>> getWatches(int rc) {
-            return rc == 0 ?  watchManager.dataWatches : watchManager.existWatches;
+            return rc == 0 ? watchManager.dataWatches : watchManager.existWatches;
         }
 
         @Override
         protected boolean shouldAddWatch(int rc) {
             return rc == 0 || rc == KeeperException.Code.NONODE.intValue();
         }
+
     }
 
     class DataWatchRegistration extends WatchRegistration {
+
         public DataWatchRegistration(Watcher watcher, String clientPath) {
             super(watcher, clientPath);
         }
@@ -612,9 +607,11 @@ public class ZooKeeper implements AutoCloseable {
         protected Map<String, Set<Watcher>> getWatches(int rc) {
             return watchManager.dataWatches;
         }
+
     }
 
     class ChildWatchRegistration extends WatchRegistration {
+
         public ChildWatchRegistration(Watcher watcher, String clientPath) {
             super(watcher, clientPath);
         }
@@ -623,12 +620,18 @@ public class ZooKeeper implements AutoCloseable {
         protected Map<String, Set<Watcher>> getWatches(int rc) {
             return watchManager.childWatches;
         }
+
     }
 
     @InterfaceAudience.Public
     public enum States {
-        CONNECTING, ASSOCIATING, CONNECTED, CONNECTEDREADONLY,
-        CLOSED, AUTH_FAILED, NOT_CONNECTED;
+        CONNECTING,
+        ASSOCIATING,
+        CONNECTED,
+        CONNECTEDREADONLY,
+        CLOSED,
+        AUTH_FAILED,
+        NOT_CONNECTED;
 
         public boolean isAlive() {
             return this != CLOSED && this != AUTH_FAILED;
@@ -687,9 +690,7 @@ public class ZooKeeper implements AutoCloseable {
      * @throws IllegalArgumentException
      *             if an invalid chroot path is specified
      */
-    public ZooKeeper(String connectString, int sessionTimeout, Watcher watcher)
-        throws IOException
-    {
+    public ZooKeeper(String connectString, int sessionTimeout, Watcher watcher) throws IOException {
         this(connectString, sessionTimeout, watcher, false);
     }
 
@@ -738,8 +739,11 @@ public class ZooKeeper implements AutoCloseable {
      * @throws IllegalArgumentException
      *             if an invalid chroot path is specified
      */
-    public ZooKeeper(String connectString, int sessionTimeout, Watcher watcher,
-            ZKClientConfig conf) throws IOException {
+    public ZooKeeper(
+        String connectString,
+        int sessionTimeout,
+        Watcher watcher,
+        ZKClientConfig conf) throws IOException {
         this(connectString, sessionTimeout, watcher, false, conf);
     }
 
@@ -800,14 +804,15 @@ public class ZooKeeper implements AutoCloseable {
      * @throws IllegalArgumentException
      *             if an invalid chroot path is specified
      */
-    public ZooKeeper(String connectString, int sessionTimeout, Watcher watcher,
-            boolean canBeReadOnly, HostProvider aHostProvider)
-            throws IOException {
-        this(connectString, sessionTimeout, watcher, canBeReadOnly,
-                aHostProvider, null);
+    public ZooKeeper(
+        String connectString,
+        int sessionTimeout,
+        Watcher watcher,
+        boolean canBeReadOnly,
+        HostProvider aHostProvider) throws IOException {
+        this(connectString, sessionTimeout, watcher, canBeReadOnly, aHostProvider, null);
     }
 
-
     /**
      * To create a ZooKeeper client object, the application needs to pass a
      * connection string containing a comma separated list of host:port pairs,
@@ -867,11 +872,16 @@ public class ZooKeeper implements AutoCloseable {
      * @throws IllegalArgumentException
      *             if an invalid chroot path is specified
      */
-    public ZooKeeper(String connectString, int sessionTimeout, Watcher watcher,
-            boolean canBeReadOnly, HostProvider aHostProvider,
-            ZKClientConfig clientConfig) throws IOException {
+    public ZooKeeper(
+        String connectString,
+        int sessionTimeout,
+        Watcher watcher,
+        boolean canBeReadOnly,
+        HostProvider aHostProvider,
+        ZKClientConfig clientConfig) throws IOException {
         LOG.info("Initiating client connection, connectString=" + connectString
-                + " sessionTimeout=" + sessionTimeout + " watcher=" + watcher);
+                 + " sessionTimeout=" + sessionTimeout
+                 + " watcher=" + watcher);
 
         if (clientConfig == null) {
             clientConfig = new ZKClientConfig();
@@ -879,23 +889,37 @@ public class ZooKeeper implements AutoCloseable {
         this.clientConfig = clientConfig;
         watchManager = defaultWatchManager();
         watchManager.defaultWatcher = watcher;
-        ConnectStringParser connectStringParser = new ConnectStringParser(
-                connectString);
+        ConnectStringParser connectStringParser = new ConnectStringParser(connectString);
         hostProvider = aHostProvider;
 
-        cnxn = createConnection(connectStringParser.getChrootPath(),
-                hostProvider, sessionTimeout, this, watchManager,
-                getClientCnxnSocket(), canBeReadOnly);
+        cnxn = createConnection(
+            connectStringParser.getChrootPath(),
+            hostProvider,
+            sessionTimeout,
+            this,
+            watchManager,
+            getClientCnxnSocket(),
+            canBeReadOnly);
         cnxn.start();
     }
 
     // @VisibleForTesting
-    protected ClientCnxn createConnection(String chrootPath,
-            HostProvider hostProvider, int sessionTimeout, ZooKeeper zooKeeper,
-            ClientWatchManager watcher, ClientCnxnSocket clientCnxnSocket,
-            boolean canBeReadOnly) throws IOException {
-        return new ClientCnxn(chrootPath, hostProvider, sessionTimeout, this,
-                watchManager, clientCnxnSocket, canBeReadOnly);
+    protected ClientCnxn createConnection(
+        String chrootPath,
+        HostProvider hostProvider,
+        int sessionTimeout,
+        ZooKeeper zooKeeper,
+        ClientWatchManager watcher,
+        ClientCnxnSocket clientCnxnSocket,
+        boolean canBeReadOnly) throws IOException {
+        return new ClientCnxn(
+            chrootPath,
+            hostProvider,
+            sessionTimeout,
+            this,
+            watchManager,
+            clientCnxnSocket,
+            canBeReadOnly);
     }
 
     /**
@@ -950,10 +974,12 @@ public class ZooKeeper implements AutoCloseable {
      * @throws IllegalArgumentException
      *             if an invalid chroot path is specified
      */
-    public ZooKeeper(String connectString, int sessionTimeout, Watcher watcher,
-            boolean canBeReadOnly) throws IOException {
-        this(connectString, sessionTimeout, watcher, canBeReadOnly,
-                createDefaultHostProvider(connectString));
+    public ZooKeeper(
+        String connectString,
+        int sessionTimeout,
+        Watcher watcher,
+        boolean canBeReadOnly) throws IOException {
+        this(connectString, sessionTimeout, watcher, canBeReadOnly, createDefaultHostProvider(connectString));
     }
 
     /**
@@ -1010,10 +1036,19 @@ public class ZooKeeper implements AutoCloseable {
      * @throws IllegalArgumentException
      *             if an invalid chroot path is specified
      */
-    public ZooKeeper(String connectString, int sessionTimeout, Watcher watcher,
-            boolean canBeReadOnly, ZKClientConfig conf) throws IOException {
-        this(connectString, sessionTimeout, watcher, canBeReadOnly,
-                createDefaultHostProvider(connectString), conf);
+    public ZooKeeper(
+        String connectString,
+        int sessionTimeout,
+        Watcher watcher,
+        boolean canBeReadOnly,
+        ZKClientConfig conf) throws IOException {
+        this(
+            connectString,
+            sessionTimeout,
+            watcher,
+            canBeReadOnly,
+            createDefaultHostProvider(connectString),
+            conf);
     }
 
     /**
@@ -1068,10 +1103,12 @@ public class ZooKeeper implements AutoCloseable {
      * @throws IllegalArgumentException if an invalid chroot path is specified
      * @throws IllegalArgumentException for an invalid list of ZooKeeper hosts
      */
-    public ZooKeeper(String connectString, int sessionTimeout, Watcher watcher,
-            long sessionId, byte[] sessionPasswd)
-        throws IOException
-    {
+    public ZooKeeper(
+        String connectString,
+        int sessionTimeout,
+        Watcher watcher,
+        long sessionId,
+        byte[] sessionPasswd) throws IOException {
         this(connectString, sessionTimeout, watcher, sessionId, sessionPasswd, false);
     }
 
@@ -1139,11 +1176,23 @@ public class ZooKeeper implements AutoCloseable {
      * @throws IOException in cases of network failure
      * @throws IllegalArgumentException if an invalid chroot path is specified
      */
-    public ZooKeeper(String connectString, int sessionTimeout, Watcher watcher,
-            long sessionId, byte[] sessionPasswd, boolean canBeReadOnly,
-            HostProvider aHostProvider) throws IOException {
-    	this(connectString, sessionTimeout, watcher, sessionId, sessionPasswd,
-    			canBeReadOnly, aHostProvider, null);
+    public ZooKeeper(
+        String connectString,
+        int sessionTimeout,
+        Watcher watcher,
+        long sessionId,
+        byte[] sessionPasswd,
+        boolean canBeReadOnly,
+        HostProvider aHostProvider) throws IOException {
+        this(
+            connectString,
+            sessionTimeout,
+            watcher,
+            sessionId,
+            sessionPasswd,
+            canBeReadOnly,
+            aHostProvider,
+            null);
     }
 
     /**
@@ -1215,15 +1264,20 @@ public class ZooKeeper implements AutoCloseable {
      *
      * @since 3.5.5
      */
-    public ZooKeeper(String connectString, int sessionTimeout, Watcher watcher,
-    		long sessionId, byte[] sessionPasswd, boolean canBeReadOnly,
-    		HostProvider aHostProvider, ZKClientConfig clientConfig) throws IOException {
-    	LOG.info("Initiating client connection, connectString=" + connectString
-    			+ " sessionTimeout=" + sessionTimeout
-    			+ " watcher=" + watcher
-    			+ " sessionId=" + Long.toHexString(sessionId)
-    			+ " sessionPasswd="
-    			+ (sessionPasswd == null ? "<null>" : "<hidden>"));
+    public ZooKeeper(
+        String connectString,
+        int sessionTimeout,
+        Watcher watcher,
+        long sessionId,
+        byte[] sessionPasswd,
+        boolean canBeReadOnly,
+        HostProvider aHostProvider,
+        ZKClientConfig clientConfig) throws IOException {
+        LOG.info("Initiating client connection, connectString=" + connectString
+                 + " sessionTimeout=" + sessionTimeout
+                 + " watcher=" + watcher
+                 + " sessionId=" + Long.toHexString(sessionId)
+                 + " sessionPasswd=" + (sessionPasswd == null ? "<null>" : "<hidden>"));
 
         if (clientConfig == null) {
             clientConfig = new ZKClientConfig();
@@ -1232,13 +1286,19 @@ public class ZooKeeper implements AutoCloseable {
         watchManager = defaultWatchManager();
         watchManager.defaultWatcher = watcher;
 
-        ConnectStringParser connectStringParser = new ConnectStringParser(
-                connectString);
+        ConnectStringParser connectStringParser = new ConnectStringParser(connectString);
         hostProvider = aHostProvider;
 
-        cnxn = new ClientCnxn(connectStringParser.getChrootPath(),
-                hostProvider, sessionTimeout, this, watchManager,
-                getClientCnxnSocket(), sessionId, sessionPasswd, canBeReadOnly);
+        cnxn = new ClientCnxn(
+            connectStringParser.getChrootPath(),
+            hostProvider,
+            sessionTimeout,
+            this,
+            watchManager,
+            getClientCnxnSocket(),
+            sessionId,
+            sessionPasswd,
+            canBeReadOnly);
         cnxn.seenRwServerBefore = true; // since user has provided sessionId
         cnxn.start();
     }
@@ -1304,17 +1364,26 @@ public class ZooKeeper implements AutoCloseable {
      * @throws IOException in cases of network failure
      * @throws IllegalArgumentException if an invalid chroot path is specified
      */
-    public ZooKeeper(String connectString, int sessionTimeout, Watcher watcher,
-            long sessionId, byte[] sessionPasswd, boolean canBeReadOnly)
-            throws IOException {
-        this(connectString, sessionTimeout, watcher, sessionId, sessionPasswd,
-                canBeReadOnly, createDefaultHostProvider(connectString));
+    public ZooKeeper(
+        String connectString,
+        int sessionTimeout,
+        Watcher watcher,
+        long sessionId,
+        byte[] sessionPasswd,
+        boolean canBeReadOnly) throws IOException {
+        this(
+            connectString,
+            sessionTimeout,
+            watcher,
+            sessionId,
+            sessionPasswd,
+            canBeReadOnly,
+            createDefaultHostProvider(connectString));
     }
 
     // default hostprovider
     private static HostProvider createDefaultHostProvider(String connectString) {
-        return new StaticHostProvider(
-                new ConnectStringParser(connectString).getServerAddresses());
+        return new StaticHostProvider(new ConnectStringParser(connectString).getServerAddresses());
     }
 
     // VisibleForTesting
@@ -1374,7 +1443,7 @@ public class ZooKeeper implements AutoCloseable {
      * @param scheme
      * @param auth
      */
-    public void addAuthInfo(String scheme, byte auth[]) {
+    public void addAuthInfo(String scheme, byte[] auth) {
         cnxn.addAuthInfo(scheme, auth);
     }
 
@@ -1513,10 +1582,11 @@ public class ZooKeeper implements AutoCloseable {
      * @throws InterruptedException if the transaction is interrupted
      * @throws IllegalArgumentException if an invalid path is specified
      */
-    public String create(final String path, byte data[], List<ACL> acl,
-            CreateMode createMode)
-        throws KeeperException, InterruptedException
-    {
+    public String create(
+        final String path,
+        byte[] data,
+        List<ACL> acl,
+        CreateMode createMode) throws KeeperException, InterruptedException {
         final String clientPath = path;
         PathUtils.validatePath(clientPath, createMode.isSequential());
         EphemeralType.validateTTL(createMode, -1);
@@ -1534,8 +1604,7 @@ public class ZooKeeper implements AutoCloseable {
         request.setAcl(acl);
         ReplyHeader r = cnxn.submitRequest(h, request, response, null);
         if (r.getErr() != 0) {
-            throw KeeperException.create(KeeperException.Code.get(r.getErr()),
-                    clientPath);
+            throw KeeperException.create(KeeperException.Code.get(r.getErr()), clientPath);
         }
         if (cnxn.chrootPath == null) {
             return response.getPath();
@@ -1601,9 +1670,12 @@ public class ZooKeeper implements AutoCloseable {
      * @throws InterruptedException if the transaction is interrupted
      * @throws IllegalArgumentException if an invalid path is specified
      */
-    public String create(final String path, byte data[], List<ACL> acl,
-            CreateMode createMode, Stat stat)
-            throws KeeperException, InterruptedException {
+    public String create(
+        final String path,
+        byte[] data,
+        List<ACL> acl,
+        CreateMode createMode,
+        Stat stat) throws KeeperException, InterruptedException {
         return create(path, data, acl, createMode, stat, -1);
     }
 
@@ -1615,9 +1687,13 @@ public class ZooKeeper implements AutoCloseable {
      * milliseconds and must be greater than 0 and less than or equal to
      * {@link EphemeralType#maxValue()} for {@link EphemeralType#TTL}.
      */
-    public String create(final String path, byte data[], List<ACL> acl,
-            CreateMode createMode, Stat stat, long ttl)
-            throws KeeperException, InterruptedException {
+    public String create(
+        final String path,
+        byte[] data,
+        List<ACL> acl,
+        CreateMode createMode,
+        Stat stat,
+        long ttl) throws KeeperException, InterruptedException {
         final String clientPath = path;
         PathUtils.validatePath(clientPath, createMode.isSequential());
         EphemeralType.validateTTL(createMode, ttl);
@@ -1631,8 +1707,7 @@ public class ZooKeeper implements AutoCloseable {
         Record record = makeCreateRecord(createMode, serverPath, data, acl, ttl);
         ReplyHeader r = cnxn.submitRequest(h, record, response, null);
         if (r.getErr() != 0) {
-            throw KeeperException.create(KeeperException.Code.get(r.getErr()),
-                    clientPath);
+            throw KeeperException.create(KeeperException.Code.get(r.getErr()), clientPath);
         }
         if (stat != null) {
             DataTree.copyStat(response.getStat(), stat);
@@ -1678,9 +1753,13 @@ public class ZooKeeper implements AutoCloseable {
      *
      * @see #create(String, byte[], List, CreateMode)
      */
-    public void create(final String path, byte data[], List<ACL> acl,
-            CreateMode createMode, StringCallback cb, Object ctx)
-    {
+    public void create(
+        final String path,
+        byte[] data,
+        List<ACL> acl,
+        CreateMode createMode,
+        StringCallback cb,
+        Object ctx) {
         final String clientPath = path;
         PathUtils.validatePath(clientPath, createMode.isSequential());
         EphemeralType.validateTTL(createMode, -1);
@@ -1696,8 +1775,7 @@ public class ZooKeeper implements AutoCloseable {
         request.setFlags(createMode.toFlag());
         request.setPath(serverPath);
         request.setAcl(acl);
-        cnxn.queuePacket(h, r, request, response, cb, clientPath,
-                serverPath, ctx, null);
+        cnxn.queuePacket(h, r, request, response, cb, clientPath, serverPath, ctx, null);
     }
 
     /**
@@ -1705,9 +1783,13 @@ public class ZooKeeper implements AutoCloseable {
      *
      * @see #create(String, byte[], List, CreateMode, Stat)
      */
-    public void create(final String path, byte data[], List<ACL> acl,
-            CreateMode createMode, Create2Callback cb, Object ctx)
-    {
+    public void create(
+        final String path,
+        byte[] data,
+        List<ACL> acl,
+        CreateMode createMode,
+        Create2Callback cb,
+        Object ctx) {
         create(path, data, acl, createMode, cb, ctx, -1);
     }
 
@@ -1716,9 +1798,14 @@ public class ZooKeeper implements AutoCloseable {
      *
      * @see #create(String, byte[], List, CreateMode, Stat, long)
      */
-    public void create(final String path, byte data[], List<ACL> acl,
-            CreateMode createMode, Create2Callback cb, Object ctx, long ttl)
-    {
+    public void create(
+        final String path,
+        byte[] data,
+        List<ACL> acl,
+        CreateMode createMode,
+        Create2Callback cb,
+        Object ctx,
+        long ttl) {
         final String clientPath = path;
         PathUtils.validatePath(clientPath, createMode.isSequential());
         EphemeralType.validateTTL(createMode, ttl);
@@ -1730,8 +1817,7 @@ public class ZooKeeper implements AutoCloseable {
         ReplyHeader r = new ReplyHeader();
         Create2Response response = new Create2Response();
         Record record = makeCreateRecord(createMode, serverPath, data, acl, ttl);
-        cnxn.queuePacket(h, r, record, response, cb, clientPath,
-                serverPath, ctx, null);
+        cnxn.queuePacket(h, r, record, response, cb, clientPath, serverPath, ctx, null);
     }
 
     /**
@@ -1761,9 +1847,7 @@ public class ZooKeeper implements AutoCloseable {
      *   return code.
      * @throws IllegalArgumentException if an invalid path is specified
      */
-    public void delete(final String path, int version)
-        throws InterruptedException, KeeperException
-    {
+    public void delete(final String path, int version) throws InterruptedException, KeeperException {
         final String clientPath = path;
         PathUtils.validatePath(clientPath);
 
@@ -1787,8 +1871,7 @@ public class ZooKeeper implements AutoCloseable {
         request.setVersion(version);
         ReplyHeader r = cnxn.submitRequest(h, request, null, null);
         if (r.getErr() != 0) {
-            throw KeeperException.create(KeeperException.Code.get(r.getErr()),
-                    clientPath);
+            throw KeeperException.create(KeeperException.Code.get(r.getErr()), clientPath);
         }
     }
 
@@ -1835,8 +1918,7 @@ public class ZooKeeper implements AutoCloseable {
     public void multi(Iterable<Op> ops, MultiCallback cb, Object ctx) {
         List<OpResult> results = validatePath(ops);
         if (results.size() > 0) {
-            cb.processResult(KeeperException.Code.BADARGUMENTS.intValue(),
-                    null, ctx, results);
+            cb.processResult(KeeperException.Code.BADARGUMENTS.intValue(), null, ctx, results);
             return;
         }
         multiInternal(generateMultiTransaction(ops), cb, ctx);
@@ -1850,8 +1932,7 @@ public class ZooKeeper implements AutoCloseable {
                 op.validate();
             } catch (IllegalArgumentException iae) {
                 LOG.error("IllegalArgumentException: " + iae.getMessage());
-                ErrorResult err = new ErrorResult(
-                        KeeperException.Code.BADARGUMENTS.intValue());
+                ErrorResult err = new ErrorResult(KeeperException.Code.BADARGUMENTS.intValue());
                 results.add(err);
                 error = true;
                 continue;
@@ -1862,11 +1943,10 @@ public class ZooKeeper implements AutoCloseable {
                 error = true;
                 continue;
             }
-            ErrorResult err = new ErrorResult(
-                    KeeperException.Code.RUNTIMEINCONSISTENCY.intValue());
+            ErrorResult err = new ErrorResult(KeeperException.Code.RUNTIMEINCONSISTENCY.intValue());
             results.add(err);
         }
-        if (false == error) {
+        if (!error) {
             results.clear();
         }
         return results;
@@ -1891,27 +1971,37 @@ public class ZooKeeper implements AutoCloseable {
         return op;
     }
 
-    protected void multiInternal(MultiOperationRecord request, MultiCallback cb, Object ctx)
-            throws IllegalArgumentException {
+    protected void multiInternal(
+        MultiOperationRecord request,
+        MultiCallback cb,
+        Object ctx) throws IllegalArgumentException {
         RequestHeader h = new RequestHeader();
         switch (request.getOpKind()) {
-            case TRANSACTION: h.setType(ZooDefs.OpCode.multi); break;
-            case READ: h.setType(ZooDefs.OpCode.multiRead); break;
-            default:
-                throw new IllegalArgumentException("Unsupported OpKind: " + request.getOpKind());
+        case TRANSACTION:
+            h.setType(ZooDefs.OpCode.multi);
+            break;
+        case READ:
+            h.setType(ZooDefs.OpCode.multiRead);
+            break;
+        default:
+            throw new IllegalArgumentException("Unsupported OpKind: " + request.getOpKind());
         }
         MultiResponse response = new MultiResponse();
         cnxn.queuePacket(h, new ReplyHeader(), request, response, cb, null, null, ctx, null);
     }
 
-    protected List<OpResult> multiInternal(MultiOperationRecord request)
-        throws InterruptedException, KeeperException, IllegalArgumentException {
+    protected List<OpResult> multiInternal(
+        MultiOperationRecord request) throws InterruptedException, KeeperException, IllegalArgumentException {
         RequestHeader h = new RequestHeader();
         switch (request.getOpKind()) {
-            case TRANSACTION: h.setType(ZooDefs.OpCode.multi); break;
-            case READ: h.setType(ZooDefs.OpCode.multiRead); break;
-            default:
-                throw new IllegalArgumentException("Unsupported OpKind: " + request.getOpKind());
+        case TRANSACTION:
+            h.setType(ZooDefs.OpCode.multi);
+            break;
+        case READ:
+            h.setType(ZooDefs.OpCode.multiRead);
+            break;
+        default:
+            throw new IllegalArgumentException("Unsupported OpKind: " + request.getOpKind());
         }
         MultiResponse response = new MultiResponse();
         ReplyHeader r = cnxn.submitRequest(h, request, response, null);
@@ -1928,7 +2018,8 @@ public class ZooKeeper implements AutoCloseable {
 
         ErrorResult fatalError = null;
         for (OpResult result : results) {
-            if (result instanceof ErrorResult && ((ErrorResult)result).getErr() != KeeperException.Code.OK.intValue()) {
+            if (result instanceof ErrorResult
+                && ((ErrorResult) result).getErr() != KeeperException.Code.OK.intValue()) {
                 fatalError = (ErrorResult) result;
                 break;
             }
@@ -1961,9 +2052,7 @@ public class ZooKeeper implements AutoCloseable {
      *
      * @see #delete(String, int)
      */
-    public void delete(final String path, int version, VoidCallback cb,
-            Object ctx)
-    {
+    public void delete(final String path, int version, VoidCallback cb, Object ctx) {
         final String clientPath = path;
         PathUtils.validatePath(clientPath);
 
@@ -1985,8 +2074,7 @@ public class ZooKeeper implements AutoCloseable {
         DeleteRequest request = new DeleteRequest();
         request.setPath(serverPath);
         request.setVersion(version);
-        cnxn.queuePacket(h, new ReplyHeader(), request, null, cb, clientPath,
-                serverPath, ctx, null);
+        cnxn.queuePacket(h, new ReplyHeader(), request, null, cb, clientPath, serverPath, ctx, null);
     }
 
     /**
@@ -2006,9 +2094,7 @@ public class ZooKeeper implements AutoCloseable {
      * @throws InterruptedException If the server transaction is interrupted.
      * @throws IllegalArgumentException if an invalid path is specified
      */
-    public Stat exists(final String path, Watcher watcher)
-        throws KeeperException, InterruptedException
-    {
+    public Stat exists(final String path, Watcher watcher) throws KeeperException, InterruptedException {
         final String clientPath = path;
         PathUtils.validatePath(clientPath);
 
@@ -2031,8 +2117,7 @@ public class ZooKeeper implements AutoCloseable {
             if (r.getErr() == KeeperException.Code.NONODE.intValue()) {
                 return null;
             }
-            throw KeeperException.create(KeeperException.Code.get(r.getErr()),
-                    clientPath);
+            throw KeeperException.create(KeeperException.Code.get(r.getErr()), clientPath);
         }
 
         return response.getStat().getCzxid() == -1 ? null : response.getStat();
@@ -2056,9 +2141,7 @@ public class ZooKeeper implements AutoCloseable {
      * @throws KeeperException If the server signals an error
      * @throws InterruptedException If the server transaction is interrupted.
      */
-    public Stat exists(String path, boolean watch) throws KeeperException,
-        InterruptedException
-    {
+    public Stat exists(String path, boolean watch) throws KeeperException, InterruptedException {
         return exists(path, watch ? watchManager.defaultWatcher : null);
     }
 
@@ -2067,9 +2150,7 @@ public class ZooKeeper implements AutoCloseable {
      *
      * @see #exists(String, Watcher)
      */
-    public void exists(final String path, Watcher watcher,
-            StatCallback cb, Object ctx)
-    {
+    public void exists(final String path, Watcher watcher, StatCallback cb, Object ctx) {
         final String clientPath = path;
         PathUtils.validatePath(clientPath);
 
@@ -2087,8 +2168,7 @@ public class ZooKeeper implements AutoCloseable {
         request.setPath(serverPath);
         request.setWatch(watcher != null);
         SetDataResponse response = new SetDataResponse();
-        cnxn.queuePacket(h, new ReplyHeader(), request, response, cb,
-                clientPath, serverPath, ctx, wcb);
+        cnxn.queuePacket(h, new ReplyHeader(), request, response, cb, clientPath, serverPath, ctx, wcb);
     }
 
     /**
@@ -2119,9 +2199,7 @@ public class ZooKeeper implements AutoCloseable {
      * @throws InterruptedException If the server transaction is interrupted.
      * @throws IllegalArgumentException if an invalid path is specified
      */
-    public byte[] getData(final String path, Watcher watcher, Stat stat)
-        throws KeeperException, InterruptedException
-     {
+    public byte[] getData(final String path, Watcher watcher, Stat stat) throws KeeperException, InterruptedException {
         final String clientPath = path;
         PathUtils.validatePath(clientPath);
 
@@ -2141,8 +2219,7 @@ public class ZooKeeper implements AutoCloseable {
         GetDataResponse response = new GetDataResponse();
         ReplyHeader r = cnxn.submitRequest(h, request, response, wcb);
         if (r.getErr() != 0) {
-            throw KeeperException.create(KeeperException.Code.get(r.getErr()),
-                    clientPath);
+            throw KeeperException.create(KeeperException.Code.get(r.getErr()), clientPath);
         }
         if (stat != null) {
             DataTree.copyStat(response.getStat(), stat);
@@ -2168,8 +2245,7 @@ public class ZooKeeper implements AutoCloseable {
      * @throws KeeperException If the server signals an error with a non-zero error code
      * @throws InterruptedException If the server transaction is interrupted.
      */
-    public byte[] getData(String path, boolean watch, Stat stat)
-            throws KeeperException, InterruptedException {
+    public byte[] getData(String path, boolean watch, Stat stat) throws KeeperException, InterruptedException {
         return getData(path, watch ? watchManager.defaultWatcher : null, stat);
     }
 
@@ -2178,9 +2254,7 @@ public class ZooKeeper implements AutoCloseable {
      *
      * @see #getData(String, Watcher, Stat)
      */
-    public void getData(final String path, Watcher watcher,
-            DataCallback cb, Object ctx)
-    {
+    public void getData(final String path, Watcher watcher, DataCallback cb, Object ctx) {
         final String clientPath = path;
         PathUtils.validatePath(clientPath);
 
@@ -2198,8 +2272,7 @@ public class ZooKeeper implements AutoCloseable {
         request.setPath(serverPath);
         request.setWatch(watcher != null);
         GetDataResponse response = new GetDataResponse();
-        cnxn.queuePacket(h, new ReplyHeader(), request, response, cb,
-                clientPath, serverPath, ctx, wcb);
+        cnxn.queuePacket(h, new ReplyHeader(), request, response, cb, clientPath, serverPath, ctx, wcb);
     }
 
     /**
@@ -2228,11 +2301,9 @@ public class ZooKeeper implements AutoCloseable {
      * @throws KeeperException If the server signals an error with a non-zero error code
      * @throws InterruptedException If the server transaction is interrupted.
      */
-    public byte[] getConfig(Watcher watcher, Stat stat)
-        throws KeeperException, InterruptedException
-     {
+    public byte[] getConfig(Watcher watcher, Stat stat) throws KeeperException, InterruptedException {
         final String configZnode = ZooDefs.CONFIG_NODE;
- 
+
         // the watch contains the un-chroot path
         WatchRegistration wcb = null;
         if (watcher != null) {
@@ -2247,8 +2318,7 @@ public class ZooKeeper implements AutoCloseable {
         GetDataResponse response = new GetDataResponse();
         ReplyHeader r = cnxn.submitRequest(h, request, response, wcb);
         if (r.getErr() != 0) {
-            throw KeeperException.create(KeeperException.Code.get(r.getErr()),
-                   configZnode);
+            throw KeeperException.create(KeeperException.Code.get(r.getErr()), configZnode);
         }
         if (stat != null) {
             DataTree.copyStat(response.getStat(), stat);
@@ -2261,11 +2331,9 @@ public class ZooKeeper implements AutoCloseable {
      *
      * @see #getConfig(Watcher, Stat)
      */
-    public void getConfig(Watcher watcher,
-            DataCallback cb, Object ctx)
-    {
+    public void getConfig(Watcher watcher, DataCallback cb, Object ctx) {
         final String configZnode = ZooDefs.CONFIG_NODE;
-        
+
         // the watch contains the un-chroot path
         WatchRegistration wcb = null;
         if (watcher != null) {
@@ -2278,11 +2346,9 @@ public class ZooKeeper implements AutoCloseable {
         request.setPath(configZnode);
         request.setWatch(watcher != null);
         GetDataResponse response = new GetDataResponse();
-        cnxn.queuePacket(h, new ReplyHeader(), request, response, cb,
-               configZnode, configZnode, ctx, wcb);
+        cnxn.queuePacket(h, new ReplyHeader(), request, response, cb, configZnode, configZnode, ctx, wcb);
     }
 
-    
     /**
      * Return the last committed configuration (as known to the server to which the client is connected)
      * and the stat of the configuration.
@@ -2300,20 +2366,19 @@ public class ZooKeeper implements AutoCloseable {
      * @throws KeeperException If the server signals an error with a non-zero error code
      * @throws InterruptedException If the server transaction is interrupted.
      */
-    public byte[] getConfig(boolean watch, Stat stat)
-            throws KeeperException, InterruptedException {
+    public byte[] getConfig(boolean watch, Stat stat) throws KeeperException, InterruptedException {
         return getConfig(watch ? watchManager.defaultWatcher : null, stat);
     }
- 
+
     /**
-     * The Asynchronous version of getConfig. 
-     * 
+     * The Asynchronous version of getConfig.
+     *
      * @see #getData(String, boolean, Stat)
      */
     public void getConfig(boolean watch, DataCallback cb, Object ctx) {
         getConfig(watch ? watchManager.defaultWatcher : null, cb, ctx);
     }
-   
+
     /**
      * Set the data for the node of the given path if such a node exists and the
      * given version matches the version of the node (if the given version is
@@ -2342,9 +2407,7 @@ public class ZooKeeper implements AutoCloseable {
      * @throws KeeperException If the server signals an error with a non-zero error code.
      * @throws IllegalArgumentException if an invalid path is specified
      */
-    public Stat setData(final String path, byte data[], int version)
-        throws KeeperException, InterruptedException
-    {
+    public Stat setData(final String path, byte[] data, int version) throws KeeperException, InterruptedException {
         final String clientPath = path;
         PathUtils.validatePath(clientPath);
 
@@ -2359,8 +2422,7 @@ public class ZooKeeper implements AutoCloseable {
         SetDataResponse response = new SetDataResponse();
         ReplyHeader r = cnxn.submitRequest(h, request, response, null);
         if (r.getErr() != 0) {
-            throw KeeperException.create(KeeperException.Code.get(r.getErr()),
-                    clientPath);
+            throw KeeperException.create(KeeperException.Code.get(r.getErr()), clientPath);
         }
         return response.getStat();
     }
@@ -2370,9 +2432,7 @@ public class ZooKeeper implements AutoCloseable {
      *
      * @see #setData(String, byte[], int)
      */
-    public void setData(final String path, byte data[], int version,
-            StatCallback cb, Object ctx)
-    {
+    public void setData(final String path, byte[] data, int version, StatCallback cb, Object ctx) {
         final String clientPath = path;
         PathUtils.validatePath(clientPath);
 
@@ -2385,8 +2445,7 @@ public class ZooKeeper implements AutoCloseable {
         request.setData(data);
         request.setVersion(version);
         SetDataResponse response = new SetDataResponse();
-        cnxn.queuePacket(h, new ReplyHeader(), request, response, cb,
-                clientPath, serverPath, ctx, null);
+        cnxn.queuePacket(h, new ReplyHeader(), request, response, cb, clientPath, serverPath, ctx, null);
     }
 
     /**
@@ -2405,9 +2464,7 @@ public class ZooKeeper implements AutoCloseable {
      * @throws KeeperException If the server signals an error with a non-zero error code.
      * @throws IllegalArgumentException if an invalid path is specified
      */
-    public List<ACL> getACL(final String path, Stat stat)
-        throws KeeperException, InterruptedException
-    {
+    public List<ACL> getACL(final String path, Stat stat) throws KeeperException, InterruptedException {
         final String clientPath = path;
         PathUtils.validatePath(clientPath);
 
@@ -2420,8 +2477,7 @@ public class ZooKeeper implements AutoCloseable {
         GetACLResponse response = new GetACLResponse();
         ReplyHeader r = cnxn.submitRequest(h, request, response, null);
         if (r.getErr() != 0) {
-            throw KeeperException.create(KeeperException.Code.get(r.getErr()),
-                    clientPath);
+            throw KeeperException.create(KeeperException.Code.get(r.getErr()), clientPath);
         }
         if (stat != null) {
             DataTree.copyStat(response.getStat(), stat);
@@ -2434,9 +2490,7 @@ public class ZooKeeper implements AutoCloseable {
      *
      * @see #getACL(String, Stat)
      */
-    public void getACL(final String path, Stat stat, ACLCallback cb,
-            Object ctx)
-    {
+    public void getACL(final String path, Stat stat, ACLCallback cb, Object ctx) {
         final String clientPath = path;
         PathUtils.validatePath(clientPath);
 
@@ -2447,8 +2501,7 @@ public class ZooKeeper implements AutoCloseable {
         GetACLRequest request = new GetACLRequest();
         request.setPath(serverPath);
         GetACLResponse response = new GetACLResponse();
-        cnxn.queuePacket(h, new ReplyHeader(), request, response, cb,
-                clientPath, serverPath, ctx, null);
+        cnxn.queuePacket(h, new ReplyHeader(), request, response, cb, clientPath, serverPath, ctx, null);
     }
 
     /**
@@ -2471,9 +2524,7 @@ public class ZooKeeper implements AutoCloseable {
      * @throws org.apache.zookeeper.KeeperException.InvalidACLException If the acl is invalide.
      * @throws IllegalArgumentException if an invalid path is specified
      */
-    public Stat setACL(final String path, List<ACL> acl, int aclVersion)
-        throws KeeperException, InterruptedException
-    {
+    public Stat setACL(final String path, List<ACL> acl, int aclVersion) throws KeeperException, InterruptedException {
         final String clientPath = path;
         PathUtils.validatePath(clientPath);
         validateACL(acl);
@@ -2489,8 +2540,7 @@ public class ZooKeeper implements AutoCloseable {
         SetACLResponse response = new SetACLResponse();
         ReplyHeader r = cnxn.submitRequest(h, request, response, null);
         if (r.getErr() != 0) {
-            throw KeeperException.create(KeeperException.Code.get(r.getErr()),
-                    clientPath);
+            throw KeeperException.create(KeeperException.Code.get(r.getErr()), clientPath);
         }
         return response.getStat();
     }
@@ -2500,9 +2550,7 @@ public class ZooKeeper implements AutoCloseable {
      *
      * @see #setACL(String, List, int)
      */
-    public void setACL(final String path, List<ACL> acl, int version,
-            StatCallback cb, Object ctx)
-    {
+    public void setACL(final String path, List<ACL> acl, int version, StatCallback cb, Object ctx) {
         final String clientPath = path;
         PathUtils.validatePath(clientPath);
 
@@ -2515,8 +2563,7 @@ public class ZooKeeper implements AutoCloseable {
         request.setAcl(acl);
         request.setVersion(version);
         SetACLResponse response = new SetACLResponse();
-        cnxn.queuePacket(h, new ReplyHeader(), request, response, cb,
-                clientPath, serverPath, ctx, null);
+        cnxn.queuePacket(h, new ReplyHeader(), request, response, cb, clientPath, serverPath, ctx, null);
     }
 
     /**
@@ -2540,9 +2587,7 @@ public class ZooKeeper implements AutoCloseable {
      * @throws KeeperException If the server signals an error with a non-zero error code.
      * @throws IllegalArgumentException if an invalid path is specified
      */
-    public List<String> getChildren(final String path, Watcher watcher)
-        throws KeeperException, InterruptedException
-    {
+    public List<String> getChildren(final String path, Watcher watcher) throws KeeperException, InterruptedException {
         final String clientPath = path;
         PathUtils.validatePath(clientPath);
 
@@ -2562,8 +2607,7 @@ public class ZooKeeper implements AutoCloseable {
         GetChildrenResponse response = new GetChildrenResponse();
         ReplyHeader r = cnxn.submitRequest(h, request, response, wcb);
         if (r.getErr() != 0) {
-            throw KeeperException.create(KeeperException.Code.get(r.getErr()),
-                    clientPath);
+            throw KeeperException.create(KeeperException.Code.get(r.getErr()), clientPath);
         }
         return response.getChildren();
     }
@@ -2588,8 +2632,7 @@ public class ZooKeeper implements AutoCloseable {
      * @throws InterruptedException If the server transaction is interrupted.
      * @throws KeeperException If the server signals an error with a non-zero error code.
      */
-    public List<String> getChildren(String path, boolean watch)
-            throws KeeperException, InterruptedException {
+    public List<String> getChildren(String path, boolean watch) throws KeeperException, InterruptedException {
         return getChildren(path, watch ? watchManager.defaultWatcher : null);
     }
 
@@ -2598,9 +2641,7 @@ public class ZooKeeper implements AutoCloseable {
      *
      * @see #getChildren(String, Watcher)
      */
-    public void getChildren(final String path, Watcher watcher,
-            ChildrenCallback cb, Object ctx)
-    {
+    public void getChildren(final String path, Watcher watcher, ChildrenCallback cb, Object ctx) {
         final String clientPath = path;
         PathUtils.validatePath(clientPath);
 
@@ -2618,8 +2659,7 @@ public class ZooKeeper implements AutoCloseable {
         request.setPath(serverPath);
         request.setWatch(watcher != null);
         GetChildrenResponse response = new GetChildrenResponse();
-        cnxn.queuePacket(h, new ReplyHeader(), request, response, cb,
-                clientPath, serverPath, ctx, wcb);
+        cnxn.queuePacket(h, new ReplyHeader(), request, response, cb, clientPath, serverPath, ctx, wcb);
     }
 
     /**
@@ -2627,9 +2667,7 @@ public class ZooKeeper implements AutoCloseable {
      *
      * @see #getChildren(String, boolean)
      */
-    public void getChildren(String path, boolean watch, ChildrenCallback cb,
-            Object ctx)
-    {
+    public void getChildren(String path, boolean watch, ChildrenCallback cb, Object ctx) {
         getChildren(path, watch ? watchManager.defaultWatcher : null, cb, ctx);
     }
 
@@ -2648,7 +2686,7 @@ public class ZooKeeper implements AutoCloseable {
      * if no node with the given path exists.
      *
      * @since 3.3.0
-     * 
+     *
      * @param path
      * @param watcher explicit watcher
      * @param stat stat of the znode designated by path
@@ -2657,10 +2695,10 @@ public class ZooKeeper implements AutoCloseable {
      * @throws KeeperException If the server signals an error with a non-zero error code.
      * @throws IllegalArgumentException if an invalid path is specified
      */
-    public List<String> getChildren(final String path, Watcher watcher,
-            Stat stat)
-        throws KeeperException, InterruptedException
-    {
+    public List<String> getChildren(
+        final String path,
+        Watcher watcher,
+        Stat stat) throws KeeperException, InterruptedException {
         final String clientPath = path;
         PathUtils.validatePath(clientPath);
 
@@ -2680,8 +2718,7 @@ public class ZooKeeper implements AutoCloseable {
         GetChildren2Response response = new GetChildren2Response();
         ReplyHeader r = cnxn.submitRequest(h, request, response, wcb);
         if (r.getErr() != 0) {
-            throw KeeperException.create(KeeperException.Code.get(r.getErr()),
-                    clientPath);
+            throw KeeperException.create(KeeperException.Code.get(r.getErr()), clientPath);
         }
         if (stat != null) {
             DataTree.copyStat(response.getStat(), stat);
@@ -2704,7 +2741,7 @@ public class ZooKeeper implements AutoCloseable {
      * if no node with the given path exists.
      *
      * @since 3.3.0
-     * 
+     *
      * @param path
      * @param watch
      * @param stat stat of the znode designated by path
@@ -2713,22 +2750,21 @@ public class ZooKeeper implements AutoCloseable {
      * @throws KeeperException If the server signals an error with a non-zero
      *  error code.
      */
-    public List<String> getChildren(String path, boolean watch, Stat stat)
-            throws KeeperException, InterruptedException {
-        return getChildren(path, watch ? watchManager.defaultWatcher : null,
-                stat);
+    public List<String> getChildren(
+        String path,
+        boolean watch,
+        Stat stat) throws KeeperException, InterruptedException {
+        return getChildren(path, watch ? watchManager.defaultWatcher : null, stat);
     }
 
     /**
      * The asynchronous version of getChildren.
      *
      * @since 3.3.0
-     * 
+     *
      * @see #getChildren(String, Watcher, Stat)
      */
-    public void getChildren(final String path, Watcher watcher,
-            Children2Callback cb, Object ctx)
-    {
+    public void getChildren(final String path, Watcher watcher, Children2Callback cb, Object ctx) {
         final String clientPath = path;
         PathUtils.validatePath(clientPath);
 
@@ -2746,20 +2782,17 @@ public class ZooKeeper implements AutoCloseable {
         request.setPath(serverPath);
         request.setWatch(watcher != null);
         GetChildren2Response response = new GetChildren2Response();
-        cnxn.queuePacket(h, new ReplyHeader(), request, response, cb,
-                clientPath, serverPath, ctx, wcb);
+        cnxn.queuePacket(h, new ReplyHeader(), request, response, cb, clientPath, serverPath, ctx, wcb);
     }
 
     /**
      * The asynchronous version of getChildren.
      *
      * @since 3.3.0
-     * 
+     *
      * @see #getChildren(String, boolean, Stat)
      */
-    public void getChildren(String path, boolean watch, Children2Callback cb,
-            Object ctx)
-    {
+    public void getChildren(String path, boolean watch, Children2Callback cb, Object ctx) {
         getChildren(path, watch ? watchManager.defaultWatcher : null, cb, ctx);
     }
 
@@ -2772,8 +2805,7 @@ public class ZooKeeper implements AutoCloseable {
      * @throws KeeperException
      * @throws InterruptedException
      */
-    public int getAllChildrenNumber(final String path)
-            throws KeeperException, InterruptedException {
+    public int getAllChildrenNumber(final String path) throws KeeperException, InterruptedException {
 
         final String clientPath = path;
         PathUtils.validatePath(clientPath);
@@ -2787,8 +2819,7 @@ public class ZooKeeper implements AutoCloseable {
 
         ReplyHeader r = cnxn.submitRequest(h, request, response, null);
         if (r.getErr() != 0) {
-            throw KeeperException.create(KeeperException.Code.get(r.getErr()),
-                    clientPath);
+            throw KeeperException.create(KeeperException.Code.get(r.getErr()), clientPath);
         }
         return response.getTotalNumber();
     }
@@ -2811,19 +2842,16 @@ public class ZooKeeper implements AutoCloseable {
         GetAllChildrenNumberRequest request = new GetAllChildrenNumberRequest(serverPath);
         GetAllChildrenNumberResponse response = new GetAllChildrenNumberResponse();
 
-        cnxn.queuePacket(h, new ReplyHeader(), request, response, cb,
-                clientPath, serverPath, ctx, null);
+        cnxn.queuePacket(h, new ReplyHeader(), request, response, cb, clientPath, serverPath, ctx, null);
     }
 
-
     /**
      * Synchronously gets all the ephemeral nodes  created by this session.
      *
      * @since 3.6.0
      *
      */
-    public List<String> getEphemerals()
-        throws KeeperException, InterruptedException {
+    public List<String> getEphemerals() throws KeeperException, InterruptedException {
         return getEphemerals("/");
     }
 
@@ -2835,8 +2863,7 @@ public class ZooKeeper implements AutoCloseable {
      * @since 3.6.0
      *
      */
-    public List<String> getEphemerals(String prefixPath)
-        throws KeeperException, InterruptedException {
+    public List<String> getEphemerals(String prefixPath) throws KeeperException, InterruptedException {
         PathUtils.validatePath(prefixPath);
         RequestHeader h = new RequestHeader();
         h.setType(ZooDefs.OpCode.getEphemerals);
@@ -2863,8 +2890,7 @@ public class ZooKeeper implements AutoCloseable {
         h.setType(ZooDefs.OpCode.getEphemerals);
         GetEphemeralsRequest request = new GetEphemeralsRequest(prefixPath);
         GetEphemeralsResponse response = new GetEphemeralsResponse();
-        cnxn.queuePacket(h, new ReplyHeader(), request, response, cb,
-            null, null, ctx, null);
+        cnxn.queuePacket(h, new ReplyHeader(), request, response, cb, null, null, ctx, null);
     }
 
     /**
@@ -2885,7 +2911,7 @@ public class ZooKeeper implements AutoCloseable {
      * @param ctx context to be provided to the callback
      * @throws IllegalArgumentException if an invalid path is specified
      */
-    public void sync(final String path, VoidCallback cb, Object ctx){
+    public void sync(final String path, VoidCallback cb, Object ctx) {
         final String clientPath = path;
         PathUtils.validatePath(clientPath);
 
@@ -2896,8 +2922,7 @@ public class ZooKeeper implements AutoCloseable {
         SyncRequest request = new SyncRequest();
         SyncResponse response = new SyncResponse();
         request.setPath(serverPath);
-        cnxn.queuePacket(h, new ReplyHeader(), request, response, cb,
-                clientPath, serverPath, ctx, null);
+        cnxn.queuePacket(h, new ReplyHeader(), request, response, cb, clientPath, serverPath, ctx, null);
     }
 
     /**
@@ -2933,12 +2958,13 @@ public class ZooKeeper implements AutoCloseable {
      *
      * @since 3.5.0
      */
-    public void removeWatches(String path, Watcher watcher,
-            WatcherType watcherType, boolean local)
-            throws InterruptedException, KeeperException {
+    public void removeWatches(
+        String path,
+        Watcher watcher,
+        WatcherType watcherType,
+        boolean local) throws InterruptedException, KeeperException {
         validateWatcher(watcher);
-        removeWatches(ZooDefs.OpCode.checkWatches, path, watcher,
-                watcherType, local);
... 96198 lines suppressed ...


Mime
View raw message