You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2023/08/08 12:33:47 UTC

[tomcat] branch 8.5.x updated (493c208cc9 -> 3676295718)

This is an automated email from the ASF dual-hosted git repository.

markt pushed a change to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


    from 493c208cc9 Use parts size for maxParameterCount
     new 30b2ff8590 Improvements to formatting prior to running automated reformatting.
     new 3676295718 Code clean-up - formatting. No functional change.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 java/org/apache/catalina/ha/CatalinaCluster.java   |  12 +-
 java/org/apache/catalina/ha/ClusterDeployer.java   |  56 +-
 java/org/apache/catalina/ha/ClusterListener.java   |  45 +-
 java/org/apache/catalina/ha/ClusterManager.java    | 131 +++--
 java/org/apache/catalina/ha/ClusterMessage.java    |   4 +
 java/org/apache/catalina/ha/ClusterRuleSet.java    | 178 +++---
 java/org/apache/catalina/ha/ClusterSession.java    |  23 +-
 java/org/apache/catalina/ha/ClusterValve.java      |   9 +-
 .../ha/authenticator/ClusterSingleSignOn.java      |  68 ++-
 .../authenticator/ClusterSingleSignOnListener.java |   9 +-
 .../apache/catalina/ha/backend/CollectedInfo.java  |  26 +-
 .../catalina/ha/backend/HeartbeatListener.java     |  34 +-
 .../catalina/ha/backend/MultiCastSender.java       |   5 +-
 java/org/apache/catalina/ha/backend/Proxy.java     |   4 +-
 java/org/apache/catalina/ha/backend/Sender.java    |  31 +-
 java/org/apache/catalina/ha/backend/TcpSender.java |  19 +-
 .../catalina/ha/context/ReplicatedContext.java     |  78 +--
 .../apache/catalina/ha/deploy/FarmWarDeployer.java |   2 +-
 .../catalina/ha/deploy/FileMessageFactory.java     |   2 +-
 java/org/apache/catalina/ha/deploy/WarWatcher.java |   6 +-
 .../apache/catalina/ha/session/BackupManager.java  |  78 ++-
 .../catalina/ha/session/ClusterManagerBase.java    |  50 +-
 .../ha/session/ClusterSessionListener.java         |  41 +-
 .../apache/catalina/ha/session/DeltaManager.java   | 642 ++++++++++-----------
 .../apache/catalina/ha/session/DeltaRequest.java   | 152 +++--
 .../apache/catalina/ha/session/DeltaSession.java   | 298 ++++------
 .../catalina/ha/session/JvmRouteBinderValve.java   | 174 +++---
 .../ha/session/ReplicatedSessionListener.java      |   5 +-
 .../apache/catalina/ha/session/SessionMessage.java |  47 +-
 .../catalina/ha/session/SessionMessageImpl.java    | 118 ++--
 java/org/apache/catalina/ha/tcp/Constants.java     |   3 +-
 .../apache/catalina/ha/tcp/ReplicationValve.java   | 261 ++++-----
 .../apache/catalina/ha/tcp/SendMessageData.java    |  15 +-
 .../apache/catalina/ha/tcp/SimpleTcpCluster.java   | 176 +++---
 34 files changed, 1333 insertions(+), 1469 deletions(-)


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[tomcat] 01/02: Improvements to formatting prior to running automated reformatting.

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 30b2ff85901fea21e0208cfb01113348d00ad870
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Tue Aug 8 11:53:12 2023 +0100

    Improvements to formatting prior to running automated reformatting.
---
 .../apache/catalina/ha/backend/CollectedInfo.java   | 10 +++++-----
 .../apache/catalina/ha/session/DeltaManager.java    | 21 +++++++++++----------
 .../apache/catalina/ha/session/DeltaRequest.java    |  3 ++-
 .../apache/catalina/ha/session/SessionMessage.java  | 18 +++++++++---------
 4 files changed, 27 insertions(+), 25 deletions(-)

diff --git a/java/org/apache/catalina/ha/backend/CollectedInfo.java b/java/org/apache/catalina/ha/backend/CollectedInfo.java
index 00c39ed365..5d34b07192 100644
--- a/java/org/apache/catalina/ha/backend/CollectedInfo.java
+++ b/java/org/apache/catalina/ha/backend/CollectedInfo.java
@@ -62,11 +62,11 @@ public class CollectedInfo {
             objName = oi.getObjectName();
             String name = objName.getKeyProperty("name");
 
-            /* Name are:
-             * http-8080
-             * jk-10.33.144.3-8009
-             * jk-jfcpc%2F10.33.144.3-8009
-             */
+            // Example names:
+            // ajp-nio-8009
+            // ajp-nio-127.0.0.1-8009
+            // ajp-nio-0:0:0:0:0:0:0:1-8009
+            // ajp-nio-10.36.116.209-8009
             String [] elenames = name.split("-");
             String sport = elenames[elenames.length-1];
             iport = Integer.parseInt(sport);
diff --git a/java/org/apache/catalina/ha/session/DeltaManager.java b/java/org/apache/catalina/ha/session/DeltaManager.java
index 403a7e9711..d796c4cadf 100644
--- a/java/org/apache/catalina/ha/session/DeltaManager.java
+++ b/java/org/apache/catalina/ha/session/DeltaManager.java
@@ -43,10 +43,10 @@ import org.apache.tomcat.util.res.StringManager;
  * The DeltaManager manages replicated sessions by only replicating the deltas
  * in data. For applications written to handle this, the DeltaManager is the
  * optimal way of replicating data.
- *
+ * <p>
  * This code is almost identical to StandardManager with a difference in how it
  * persists sessions and some modifications to it.
- *
+ * <p>
  * <b>IMPLEMENTATION NOTE </b>: Correct behavior of session storing and
  * reloading depends upon external calls to the <code>start()</code> and
  * <code>stop()</code> methods of this class at the correct times.
@@ -660,7 +660,9 @@ public class DeltaManager extends ClusterManagerBase{
 
     /**
      * Load sessions from other cluster node.
+     * <p>
      * FIXME replace currently sessions with same id without notification.
+     * <p>
      * FIXME SSO handling is not really correct with the session replacement!
      * @param data Serialized data
      * @exception ClassNotFoundException
@@ -1395,10 +1397,9 @@ public class DeltaManager extends ClusterManagerBase{
     }
 
     /**
-     * handle receive that other node want all sessions ( restart )
-     * a) send all sessions with one message
-     * b) send session at blocks
-     * After sending send state is complete transferred
+     * Handle a get all sessions message from another node. Depending on {@link #sendAllSessions}, sessions are either
+     * sent in a single message or in batches. Sending is complete when this method exits.
+     *
      * @param msg Session message
      * @param sender Member which sent the message
      * @throws IOException IO error sending messages
@@ -1416,7 +1417,7 @@ public class DeltaManager extends ClusterManagerBase{
         if (isSendAllSessions()) {
             sendSessions(sender, currentSessions, findSessionTimestamp);
         } else {
-            // send session at blocks
+            // send sessions in batches
             int remain = currentSessions.length;
             for (int i = 0; i < currentSessions.length; i += getSendAllSessionsSize()) {
                 int len = i + getSendAllSessionsSize() > currentSessions.length ?
@@ -1431,9 +1432,9 @@ public class DeltaManager extends ClusterManagerBase{
                         Thread.sleep(getSendAllSessionsWaitTime());
                     } catch (Exception sleep) {
                     }
-                }//end if
-            }//for
-        }//end if
+                }
+            }
+        }
 
         SessionMessage newmsg = new SessionMessageImpl(name,
                 SessionMessage.EVT_ALL_SESSION_TRANSFERCOMPLETE, null, "SESSION-STATE-TRANSFERRED",
diff --git a/java/org/apache/catalina/ha/session/DeltaRequest.java b/java/org/apache/catalina/ha/session/DeltaRequest.java
index 4246f3397b..50d5095ce6 100644
--- a/java/org/apache/catalina/ha/session/DeltaRequest.java
+++ b/java/org/apache/catalina/ha/session/DeltaRequest.java
@@ -34,7 +34,8 @@ import org.apache.tomcat.util.res.StringManager;
  * This class is used to track the series of actions that happens when
  * a request is executed. These actions will then translate into invocations of methods
  * on the actual session.
- * This class is NOT thread safe. One DeltaRequest per session
+ * <p>
+ * This class is NOT thread safe. One DeltaRequest per session.
  */
 public class DeltaRequest implements Externalizable {
 
diff --git a/java/org/apache/catalina/ha/session/SessionMessage.java b/java/org/apache/catalina/ha/session/SessionMessage.java
index 96dcc66fe0..8183ee653e 100644
--- a/java/org/apache/catalina/ha/session/SessionMessage.java
+++ b/java/org/apache/catalina/ha/session/SessionMessage.java
@@ -23,15 +23,15 @@ import org.apache.catalina.ha.ClusterMessage;
  * <p>
  * The following events are currently available:
  * <ul>
- *   <li><pre>public static final int EVT_SESSION_CREATED</pre><li>
- *   <li><pre>public static final int EVT_SESSION_EXPIRED</pre><li>
- *   <li><pre>public static final int EVT_SESSION_ACCESSED</pre><li>
- *   <li><pre>public static final int EVT_GET_ALL_SESSIONS</pre><li>
- *   <li><pre>public static final int EVT_SESSION_DELTA</pre><li>
- *   <li><pre>public static final int EVT_ALL_SESSION_DATA</pre><li>
- *   <li><pre>public static final int EVT_ALL_SESSION_TRANSFERCOMPLETE</pre><li>
- *   <li><pre>public static final int EVT_CHANGE_SESSION_ID</pre><li>
- *   <li><pre>public static final int EVT_ALL_SESSION_NOCONTEXTMANAGER</pre><li>
+ *   <li>{@code public static final int EVT_SESSION_CREATED}</li>
+ *   <li>{@code public static final int EVT_SESSION_EXPIRED}</li>
+ *   <li>{@code public static final int EVT_SESSION_ACCESSED}</li>
+ *   <li>{@code public static final int EVT_GET_ALL_SESSIONS}</li>
+ *   <li>{@code public static final int EVT_SESSION_DELTA}</li>
+ *   <li>{@code public static final int EVT_ALL_SESSION_DATA}</li>
+ *   <li>{@code public static final int EVT_ALL_SESSION_TRANSFERCOMPLETE}</li>
+ *   <li>{@code public static final int EVT_CHANGE_SESSION_ID}</li>
+ *   <li>{@code public static final int EVT_ALL_SESSION_NOCONTEXTMANAGER}</li>
  * </ul>
  */
 public interface SessionMessage extends ClusterMessage {


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[tomcat] 02/02: Code clean-up - formatting. No functional change.

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 367629571896400aa86762d50dcd1bad44eabc9a
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Tue Aug 8 13:33:37 2023 +0100

    Code clean-up - formatting. No functional change.
---
 java/org/apache/catalina/ha/CatalinaCluster.java   |  12 +-
 java/org/apache/catalina/ha/ClusterDeployer.java   |  56 +-
 java/org/apache/catalina/ha/ClusterListener.java   |  45 +-
 java/org/apache/catalina/ha/ClusterManager.java    | 131 ++---
 java/org/apache/catalina/ha/ClusterMessage.java    |   4 +
 java/org/apache/catalina/ha/ClusterRuleSet.java    | 178 +++---
 java/org/apache/catalina/ha/ClusterSession.java    |  23 +-
 java/org/apache/catalina/ha/ClusterValve.java      |   9 +-
 .../ha/authenticator/ClusterSingleSignOn.java      |  68 +--
 .../authenticator/ClusterSingleSignOnListener.java |   9 +-
 .../apache/catalina/ha/backend/CollectedInfo.java  |  16 +-
 .../catalina/ha/backend/HeartbeatListener.java     |  34 +-
 .../catalina/ha/backend/MultiCastSender.java       |   5 +-
 java/org/apache/catalina/ha/backend/Proxy.java     |   4 +-
 java/org/apache/catalina/ha/backend/Sender.java    |  31 +-
 java/org/apache/catalina/ha/backend/TcpSender.java |  19 +-
 .../catalina/ha/context/ReplicatedContext.java     |  78 +--
 .../apache/catalina/ha/deploy/FarmWarDeployer.java |   2 +-
 .../catalina/ha/deploy/FileMessageFactory.java     |   2 +-
 java/org/apache/catalina/ha/deploy/WarWatcher.java |   6 +-
 .../apache/catalina/ha/session/BackupManager.java  |  78 ++-
 .../catalina/ha/session/ClusterManagerBase.java    |  50 +-
 .../ha/session/ClusterSessionListener.java         |  41 +-
 .../apache/catalina/ha/session/DeltaManager.java   | 621 ++++++++++-----------
 .../apache/catalina/ha/session/DeltaRequest.java   | 149 +++--
 .../apache/catalina/ha/session/DeltaSession.java   | 298 +++++-----
 .../catalina/ha/session/JvmRouteBinderValve.java   | 174 +++---
 .../ha/session/ReplicatedSessionListener.java      |   5 +-
 .../apache/catalina/ha/session/SessionMessage.java |  47 +-
 .../catalina/ha/session/SessionMessageImpl.java    | 118 ++--
 java/org/apache/catalina/ha/tcp/Constants.java     |   3 +-
 .../apache/catalina/ha/tcp/ReplicationValve.java   | 261 +++++----
 .../apache/catalina/ha/tcp/SendMessageData.java    |  15 +-
 .../apache/catalina/ha/tcp/SimpleTcpCluster.java   | 176 +++---
 34 files changed, 1315 insertions(+), 1453 deletions(-)

diff --git a/java/org/apache/catalina/ha/CatalinaCluster.java b/java/org/apache/catalina/ha/CatalinaCluster.java
index 52eb281b9c..de8578cc40 100644
--- a/java/org/apache/catalina/ha/CatalinaCluster.java
+++ b/java/org/apache/catalina/ha/CatalinaCluster.java
@@ -26,14 +26,14 @@ import org.apache.catalina.tribes.Member;
 
 
 /**
- * A <b>CatalinaCluster</b> interface allows to plug in and out the
- * different cluster implementations
+ * A <b>CatalinaCluster</b> interface allows to plug in and out the different cluster implementations
  */
 public interface CatalinaCluster extends Cluster {
     // ----------------------------------------------------- Instance Variables
 
     /**
      * Sends a message to all the members in the cluster
+     *
      * @param msg ClusterMessage
      */
     void send(ClusterMessage msg);
@@ -41,7 +41,7 @@ public interface CatalinaCluster extends Cluster {
     /**
      * Sends a message to a specific member in the cluster.
      *
-     * @param msg ClusterMessage
+     * @param msg  ClusterMessage
      * @param dest Member
      */
     void send(ClusterMessage msg, Member dest);
@@ -78,15 +78,19 @@ public interface CatalinaCluster extends Cluster {
 
     /**
      * Get Manager
+     *
      * @param name The manager name
+     *
      * @return The manager
      */
     Manager getManager(String name);
 
     /**
      * Get a new cluster name for a manager.
-     * @param name Override name (optional)
+     *
+     * @param name    Override name (optional)
      * @param manager The manager
+     *
      * @return the manager name in the cluster
      */
     String getManagerName(String name, Manager manager);
diff --git a/java/org/apache/catalina/ha/ClusterDeployer.java b/java/org/apache/catalina/ha/ClusterDeployer.java
index 47f385b781..8e8e33d03e 100644
--- a/java/org/apache/catalina/ha/ClusterDeployer.java
+++ b/java/org/apache/catalina/ha/ClusterDeployer.java
@@ -23,64 +23,54 @@ import org.apache.catalina.LifecycleException;
 import org.apache.catalina.tribes.ChannelListener;
 
 /**
- * A <b>ClusterDeployer</b> interface allows to plug in and out the
- * different deployment implementations
+ * A <b>ClusterDeployer</b> interface allows to plug in and out the different deployment implementations
  */
 public interface ClusterDeployer extends ChannelListener {
 
     /**
      * Start the cluster deployer, the owning container will invoke this
+     *
      * @throws Exception - if failure to start cluster
      */
     void start() throws Exception;
 
     /**
      * Stops the cluster deployer, the owning container will invoke this
+     *
      * @throws LifecycleException Error stopping cluster deployer
      */
     void stop() throws LifecycleException;
 
     /**
-     * Install a new web application, whose web application archive is at the
-     * specified URL, into this container and all the other
-     * members of the cluster with the specified context name.
+     * Install a new web application, whose web application archive is at the specified URL, into this container and all
+     * the other members of the cluster with the specified context name.
      * <p>
-     * If this application is successfully installed locally,
-     * a ContainerEvent of type
-     * <code>INSTALL_EVENT</code> will be sent to all registered listeners,
-     * with the newly created <code>Context</code> as an argument.
+     * If this application is successfully installed locally, a ContainerEvent of type <code>INSTALL_EVENT</code> will
+     * be sent to all registered listeners, with the newly created <code>Context</code> as an argument.
      *
-     * @param contextName The context name to which this application should
-     *  be installed (must be unique)
-     * @param webapp    A WAR file or unpacked directory structure containing
-     *                  the web application to be installed
+     * @param contextName The context name to which this application should be installed (must be unique)
+     * @param webapp      A WAR file or unpacked directory structure containing the web application to be installed
      *
-     * @exception IllegalArgumentException if the specified context name
-     *  is malformed
-     * @exception IllegalStateException if the specified context name
-     *  is already attached to an existing web application
-     * @exception IOException if an input/output error was encountered
-     *  during installation
+     * @exception IllegalArgumentException if the specified context name is malformed
+     * @exception IllegalStateException    if the specified context name is already attached to an existing web
+     *                                         application
+     * @exception IOException              if an input/output error was encountered during installation
      */
     void install(String contextName, File webapp) throws IOException;
 
     /**
-     * Remove an existing web application, attached to the specified context
-     * name.  If this application is successfully removed, a
-     * ContainerEvent of type <code>REMOVE_EVENT</code> will be sent to all
-     * registered listeners, with the removed <code>Context</code> as
-     * an argument. Deletes the web application war file and/or directory
-     * if they exist in the Host's appBase.
+     * Remove an existing web application, attached to the specified context name. If this application is successfully
+     * removed, a ContainerEvent of type <code>REMOVE_EVENT</code> will be sent to all registered listeners, with the
+     * removed <code>Context</code> as an argument. Deletes the web application war file and/or directory if they exist
+     * in the Host's appBase.
      *
      * @param contextName The context name of the application to be removed
-     * @param undeploy boolean flag to remove web application from server
+     * @param undeploy    boolean flag to remove web application from server
      *
-     * @exception IllegalArgumentException if the specified context name
-     *  is malformed
-     * @exception IllegalArgumentException if the specified context name does
-     *  not identify a currently installed web application
-     * @exception IOException if an input/output error occurs during
-     *  removal
+     * @exception IllegalArgumentException if the specified context name is malformed
+     * @exception IllegalArgumentException if the specified context name does not identify a currently installed web
+     *                                         application
+     * @exception IOException              if an input/output error occurs during removal
      */
     void remove(String contextName, boolean undeploy) throws IOException;
 
@@ -91,12 +81,14 @@ public interface ClusterDeployer extends ChannelListener {
 
     /**
      * Returns the cluster the cluster deployer is associated with
+     *
      * @return CatalinaCluster
      */
     CatalinaCluster getCluster();
 
     /**
      * Associates the cluster deployer with a cluster
+     *
      * @param cluster CatalinaCluster
      */
     void setCluster(CatalinaCluster cluster);
diff --git a/java/org/apache/catalina/ha/ClusterListener.java b/java/org/apache/catalina/ha/ClusterListener.java
index 38ba93b8ce..c3cbfe0be4 100644
--- a/java/org/apache/catalina/ha/ClusterListener.java
+++ b/java/org/apache/catalina/ha/ClusterListener.java
@@ -25,8 +25,7 @@ import org.apache.juli.logging.LogFactory;
 
 
 /**
- * Receive SessionID cluster change from other backup node after primary session
- * node is failed.
+ * Receive SessionID cluster change from other backup node after primary session node is failed.
  *
  * @author Peter Rossbach
  */
@@ -34,7 +33,7 @@ public abstract class ClusterListener implements ChannelListener {
 
     private static final Log log = LogFactory.getLog(ClusterListener.class);
 
-    //--Instance Variables--------------------------------------
+    // --Instance Variables--------------------------------------
 
     /**
      * The string manager for this package.
@@ -42,13 +41,13 @@ public abstract class ClusterListener implements ChannelListener {
 
     protected CatalinaCluster cluster = null;
 
-    //--Constructor---------------------------------------------
+    // --Constructor---------------------------------------------
 
     public ClusterListener() {
         // NO-OP
     }
 
-    //--Instance Getters/Setters--------------------------------
+    // --Instance Getters/Setters--------------------------------
 
     public CatalinaCluster getCluster() {
         return cluster;
@@ -57,53 +56,49 @@ public abstract class ClusterListener implements ChannelListener {
     public void setCluster(CatalinaCluster cluster) {
         if (log.isDebugEnabled()) {
             if (cluster != null) {
-                log.debug("add ClusterListener " + this.toString() +
-                        " to cluster" + cluster);
+                log.debug("add ClusterListener " + this.toString() + " to cluster" + cluster);
             } else {
-                log.debug("remove ClusterListener " + this.toString() +
-                        " from cluster");
+                log.debug("remove ClusterListener " + this.toString() + " from cluster");
             }
         }
         this.cluster = cluster;
     }
 
-    //--Logic---------------------------------------------------
+    // --Logic---------------------------------------------------
 
     @Override
     public final void messageReceived(Serializable msg, Member member) {
-        if ( msg instanceof ClusterMessage ) {
-            messageReceived((ClusterMessage)msg);
+        if (msg instanceof ClusterMessage) {
+            messageReceived((ClusterMessage) msg);
         }
     }
+
     @Override
     public final boolean accept(Serializable msg, Member member) {
-        if ( msg instanceof ClusterMessage ) {
+        if (msg instanceof ClusterMessage) {
             return true;
         }
         return false;
     }
 
 
-
     /**
-     * Callback from the cluster, when a message is received, The cluster will
-     * broadcast it invoking the messageReceived on the receiver.
+     * Callback from the cluster, when a message is received, The cluster will broadcast it invoking the messageReceived
+     * on the receiver.
      *
-     * @param msg
-     *            ClusterMessage - the message received from the cluster
+     * @param msg ClusterMessage - the message received from the cluster
      */
-    public abstract void messageReceived(ClusterMessage msg) ;
+    public abstract void messageReceived(ClusterMessage msg);
 
 
     /**
      * Accept only SessionIDMessages
      *
-     * @param msg
-     *            ClusterMessage
-     * @return boolean - returns true to indicate that messageReceived should be
-     *         invoked. If false is returned, the messageReceived method will
-     *         not be invoked.
+     * @param msg ClusterMessage
+     *
+     * @return boolean - returns true to indicate that messageReceived should be invoked. If false is returned, the
+     *             messageReceived method will not be invoked.
      */
-    public abstract boolean accept(ClusterMessage msg) ;
+    public abstract boolean accept(ClusterMessage msg);
 
 }
diff --git a/java/org/apache/catalina/ha/ClusterManager.java b/java/org/apache/catalina/ha/ClusterManager.java
index 4dc9fdf4ec..6487dcd573 100644
--- a/java/org/apache/catalina/ha/ClusterManager.java
+++ b/java/org/apache/catalina/ha/ClusterManager.java
@@ -24,73 +24,76 @@ import org.apache.catalina.tribes.io.ReplicationStream;
 
 
 /**
- * The common interface used by all cluster manager.
- * This is so that we can have a more pluggable way
- * of swapping session managers for different algorithms.
+ * The common interface used by all cluster manager. This is so that we can have a more pluggable way of swapping
+ * session managers for different algorithms.
  *
  * @author Peter Rossbach
  */
 public interface ClusterManager extends Manager {
 
-   /**
-    * A message was received from another node, this
-    * is the callback method to implement if you are interested in
-    * receiving replication messages.
-    * @param msg - the message received.
-    */
-   void messageDataReceived(ClusterMessage msg);
-
-   /**
-    * When the request has been completed, the replication valve
-    * will notify the manager, and the manager will decide whether
-    * any replication is needed or not.
-    * If there is a need for replication, the manager will
-    * create a session message and that will be replicated.
-    * The cluster determines where it gets sent.
-    * @param sessionId - the sessionId that just completed.
-    * @return a SessionMessage to be sent.
-    */
-   ClusterMessage requestCompleted(String sessionId);
-
-   /**
-    * When the manager expires session not tied to a request.
-    * The cluster will periodically ask for a list of sessions
-    * that should expire and that should be sent across the wire.
-    * @return String[] The invalidated sessions
-    */
-   String[] getInvalidatedSessions();
-
-   /**
-    * Return the name of the manager, at host /context name and at engine hostname+/context.
-    * @return String
-    * @since 5.5.10
-    */
-   String getName();
-
-   /**
-    * Set the name of the manager, at host /context name and at engine hostname+/context
-    * @param name The manager name
-    * @since 5.5.10
-    */
-   void setName(String name);
-
-   CatalinaCluster getCluster();
-
-   void setCluster(CatalinaCluster cluster);
-
-   /**
-    * Open stream and use correct ClassLoader (Container), switching thread
-    * context class loader.
-    *
-    * @param data The data
-    * @return The object input stream
-    * @throws IOException An error occurred
-    */
-   ReplicationStream getReplicationStream(byte[] data) throws IOException;
-
-   ReplicationStream getReplicationStream(byte[] data, int offset, int length) throws IOException;
-
-   boolean isNotifyListenersOnReplication();
-
-   ClusterManager cloneFromTemplate();
+    /**
+     * A message was received from another node, this is the callback method to implement if you are interested in
+     * receiving replication messages.
+     *
+     * @param msg - the message received.
+     */
+    void messageDataReceived(ClusterMessage msg);
+
+    /**
+     * When the request has been completed, the replication valve will notify the manager, and the manager will decide
+     * whether any replication is needed or not. If there is a need for replication, the manager will create a session
+     * message and that will be replicated. The cluster determines where it gets sent.
+     *
+     * @param sessionId - the sessionId that just completed.
+     *
+     * @return a SessionMessage to be sent.
+     */
+    ClusterMessage requestCompleted(String sessionId);
+
+    /**
+     * When the manager expires session not tied to a request. The cluster will periodically ask for a list of sessions
+     * that should expire and that should be sent across the wire.
+     *
+     * @return String[] The invalidated sessions
+     */
+    String[] getInvalidatedSessions();
+
+    /**
+     * Return the name of the manager, at host /context name and at engine hostname+/context.
+     *
+     * @return String
+     *
+     * @since 5.5.10
+     */
+    String getName();
+
+    /**
+     * Set the name of the manager, at host /context name and at engine hostname+/context
+     *
+     * @param name The manager name
+     *
+     * @since 5.5.10
+     */
+    void setName(String name);
+
+    CatalinaCluster getCluster();
+
+    void setCluster(CatalinaCluster cluster);
+
+    /**
+     * Open stream and use correct ClassLoader (Container), switching thread context class loader.
+     *
+     * @param data The data
+     *
+     * @return The object input stream
+     *
+     * @throws IOException An error occurred
+     */
+    ReplicationStream getReplicationStream(byte[] data) throws IOException;
+
+    ReplicationStream getReplicationStream(byte[] data, int offset, int length) throws IOException;
+
+    boolean isNotifyListenersOnReplication();
+
+    ClusterManager cloneFromTemplate();
 }
diff --git a/java/org/apache/catalina/ha/ClusterMessage.java b/java/org/apache/catalina/ha/ClusterMessage.java
index 452df35d1c..c1b0966727 100644
--- a/java/org/apache/catalina/ha/ClusterMessage.java
+++ b/java/org/apache/catalina/ha/ClusterMessage.java
@@ -22,8 +22,12 @@ import org.apache.catalina.tribes.Member;
 
 public interface ClusterMessage extends Serializable {
     Member getAddress();
+
     void setAddress(Member member);
+
     String getUniqueId();
+
     long getTimestamp();
+
     void setTimestamp(long timestamp);
 }
diff --git a/java/org/apache/catalina/ha/ClusterRuleSet.java b/java/org/apache/catalina/ha/ClusterRuleSet.java
index 14780407bd..8aed8fefff 100644
--- a/java/org/apache/catalina/ha/ClusterRuleSet.java
+++ b/java/org/apache/catalina/ha/ClusterRuleSet.java
@@ -22,8 +22,9 @@ import org.apache.tomcat.util.digester.RuleSetBase;
 
 
 /**
- * <p><strong>RuleSet</strong> for processing the contents of a
- * Cluster definition element.  </p>
+ * <p>
+ * <strong>RuleSet</strong> for processing the contents of a Cluster definition element.
+ * </p>
  *
  * @author Peter Rossbach
  */
@@ -44,8 +45,7 @@ public class ClusterRuleSet extends RuleSetBase {
 
 
     /**
-     * Construct an instance of this <code>RuleSet</code> with the default
-     * matching pattern prefix.
+     * Construct an instance of this <code>RuleSet</code> with the default matching pattern prefix.
      */
     public ClusterRuleSet() {
 
@@ -55,11 +55,9 @@ public class ClusterRuleSet extends RuleSetBase {
 
 
     /**
-     * Construct an instance of this <code>RuleSet</code> with the specified
-     * matching pattern prefix.
+     * Construct an instance of this <code>RuleSet</code> with the specified matching pattern prefix.
      *
-     * @param prefix Prefix for matching pattern rules (including the
-     *  trailing slash character)
+     * @param prefix Prefix for matching pattern rules (including the trailing slash character)
      */
     public ClusterRuleSet(String prefix) {
         super();
@@ -71,149 +69,109 @@ public class ClusterRuleSet extends RuleSetBase {
 
 
     /**
-     * <p>Add the set of Rule instances defined in this RuleSet to the
-     * specified <code>Digester</code> instance, associating them with
-     * our namespace URI (if any).  This method should only be called
-     * by a Digester instance.</p>
+     * <p>
+     * Add the set of Rule instances defined in this RuleSet to the specified <code>Digester</code> instance,
+     * associating them with our namespace URI (if any). This method should only be called by a Digester instance.
+     * </p>
      *
-     * @param digester Digester instance to which the new Rule instances
-     *  should be added.
+     * @param digester Digester instance to which the new Rule instances should be added.
      */
     @Override
     public void addRuleInstances(Digester digester) {
-        //Cluster configuration start
-        digester.addObjectCreate(prefix + "Manager",
-                                 null, // MUST be specified in the element
-                                 "className");
+        // Cluster configuration start
+        digester.addObjectCreate(prefix + "Manager", null, // MUST be specified in the element
+                "className");
         digester.addSetProperties(prefix + "Manager");
-        digester.addSetNext(prefix + "Manager",
-                            "setManagerTemplate",
-                            "org.apache.catalina.ha.ClusterManager");
+        digester.addSetNext(prefix + "Manager", "setManagerTemplate", "org.apache.catalina.ha.ClusterManager");
         digester.addObjectCreate(prefix + "Manager/SessionIdGenerator",
-                "org.apache.catalina.util.StandardSessionIdGenerator",
-                "className");
+                "org.apache.catalina.util.StandardSessionIdGenerator", "className");
         digester.addSetProperties(prefix + "Manager/SessionIdGenerator");
-        digester.addSetNext(prefix + "Manager/SessionIdGenerator",
-               "setSessionIdGenerator",
-               "org.apache.catalina.SessionIdGenerator");
+        digester.addSetNext(prefix + "Manager/SessionIdGenerator", "setSessionIdGenerator",
+                "org.apache.catalina.SessionIdGenerator");
 
-        digester.addObjectCreate(prefix + "Channel",
-                                 null, // MUST be specified in the element
-                                 "className");
+        digester.addObjectCreate(prefix + "Channel", null, // MUST be specified in the element
+                "className");
         digester.addSetProperties(prefix + "Channel");
-        digester.addSetNext(prefix + "Channel",
-                            "setChannel",
-                            "org.apache.catalina.tribes.Channel");
+        digester.addSetNext(prefix + "Channel", "setChannel", "org.apache.catalina.tribes.Channel");
 
 
         String channelPrefix = prefix + "Channel/";
 
-        //channel properties
-        digester.addObjectCreate(channelPrefix + "Membership",
-                                 null, // MUST be specified in the element
-                                 "className");
+        // channel properties
+        digester.addObjectCreate(channelPrefix + "Membership", null, // MUST be specified in the element
+                "className");
         digester.addSetProperties(channelPrefix + "Membership");
-        digester.addSetNext(channelPrefix + "Membership",
-                            "setMembershipService",
-                            "org.apache.catalina.tribes.MembershipService");
+        digester.addSetNext(channelPrefix + "Membership", "setMembershipService",
+                "org.apache.catalina.tribes.MembershipService");
 
-        digester.addObjectCreate(channelPrefix + "MembershipListener",
-                                 null, // MUST be specified in the element
-                                 "className");
+        digester.addObjectCreate(channelPrefix + "MembershipListener", null, // MUST be specified in the element
+                "className");
         digester.addSetProperties(channelPrefix + "MembershipListener");
-        digester.addSetNext(channelPrefix + "MembershipListener",
-                            "addMembershipListener",
-                            "org.apache.catalina.tribes.MembershipListener");
+        digester.addSetNext(channelPrefix + "MembershipListener", "addMembershipListener",
+                "org.apache.catalina.tribes.MembershipListener");
 
-        digester.addObjectCreate(channelPrefix + "Sender",
-                                 null, // MUST be specified in the element
-                                 "className");
+        digester.addObjectCreate(channelPrefix + "Sender", null, // MUST be specified in the element
+                "className");
         digester.addSetProperties(channelPrefix + "Sender");
-        digester.addSetNext(channelPrefix + "Sender",
-                            "setChannelSender",
-                            "org.apache.catalina.tribes.ChannelSender");
+        digester.addSetNext(channelPrefix + "Sender", "setChannelSender", "org.apache.catalina.tribes.ChannelSender");
 
-        digester.addObjectCreate(channelPrefix + "Sender/Transport",
-                                 null, // MUST be specified in the element
-                                 "className");
+        digester.addObjectCreate(channelPrefix + "Sender/Transport", null, // MUST be specified in the element
+                "className");
         digester.addSetProperties(channelPrefix + "Sender/Transport");
-        digester.addSetNext(channelPrefix + "Sender/Transport",
-                            "setTransport",
-                            "org.apache.catalina.tribes.transport.MultiPointSender");
+        digester.addSetNext(channelPrefix + "Sender/Transport", "setTransport",
+                "org.apache.catalina.tribes.transport.MultiPointSender");
 
 
-        digester.addObjectCreate(channelPrefix + "Receiver",
-                                 null, // MUST be specified in the element
-                                 "className");
+        digester.addObjectCreate(channelPrefix + "Receiver", null, // MUST be specified in the element
+                "className");
         digester.addSetProperties(channelPrefix + "Receiver");
-        digester.addSetNext(channelPrefix + "Receiver",
-                            "setChannelReceiver",
-                            "org.apache.catalina.tribes.ChannelReceiver");
+        digester.addSetNext(channelPrefix + "Receiver", "setChannelReceiver",
+                "org.apache.catalina.tribes.ChannelReceiver");
 
-        digester.addObjectCreate(channelPrefix + "Interceptor",
-                                 null, // MUST be specified in the element
-                                 "className");
+        digester.addObjectCreate(channelPrefix + "Interceptor", null, // MUST be specified in the element
+                "className");
         digester.addSetProperties(channelPrefix + "Interceptor");
-        digester.addSetNext(channelPrefix + "Interceptor",
-                            "addInterceptor",
-                            "org.apache.catalina.tribes.ChannelInterceptor");
+        digester.addSetNext(channelPrefix + "Interceptor", "addInterceptor",
+                "org.apache.catalina.tribes.ChannelInterceptor");
 
-        digester.addObjectCreate(channelPrefix + "Interceptor/LocalMember",
-                                 null, // MUST be specified in the element
-                                 "className");
+        digester.addObjectCreate(channelPrefix + "Interceptor/LocalMember", null, // MUST be specified in the element
+                "className");
         digester.addSetProperties(channelPrefix + "Interceptor/LocalMember");
-        digester.addSetNext(channelPrefix + "Interceptor/LocalMember",
-                            "setLocalMember",
-                            "org.apache.catalina.tribes.Member");
+        digester.addSetNext(channelPrefix + "Interceptor/LocalMember", "setLocalMember",
+                "org.apache.catalina.tribes.Member");
 
-        digester.addObjectCreate(channelPrefix + "Interceptor/Member",
-                                 null, // MUST be specified in the element
-                                 "className");
+        digester.addObjectCreate(channelPrefix + "Interceptor/Member", null, // MUST be specified in the element
+                "className");
         digester.addSetProperties(channelPrefix + "Interceptor/Member");
-        digester.addSetNext(channelPrefix + "Interceptor/Member",
-                            "addStaticMember",
-                            "org.apache.catalina.tribes.Member");
+        digester.addSetNext(channelPrefix + "Interceptor/Member", "addStaticMember",
+                "org.apache.catalina.tribes.Member");
 
-        digester.addObjectCreate(channelPrefix + "ChannelListener",
-                                 null, // MUST be specified in the element
-                                 "className");
+        digester.addObjectCreate(channelPrefix + "ChannelListener", null, // MUST be specified in the element
+                "className");
         digester.addSetProperties(channelPrefix + "ChannelListener");
-        digester.addSetNext(channelPrefix + "ChannelListener",
-                            "addChannelListener",
-                            "org.apache.catalina.tribes.ChannelListener");
+        digester.addSetNext(channelPrefix + "ChannelListener", "addChannelListener",
+                "org.apache.catalina.tribes.ChannelListener");
 
-        digester.addObjectCreate(prefix + "Valve",
-                                 null, // MUST be specified in the element
-                                 "className");
+        digester.addObjectCreate(prefix + "Valve", null, // MUST be specified in the element
+                "className");
         digester.addSetProperties(prefix + "Valve");
-        digester.addSetNext(prefix + "Valve",
-                            "addValve",
-                            "org.apache.catalina.Valve");
+        digester.addSetNext(prefix + "Valve", "addValve", "org.apache.catalina.Valve");
 
-        digester.addObjectCreate(prefix + "Deployer",
-                                 null, // MUST be specified in the element
-                                 "className");
+        digester.addObjectCreate(prefix + "Deployer", null, // MUST be specified in the element
+                "className");
         digester.addSetProperties(prefix + "Deployer");
-        digester.addSetNext(prefix + "Deployer",
-                            "setClusterDeployer",
-                            "org.apache.catalina.ha.ClusterDeployer");
+        digester.addSetNext(prefix + "Deployer", "setClusterDeployer", "org.apache.catalina.ha.ClusterDeployer");
 
-        digester.addObjectCreate(prefix + "Listener",
-                null, // MUST be specified in the element
+        digester.addObjectCreate(prefix + "Listener", null, // MUST be specified in the element
                 "className");
         digester.addSetProperties(prefix + "Listener");
-        digester.addSetNext(prefix + "Listener",
-                            "addLifecycleListener",
-                            "org.apache.catalina.LifecycleListener");
+        digester.addSetNext(prefix + "Listener", "addLifecycleListener", "org.apache.catalina.LifecycleListener");
 
-        digester.addObjectCreate(prefix + "ClusterListener",
-                null, // MUST be specified in the element
+        digester.addObjectCreate(prefix + "ClusterListener", null, // MUST be specified in the element
                 "className");
         digester.addSetProperties(prefix + "ClusterListener");
-        digester.addSetNext(prefix + "ClusterListener",
-                            "addClusterListener",
-                            "org.apache.catalina.ha.ClusterListener");
-        //Cluster configuration end
+        digester.addSetNext(prefix + "ClusterListener", "addClusterListener", "org.apache.catalina.ha.ClusterListener");
+        // Cluster configuration end
     }
 
 }
diff --git a/java/org/apache/catalina/ha/ClusterSession.java b/java/org/apache/catalina/ha/ClusterSession.java
index 93111fbc56..938feb7969 100644
--- a/java/org/apache/catalina/ha/ClusterSession.java
+++ b/java/org/apache/catalina/ha/ClusterSession.java
@@ -21,18 +21,19 @@ import javax.servlet.http.HttpSession;
 import org.apache.catalina.Session;
 
 public interface ClusterSession extends Session, HttpSession {
-   /**
-    * returns true if this session is the primary session, if that is the
-    * case, the manager can expire it upon timeout.
-    * @return True if this session is primary
-    */
-   boolean isPrimarySession();
+    /**
+     * returns true if this session is the primary session, if that is the case, the manager can expire it upon timeout.
+     *
+     * @return True if this session is primary
+     */
+    boolean isPrimarySession();
 
-   /**
-    * Sets whether this is the primary session or not.
-    * @param primarySession Flag value
-    */
-   void setPrimarySession(boolean primarySession);
+    /**
+     * Sets whether this is the primary session or not.
+     *
+     * @param primarySession Flag value
+     */
+    void setPrimarySession(boolean primarySession);
 
 
 }
diff --git a/java/org/apache/catalina/ha/ClusterValve.java b/java/org/apache/catalina/ha/ClusterValve.java
index 6a3a26bcf9..d2c339ea7f 100644
--- a/java/org/apache/catalina/ha/ClusterValve.java
+++ b/java/org/apache/catalina/ha/ClusterValve.java
@@ -19,19 +19,22 @@ package org.apache.catalina.ha;
 import org.apache.catalina.Valve;
 
 /**
- * Cluster valves are a simple extension to the Tomcat valve architecture
- * with a small addition of being able to reference the cluster component in the container it sits in.
+ * Cluster valves are a simple extension to the Tomcat valve architecture with a small addition of being able to
+ * reference the cluster component in the container it sits in.
+ *
  * @author Peter Rossbach
  */
-public interface ClusterValve extends Valve{
+public interface ClusterValve extends Valve {
     /**
      * Returns the cluster the cluster deployer is associated with
+     *
      * @return CatalinaCluster
      */
     CatalinaCluster getCluster();
 
     /**
      * Associates the cluster deployer with a cluster
+     *
      * @param cluster CatalinaCluster
      */
     void setCluster(CatalinaCluster cluster);
diff --git a/java/org/apache/catalina/ha/authenticator/ClusterSingleSignOn.java b/java/org/apache/catalina/ha/authenticator/ClusterSingleSignOn.java
index 495ce6116c..6e8e9ab5a7 100644
--- a/java/org/apache/catalina/ha/authenticator/ClusterSingleSignOn.java
+++ b/java/org/apache/catalina/ha/authenticator/ClusterSingleSignOn.java
@@ -34,20 +34,17 @@ import org.apache.tomcat.util.ExceptionUtils;
 import org.apache.tomcat.util.res.StringManager;
 
 /**
- * A <strong>Valve</strong> that supports a "single sign on" user experience on
- * each nodes of a cluster, where the security identity of a user who successfully
- * authenticates to one web application is propagated to other web applications and
- * to other nodes cluster in the same security domain.  For successful use, the following
- * requirements must be met:
+ * A <strong>Valve</strong> that supports a "single sign on" user experience on each nodes of a cluster, where the
+ * security identity of a user who successfully authenticates to one web application is propagated to other web
+ * applications and to other nodes cluster in the same security domain. For successful use, the following requirements
+ * must be met:
  * <ul>
- * <li>This Valve must be configured on the Container that represents a
- *     virtual host (typically an implementation of <code>Host</code>).</li>
- * <li>The <code>Realm</code> that contains the shared user and role
- *     information must be configured on the same Container (or a higher
- *     one), and not overridden at the web application level.</li>
- * <li>The web applications themselves must use one of the standard
- *     Authenticators found in the
- *     <code>org.apache.catalina.authenticator</code> package.</li>
+ * <li>This Valve must be configured on the Container that represents a virtual host (typically an implementation of
+ * <code>Host</code>).</li>
+ * <li>The <code>Realm</code> that contains the shared user and role information must be configured on the same
+ * Container (or a higher one), and not overridden at the web application level.</li>
+ * <li>The web applications themselves must use one of the standard Authenticators found in the
+ * <code>org.apache.catalina.authenticator</code> package.</li>
  * </ul>
  *
  * @author Fabien Carrion
@@ -59,8 +56,12 @@ public class ClusterSingleSignOn extends SingleSignOn implements ClusterValve, M
     // -------------------------------------------------------------- Properties
 
     private CatalinaCluster cluster = null;
+
     @Override
-    public CatalinaCluster getCluster() { return cluster; }
+    public CatalinaCluster getCluster() {
+        return cluster;
+    }
+
     @Override
     public void setCluster(CatalinaCluster cluster) {
         this.cluster = cluster;
@@ -68,25 +69,29 @@ public class ClusterSingleSignOn extends SingleSignOn implements ClusterValve, M
 
 
     private long rpcTimeout = 15000;
+
     public long getRpcTimeout() {
         return rpcTimeout;
     }
+
     public void setRpcTimeout(long rpcTimeout) {
         this.rpcTimeout = rpcTimeout;
     }
 
 
-    private int mapSendOptions =
-            Channel.SEND_OPTIONS_SYNCHRONIZED_ACK | Channel.SEND_OPTIONS_USE_ACK;
+    private int mapSendOptions = Channel.SEND_OPTIONS_SYNCHRONIZED_ACK | Channel.SEND_OPTIONS_USE_ACK;
+
     public int getMapSendOptions() {
         return mapSendOptions;
     }
+
     public void setMapSendOptions(int mapSendOptions) {
         this.mapSendOptions = mapSendOptions;
     }
 
 
     private boolean terminateOnStartFailure = false;
+
     public boolean getTerminateOnStartFailure() {
         return terminateOnStartFailure;
     }
@@ -96,6 +101,7 @@ public class ClusterSingleSignOn extends SingleSignOn implements ClusterValve, M
     }
 
     private long accessTimeout = 5000;
+
     public long getAccessTimeout() {
         return accessTimeout;
     }
@@ -116,8 +122,7 @@ public class ClusterSingleSignOn extends SingleSignOn implements ClusterValve, M
     }
 
     @Override
-    protected boolean update(String ssoId, Principal principal, String authType,
-            String username, String password) {
+    protected boolean update(String ssoId, Principal principal, String authType, String username, String password) {
         boolean result = super.update(ssoId, principal, authType, username, password);
         if (result) {
             ((ReplicatedMap<String,SingleSignOnEntry>) cache).replicate(ssoId, true);
@@ -142,21 +147,21 @@ public class ClusterSingleSignOn extends SingleSignOn implements ClusterValve, M
     // ------------------------------------------------------- Lifecycle Methods
 
     /**
-     * Start this component and implement the requirements
-     * of {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
+     * Start this component and implement the requirements of
+     * {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
      *
-     * @exception LifecycleException if this component detects a fatal error
-     *  that prevents this component from being used
+     * @exception LifecycleException if this component detects a fatal error that prevents this component from being
+     *                                   used
      */
     @Override
     protected synchronized void startInternal() throws LifecycleException {
 
         // Load the cluster component, if any
         try {
-            if(cluster == null) {
+            if (cluster == null) {
                 Container host = getContainer();
-                if(host instanceof Host) {
-                    if(host.getCluster() instanceof CatalinaCluster) {
+                if (host instanceof Host) {
+                    if (host.getCluster() instanceof CatalinaCluster) {
                         setCluster((CatalinaCluster) host.getCluster());
                     }
                 }
@@ -167,9 +172,8 @@ public class ClusterSingleSignOn extends SingleSignOn implements ClusterValve, M
 
             ClassLoader[] cls = new ClassLoader[] { this.getClass().getClassLoader() };
 
-            ReplicatedMap<String,SingleSignOnEntry> cache = new ReplicatedMap<>(
-                    this, cluster.getChannel(), rpcTimeout, cluster.getClusterName() + "-SSO-cache",
-                    cls, terminateOnStartFailure);
+            ReplicatedMap<String,SingleSignOnEntry> cache = new ReplicatedMap<>(this, cluster.getChannel(), rpcTimeout,
+                    cluster.getClusterName() + "-SSO-cache", cls, terminateOnStartFailure);
             cache.setChannelSendOptions(mapSendOptions);
             cache.setAccessTimeout(accessTimeout);
             this.cache = cache;
@@ -183,11 +187,11 @@ public class ClusterSingleSignOn extends SingleSignOn implements ClusterValve, M
 
 
     /**
-     * Stop this component and implement the requirements
-     * of {@link org.apache.catalina.util.LifecycleBase#stopInternal()}.
+     * Stop this component and implement the requirements of
+     * {@link org.apache.catalina.util.LifecycleBase#stopInternal()}.
      *
-     * @exception LifecycleException if this component detects a fatal error
-     *  that prevents this component from being used
+     * @exception LifecycleException if this component detects a fatal error that prevents this component from being
+     *                                   used
      */
     @Override
     protected synchronized void stopInternal() throws LifecycleException {
diff --git a/java/org/apache/catalina/ha/authenticator/ClusterSingleSignOnListener.java b/java/org/apache/catalina/ha/authenticator/ClusterSingleSignOnListener.java
index e62e6493bd..eb9e0e64df 100644
--- a/java/org/apache/catalina/ha/authenticator/ClusterSingleSignOnListener.java
+++ b/java/org/apache/catalina/ha/authenticator/ClusterSingleSignOnListener.java
@@ -20,12 +20,11 @@ import org.apache.catalina.authenticator.SingleSignOnListener;
 import org.apache.catalina.ha.session.ReplicatedSessionListener;
 
 /**
- * Cluster extension of {@link SingleSignOnListener} that simply adds the marker
- * interface {@link ReplicatedSessionListener} which allows the listener to be
- * replicated across the cluster along with the session.
+ * Cluster extension of {@link SingleSignOnListener} that simply adds the marker interface
+ * {@link ReplicatedSessionListener} which allows the listener to be replicated across the cluster along with the
+ * session.
  */
-public class ClusterSingleSignOnListener extends SingleSignOnListener implements
-        ReplicatedSessionListener {
+public class ClusterSingleSignOnListener extends SingleSignOnListener implements ReplicatedSessionListener {
 
     private static final long serialVersionUID = 1L;
 
diff --git a/java/org/apache/catalina/ha/backend/CollectedInfo.java b/java/org/apache/catalina/ha/backend/CollectedInfo.java
index 5d34b07192..235e161df1 100644
--- a/java/org/apache/catalina/ha/backend/CollectedInfo.java
+++ b/java/org/apache/catalina/ha/backend/CollectedInfo.java
@@ -51,6 +51,7 @@ public class CollectedInfo {
     public CollectedInfo(String host, int port) throws Exception {
         init(host, port);
     }
+
     public void init(String host, int port) throws Exception {
         int iport = 0;
         String shost = null;
@@ -67,16 +68,16 @@ public class CollectedInfo {
             // ajp-nio-127.0.0.1-8009
             // ajp-nio-0:0:0:0:0:0:0:1-8009
             // ajp-nio-10.36.116.209-8009
-            String [] elenames = name.split("-");
-            String sport = elenames[elenames.length-1];
+            String[] elenames = name.split("-");
+            String sport = elenames[elenames.length - 1];
             iport = Integer.parseInt(sport);
-            String [] shosts = elenames[1].split("%2F");
+            String[] shosts = elenames[1].split("%2F");
             shost = shosts[0];
 
-            if (port==0 && host==null) {
+            if (port == 0 && host == null) {
                 break; /* Done: take the first one */
             }
-            if (host==null && iport==port) {
+            if (host == null && iport == port) {
                 break; /* Only port done */
             }
             if (shost.compareTo(host) == 0) {
@@ -84,8 +85,7 @@ public class CollectedInfo {
             }
         }
         if (objName == null) {
-            throw new Exception(sm.getString("collectedInfo.noConnector",
-                    host, Integer.valueOf(port)));
+            throw new Exception(sm.getString("collectedInfo.noConnector", host, Integer.valueOf(port)));
         }
         this.port = iport;
         this.host = shost;
@@ -101,7 +101,7 @@ public class CollectedInfo {
         // the currentThreadCount could be 0 before the threads are created...
         // Integer iready = (Integer) mBeanServer.getAttribute(objName, "currentThreadCount");
 
-        Integer ibusy  = (Integer) mBeanServer.getAttribute(objName, "currentThreadsBusy");
+        Integer ibusy = (Integer) mBeanServer.getAttribute(objName, "currentThreadsBusy");
 
         busy = ibusy.intValue();
         ready = imax.intValue() - ibusy.intValue();
diff --git a/java/org/apache/catalina/ha/backend/HeartbeatListener.java b/java/org/apache/catalina/ha/backend/HeartbeatListener.java
index aec18188ba..de6dfcada4 100644
--- a/java/org/apache/catalina/ha/backend/HeartbeatListener.java
+++ b/java/org/apache/catalina/ha/backend/HeartbeatListener.java
@@ -43,25 +43,42 @@ public class HeartbeatListener implements LifecycleListener, ContainerListener {
 
     /* for multicasting stuff */
     private final String ip = "224.0.1.105"; /* Multicast IP */
-    private final int multiport = 23364;     /* Multicast Port */
+    private final int multiport = 23364; /* Multicast Port */
     private final int ttl = 16;
 
-    public String getHost() { return host; }
-    public String getGroup() { return ip; }
-    public int getMultiport() { return multiport; }
-    public int getTtl() { return ttl; }
+    public String getHost() {
+        return host;
+    }
+
+    public String getGroup() {
+        return ip;
+    }
+
+    public int getMultiport() {
+        return multiport;
+    }
+
+    public int getTtl() {
+        return ttl;
+    }
 
     /**
      * Proxy list, format "address:port,address:port".
      */
     private final String proxyList = null;
-    public String getProxyList() { return proxyList; }
+
+    public String getProxyList() {
+        return proxyList;
+    }
 
     /**
      * URL prefix.
      */
     private final String proxyURL = "/HeartbeatListener";
-    public String getProxyURL() { return proxyURL; }
+
+    public String getProxyURL() {
+        return proxyURL;
+    }
 
     private CollectedInfo coll = null;
 
@@ -113,8 +130,7 @@ public class HeartbeatListener implements LifecycleListener, ContainerListener {
                 coll = null;
                 return;
             }
-            String output = "v=1&ready=" + coll.ready + "&busy=" + coll.busy +
-                    "&port=" + port;
+            String output = "v=1&ready=" + coll.ready + "&busy=" + coll.busy + "&port=" + port;
             try {
                 sender.send(output);
             } catch (Exception ex) {
diff --git a/java/org/apache/catalina/ha/backend/MultiCastSender.java b/java/org/apache/catalina/ha/backend/MultiCastSender.java
index 1e00ee8dc3..c8a8e6908b 100644
--- a/java/org/apache/catalina/ha/backend/MultiCastSender.java
+++ b/java/org/apache/catalina/ha/backend/MultiCastSender.java
@@ -29,8 +29,7 @@ import org.apache.tomcat.util.res.StringManager;
 /*
  * Sender to proxies using multicast socket.
  */
-public class MultiCastSender
-    implements Sender {
+public class MultiCastSender implements Sender {
 
     private static final Log log = LogFactory.getLog(HeartbeatListener.class);
     private static final StringManager sm = StringManager.getManager(MultiCastSender.class);
@@ -52,7 +51,7 @@ public class MultiCastSender
             try {
                 group = InetAddress.getByName(config.getGroup());
                 if (config.getHost() != null) {
-                    InetAddress addr =  InetAddress.getByName(config.getHost());
+                    InetAddress addr = InetAddress.getByName(config.getHost());
                     InetSocketAddress addrs = new InetSocketAddress(addr, config.getMultiport());
                     s = new MulticastSocket(addrs);
                 } else {
diff --git a/java/org/apache/catalina/ha/backend/Proxy.java b/java/org/apache/catalina/ha/backend/Proxy.java
index a8af128e60..3acc811860 100644
--- a/java/org/apache/catalina/ha/backend/Proxy.java
+++ b/java/org/apache/catalina/ha/backend/Proxy.java
@@ -24,6 +24,6 @@ import java.net.InetAddress;
  */
 public class Proxy {
 
-  public InetAddress address = null;
-  public int port = 80;
+    public InetAddress address = null;
+    public int port = 80;
 }
diff --git a/java/org/apache/catalina/ha/backend/Sender.java b/java/org/apache/catalina/ha/backend/Sender.java
index 7c0d618e04..b85a30a5b5 100644
--- a/java/org/apache/catalina/ha/backend/Sender.java
+++ b/java/org/apache/catalina/ha/backend/Sender.java
@@ -21,18 +21,23 @@ package org.apache.catalina.ha.backend;
  */
 public interface Sender {
 
-  /**
-   * Set the configuration parameters
-   * @param config The heartbeat listener configuration
-   * @throws Exception An error occurred
-   */
-  void init(HeartbeatListener config) throws Exception;
+    /**
+     * Set the configuration parameters
+     *
+     * @param config The heartbeat listener configuration
+     *
+     * @throws Exception An error occurred
+     */
+    void init(HeartbeatListener config) throws Exception;
 
-  /**
-   * Send the message to the proxies
-   * @param mess The message that will be sent
-   * @return <code>0</code> if no error occurred, <code>-1</code> otherwise
-   * @throws Exception An error occurred
-   */
-  int send(String mess) throws Exception;
+    /**
+     * Send the message to the proxies
+     *
+     * @param mess The message that will be sent
+     *
+     * @return <code>0</code> if no error occurred, <code>-1</code> otherwise
+     *
+     * @throws Exception An error occurred
+     */
+    int send(String mess) throws Exception;
 }
diff --git a/java/org/apache/catalina/ha/backend/TcpSender.java b/java/org/apache/catalina/ha/backend/TcpSender.java
index f9099000a8..345224d3b5 100644
--- a/java/org/apache/catalina/ha/backend/TcpSender.java
+++ b/java/org/apache/catalina/ha/backend/TcpSender.java
@@ -33,8 +33,7 @@ import org.apache.tomcat.util.res.StringManager;
 /*
  * Sender to proxies using multicast socket.
  */
-public class TcpSender
-    implements Sender {
+public class TcpSender implements Sender {
 
     private static final Log log = LogFactory.getLog(HeartbeatListener.class);
     private static final StringManager sm = StringManager.getManager(TcpSender.class);
@@ -71,7 +70,7 @@ public class TcpSender
             proxies[i] = new Proxy();
             proxies[i].port = Integer.parseInt(token.substring(pos + 1));
             try {
-                 proxies[i].address = InetAddress.getByName(token.substring(0, pos));
+                proxies[i].address = InetAddress.getByName(token.substring(0, pos));
             } catch (Exception e) {
                 throw new Exception(sm.getString("tcpSender.invalidProxyList"));
             }
@@ -96,7 +95,7 @@ public class TcpSender
                 try {
                     if (config.getHost() != null) {
                         connections[i] = new Socket();
-                        InetAddress addr =  InetAddress.getByName(config.getHost());
+                        InetAddress addr = InetAddress.getByName(config.getHost());
                         InetSocketAddress addrs = new InetSocketAddress(addr, 0);
                         connections[i].setReuseAddress(true);
                         connections[i].bind(addrs);
@@ -112,8 +111,7 @@ public class TcpSender
                     close(i);
                 }
             }
-            if (connections[i] == null)
-             {
+            if (connections[i] == null) {
                 continue; // try next proxy in the list
             }
             BufferedWriter writer = connectionWriters[i];
@@ -131,8 +129,7 @@ public class TcpSender
                 log.error(sm.getString("tcpSender.sendFailed"), ex);
                 close(i);
             }
-            if (connections[i] == null)
-             {
+            if (connections[i] == null) {
                 continue; // try next proxy in the list
             }
 
@@ -143,7 +140,8 @@ public class TcpSender
                 close(i);
                 continue;
             } else {
-                responseStatus = responseStatus.substring(responseStatus.indexOf(' ') + 1, responseStatus.indexOf(' ', responseStatus.indexOf(' ') + 1));
+                responseStatus = responseStatus.substring(responseStatus.indexOf(' ') + 1,
+                        responseStatus.indexOf(' ', responseStatus.indexOf(' ') + 1));
                 int status = Integer.parseInt(responseStatus);
                 if (status != 200) {
                     log.error(sm.getString("tcpSender.responseErrorCode", Integer.valueOf(status)));
@@ -175,7 +173,7 @@ public class TcpSender
                         } else {
                             contentLength -= n;
                         }
-                   }
+                    }
                 }
             }
 
@@ -186,6 +184,7 @@ public class TcpSender
 
     /**
      * Close connection.
+     *
      * @param i The index of the connection that will be closed
      */
     protected void close(int i) {
diff --git a/java/org/apache/catalina/ha/context/ReplicatedContext.java b/java/org/apache/catalina/ha/context/ReplicatedContext.java
index c9f3dfa733..fdc152a459 100644
--- a/java/org/apache/catalina/ha/context/ReplicatedContext.java
+++ b/java/org/apache/catalina/ha/context/ReplicatedContext.java
@@ -41,51 +41,49 @@ import org.apache.tomcat.util.res.StringManager;
 public class ReplicatedContext extends StandardContext implements MapOwner {
     private int mapSendOptions = Channel.SEND_OPTIONS_DEFAULT;
     private static final Log log = LogFactory.getLog(ReplicatedContext.class);
-    protected static final long DEFAULT_REPL_TIMEOUT = 15000;//15 seconds
+    protected static final long DEFAULT_REPL_TIMEOUT = 15000;// 15 seconds
     private static final StringManager sm = StringManager.getManager(ReplicatedContext.class);
 
     /**
-     * Start this component and implement the requirements
-     * of {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
+     * Start this component and implement the requirements of
+     * {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
      *
-     * @exception LifecycleException if this component detects a fatal error
-     *  that prevents this component from being used
+     * @exception LifecycleException if this component detects a fatal error that prevents this component from being
+     *                                   used
      */
     @Override
     protected synchronized void startInternal() throws LifecycleException {
         super.startInternal();
         try {
-            CatalinaCluster catclust = (CatalinaCluster)this.getCluster();
-            if ( catclust != null ) {
-                ReplicatedMap<String,Object> map = new ReplicatedMap<>(
-                        this, catclust.getChannel(),DEFAULT_REPL_TIMEOUT,
-                        getName(),getClassLoaders());
+            CatalinaCluster catclust = (CatalinaCluster) this.getCluster();
+            if (catclust != null) {
+                ReplicatedMap<String,Object> map = new ReplicatedMap<>(this, catclust.getChannel(),
+                        DEFAULT_REPL_TIMEOUT, getName(), getClassLoaders());
                 map.setChannelSendOptions(mapSendOptions);
-                ((ReplApplContext)this.context).setAttributeMap(map);
+                ((ReplApplContext) this.context).setAttributeMap(map);
             }
-        }  catch ( Exception x ) {
-            log.error(sm.getString("replicatedContext.startUnable", getName()),x);
-            throw new LifecycleException(sm.getString("replicatedContext.startFailed", getName()),x);
+        } catch (Exception x) {
+            log.error(sm.getString("replicatedContext.startUnable", getName()), x);
+            throw new LifecycleException(sm.getString("replicatedContext.startFailed", getName()), x);
         }
     }
 
     /**
-     * Stop this component and implement the requirements
-     * of {@link org.apache.catalina.util.LifecycleBase#stopInternal()}.
+     * Stop this component and implement the requirements of
+     * {@link org.apache.catalina.util.LifecycleBase#stopInternal()}.
      *
-     * @exception LifecycleException if this component detects a fatal error
-     *  that prevents this component from being used
+     * @exception LifecycleException if this component detects a fatal error that prevents this component from being
+     *                                   used
      */
     @Override
     protected synchronized void stopInternal() throws LifecycleException {
 
-        Map<String, Object> map = ((ReplApplContext) this.context)
-                .getAttributeMap();
+        Map<String,Object> map = ((ReplApplContext) this.context).getAttributeMap();
 
         super.stopInternal();
 
         if (map instanceof ReplicatedMap) {
-            ((ReplicatedMap<?, ?>) map).breakdown();
+            ((ReplicatedMap<?,?>) map).breakdown();
         }
 
     }
@@ -107,13 +105,13 @@ public class ReplicatedContext extends StandardContext implements MapOwner {
             classLoader = loader.getClassLoader();
         }
         Thread currentThread = Thread.currentThread();
-        if ( classLoader == null ) {
+        if (classLoader == null) {
             classLoader = currentThread.getContextClassLoader();
         }
-        if ( classLoader == currentThread.getContextClassLoader() ) {
-            return new ClassLoader[] {classLoader};
+        if (classLoader == currentThread.getContextClassLoader()) {
+            return new ClassLoader[] { classLoader };
         } else {
-            return new ClassLoader[] {classLoader,currentThread.getContextClassLoader()};
+            return new ClassLoader[] { classLoader, currentThread.getContextClassLoader() };
         }
     }
 
@@ -122,34 +120,35 @@ public class ReplicatedContext extends StandardContext implements MapOwner {
         if (context == null) {
             context = new ReplApplContext(this);
             if (getAltDDName() != null) {
-                context.setAttribute(Globals.ALT_DD_ATTR,getAltDDName());
+                context.setAttribute(Globals.ALT_DD_ATTR, getAltDDName());
             }
         }
 
-        return ((ReplApplContext)context).getFacade();
+        return ((ReplApplContext) context).getFacade();
 
     }
 
 
     protected static class ReplApplContext extends ApplicationContext {
-        protected final Map<String, Object> tomcatAttributes = new ConcurrentHashMap<>();
+        protected final Map<String,Object> tomcatAttributes = new ConcurrentHashMap<>();
 
         public ReplApplContext(ReplicatedContext context) {
             super(context);
         }
 
         protected ReplicatedContext getParent() {
-            return (ReplicatedContext)getContext();
+            return (ReplicatedContext) getContext();
         }
 
         @Override
         protected ServletContext getFacade() {
-             return super.getFacade();
+            return super.getFacade();
         }
 
         public Map<String,Object> getAttributeMap() {
             return this.attributes;
         }
+
         public void setAttributeMap(Map<String,Object> map) {
             this.attributes = map;
         }
@@ -157,7 +156,7 @@ public class ReplicatedContext extends StandardContext implements MapOwner {
         @Override
         public void removeAttribute(String name) {
             tomcatAttributes.remove(name);
-            //do nothing
+            // do nothing
             super.removeAttribute(name);
         }
 
@@ -170,10 +169,11 @@ public class ReplicatedContext extends StandardContext implements MapOwner {
                 removeAttribute(name);
                 return;
             }
-            if ( (!getParent().getState().isAvailable()) || "org.apache.jasper.runtime.JspApplicationContextImpl".equals(name) ){
-                tomcatAttributes.put(name,value);
+            if ((!getParent().getState().isAvailable()) ||
+                    "org.apache.jasper.runtime.JspApplicationContextImpl".equals(name)) {
+                tomcatAttributes.put(name, value);
             } else {
-                super.setAttribute(name,value);
+                super.setAttribute(name, value);
             }
         }
 
@@ -192,17 +192,18 @@ public class ReplicatedContext extends StandardContext implements MapOwner {
         public Enumeration<String> getAttributeNames() {
             Set<String> names = new HashSet<>(attributes.keySet());
 
-            return new MultiEnumeration<>(new Enumeration[] {
-                    super.getAttributeNames(),
-                    Collections.enumeration(names) });
+            return new MultiEnumeration<>(
+                    new Enumeration[] { super.getAttributeNames(), Collections.enumeration(names) });
         }
     }
 
     protected static class MultiEnumeration<T> implements Enumeration<T> {
         private final Enumeration<T>[] enumerations;
+
         public MultiEnumeration(Enumeration<T>[] enumerations) {
             this.enumerations = enumerations;
         }
+
         @Override
         public boolean hasMoreElements() {
             for (Enumeration<T> enumeration : enumerations) {
@@ -212,6 +213,7 @@ public class ReplicatedContext extends StandardContext implements MapOwner {
             }
             return false;
         }
+
         @Override
         public T nextElement() {
             for (Enumeration<T> enumeration : enumerations) {
@@ -226,6 +228,6 @@ public class ReplicatedContext extends StandardContext implements MapOwner {
 
     @Override
     public void objectMadePrimary(Object key, Object value) {
-        //noop
+        // noop
     }
 }
\ No newline at end of file
diff --git a/java/org/apache/catalina/ha/deploy/FarmWarDeployer.java b/java/org/apache/catalina/ha/deploy/FarmWarDeployer.java
index 53adb34d39..cfa77cbfe5 100644
--- a/java/org/apache/catalina/ha/deploy/FarmWarDeployer.java
+++ b/java/org/apache/catalina/ha/deploy/FarmWarDeployer.java
@@ -61,7 +61,7 @@ public class FarmWarDeployer extends ClusterListener implements ClusterDeployer,
     /*--Instance Variables--------------------------------------*/
     protected boolean started = false;
 
-    protected final HashMap<String, FileMessageFactory> fileFactories = new HashMap<>();
+    protected final HashMap<String,FileMessageFactory> fileFactories = new HashMap<>();
 
     /**
      * Deployment directory.
diff --git a/java/org/apache/catalina/ha/deploy/FileMessageFactory.java b/java/org/apache/catalina/ha/deploy/FileMessageFactory.java
index 4a4394af37..942b273f30 100644
--- a/java/org/apache/catalina/ha/deploy/FileMessageFactory.java
+++ b/java/org/apache/catalina/ha/deploy/FileMessageFactory.java
@@ -97,7 +97,7 @@ public class FileMessageFactory {
      * Messages received out of order are held in the buffer until required. If everything is worked as expected,
      * messages will spend very little time in the buffer.
      */
-    protected final Map<Long, FileMessage> msgBuffer = new ConcurrentHashMap<>();
+    protected final Map<Long,FileMessage> msgBuffer = new ConcurrentHashMap<>();
 
     /**
      * The bytes that we hold the data in, not thread safe.
diff --git a/java/org/apache/catalina/ha/deploy/WarWatcher.java b/java/org/apache/catalina/ha/deploy/WarWatcher.java
index 1c094b3504..bd9e4ad8e6 100644
--- a/java/org/apache/catalina/ha/deploy/WarWatcher.java
+++ b/java/org/apache/catalina/ha/deploy/WarWatcher.java
@@ -51,7 +51,7 @@ public class WarWatcher {
     /**
      * Currently deployed files
      */
-    protected final Map<String, WarInfo> currentStatus = new HashMap<>();
+    protected final Map<String,WarInfo> currentStatus = new HashMap<>();
 
     /*--Constructor---------------------------------------------*/
 
@@ -85,8 +85,8 @@ public class WarWatcher {
         }
 
         // Check all the status codes and update the FarmDeployer
-        for (Iterator<Map.Entry<String, WarInfo>> i = currentStatus.entrySet().iterator(); i.hasNext();) {
-            Map.Entry<String, WarInfo> entry = i.next();
+        for (Iterator<Map.Entry<String,WarInfo>> i = currentStatus.entrySet().iterator(); i.hasNext();) {
+            Map.Entry<String,WarInfo> entry = i.next();
             WarInfo info = entry.getValue();
             if (log.isTraceEnabled()) {
                 log.trace(sm.getString("warWatcher.checkingWar", info.getWar()));
diff --git a/java/org/apache/catalina/ha/session/BackupManager.java b/java/org/apache/catalina/ha/session/BackupManager.java
index c4b8eedb41..05ca3cd615 100644
--- a/java/org/apache/catalina/ha/session/BackupManager.java
+++ b/java/org/apache/catalina/ha/session/BackupManager.java
@@ -32,8 +32,7 @@ import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
 import org.apache.tomcat.util.res.StringManager;
 
-public class BackupManager extends ClusterManagerBase
-        implements MapOwner, DistributedManager {
+public class BackupManager extends ClusterManagerBase implements MapOwner, DistributedManager {
 
     private final Log log = LogFactory.getLog(BackupManager.class); // must not be static
 
@@ -42,7 +41,7 @@ public class BackupManager extends ClusterManagerBase
      */
     protected static final StringManager sm = StringManager.getManager(BackupManager.class);
 
-    protected static final long DEFAULT_REPL_TIMEOUT = 15000;//15 seconds
+    protected static final long DEFAULT_REPL_TIMEOUT = 15000;// 15 seconds
 
     /**
      * The name of this manager
@@ -52,7 +51,7 @@ public class BackupManager extends ClusterManagerBase
     /**
      * Flag for how this map sends messages.
      */
-    private int mapSendOptions = Channel.SEND_OPTIONS_SYNCHRONIZED_ACK|Channel.SEND_OPTIONS_USE_ACK;
+    private int mapSendOptions = Channel.SEND_OPTIONS_SYNCHRONIZED_ACK | Channel.SEND_OPTIONS_USE_ACK;
 
     /**
      * Timeout for RPC messages.
@@ -71,16 +70,15 @@ public class BackupManager extends ClusterManagerBase
 
     /**
      * Constructor, just calls super()
-     *
      */
     public BackupManager() {
         super();
     }
 
 
-//******************************************************************************/
-//      ClusterManager Interface
-//******************************************************************************/
+    // ******************************************************************************/
+    // ClusterManager Interface
+    // ******************************************************************************/
 
     @Override
     public void messageDataReceived(ClusterMessage msg) {
@@ -91,20 +89,19 @@ public class BackupManager extends ClusterManagerBase
         if (!getState().isAvailable()) {
             return null;
         }
-        LazyReplicatedMap<String,Session> map =
-                (LazyReplicatedMap<String,Session>)sessions;
-        map.replicate(sessionId,false);
+        LazyReplicatedMap<String,Session> map = (LazyReplicatedMap<String,Session>) sessions;
+        map.replicate(sessionId, false);
         return null;
     }
 
 
-//=========================================================================
-// OVERRIDE THESE METHODS TO IMPLEMENT THE REPLICATION
-//=========================================================================
+    // =========================================================================
+    // OVERRIDE THESE METHODS TO IMPLEMENT THE REPLICATION
+    // =========================================================================
     @Override
     public void objectMadePrimary(Object key, Object value) {
         if (value instanceof DeltaSession) {
-            DeltaSession session = (DeltaSession)value;
+            DeltaSession session = (DeltaSession) value;
             synchronized (session) {
                 session.access();
                 session.setPrimarySession(true);
@@ -126,15 +123,13 @@ public class BackupManager extends ClusterManagerBase
 
 
     /**
-     * Start this component and implement the requirements
-     * of {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
-     *
-     * Starts the cluster communication channel, this will connect with the
-     * other nodes in the cluster, and request the current session state to be
-     * transferred to this node.
+     * Start this component and implement the requirements of
+     * {@link org.apache.catalina.util.LifecycleBase#startInternal()}. Starts the cluster communication channel, this
+     * will connect with the other nodes in the cluster, and request the current session state to be transferred to this
+     * node.
      *
-     * @exception LifecycleException if this component detects a fatal error
-     *  that prevents this component from being used
+     * @exception LifecycleException if this component detects a fatal error that prevents this component from being
+     *                                   used
      */
     @Override
     protected synchronized void startInternal() throws LifecycleException {
@@ -145,37 +140,34 @@ public class BackupManager extends ClusterManagerBase
             if (cluster == null) {
                 throw new LifecycleException(sm.getString("backupManager.noCluster", getName()));
             }
-            LazyReplicatedMap<String,Session> map = new LazyReplicatedMap<>(
-                    this, cluster.getChannel(), rpcTimeout, getMapName(),
-                    getClassLoaders(), terminateOnStartFailure);
+            LazyReplicatedMap<String,Session> map = new LazyReplicatedMap<>(this, cluster.getChannel(), rpcTimeout,
+                    getMapName(), getClassLoaders(), terminateOnStartFailure);
             map.setChannelSendOptions(mapSendOptions);
             map.setAccessTimeout(accessTimeout);
             this.sessions = map;
-        }  catch ( Exception x ) {
-            log.error(sm.getString("backupManager.startUnable", getName()),x);
-            throw new LifecycleException(sm.getString("backupManager.startFailed", getName()),x);
+        } catch (Exception x) {
+            log.error(sm.getString("backupManager.startUnable", getName()), x);
+            throw new LifecycleException(sm.getString("backupManager.startFailed", getName()), x);
         }
         setState(LifecycleState.STARTING);
     }
 
     public String getMapName() {
-        String name = cluster.getManagerName(getName(),this)+"-"+"map";
-        if ( log.isDebugEnabled() ) {
-            log.debug("Backup manager, Setting map name to:"+name);
+        String name = cluster.getManagerName(getName(), this) + "-" + "map";
+        if (log.isDebugEnabled()) {
+            log.debug("Backup manager, Setting map name to:" + name);
         }
         return name;
     }
 
 
     /**
-     * Stop this component and implement the requirements
-     * of {@link org.apache.catalina.util.LifecycleBase#stopInternal()}.
-     *
-     * This will disconnect the cluster communication channel and stop the
-     * listener thread.
+     * Stop this component and implement the requirements of
+     * {@link org.apache.catalina.util.LifecycleBase#stopInternal()}. This will disconnect the cluster communication
+     * channel and stop the listener thread.
      *
-     * @exception LifecycleException if this component detects a fatal error
-     *  that prevents this component from being used
+     * @exception LifecycleException if this component detects a fatal error that prevents this component from being
+     *                                   used
      */
     @Override
     protected synchronized void stopInternal() throws LifecycleException {
@@ -187,8 +179,7 @@ public class BackupManager extends ClusterManagerBase
         setState(LifecycleState.STOPPING);
 
         if (sessions instanceof LazyReplicatedMap) {
-            LazyReplicatedMap<String,Session> map =
-                    (LazyReplicatedMap<String,Session>)sessions;
+            LazyReplicatedMap<String,Session> map = (LazyReplicatedMap<String,Session>) sessions;
             map.breakdown();
         }
 
@@ -250,14 +241,13 @@ public class BackupManager extends ClusterManagerBase
 
     @Override
     public int getActiveSessionsFull() {
-        LazyReplicatedMap<String,Session> map =
-                (LazyReplicatedMap<String,Session>)sessions;
+        LazyReplicatedMap<String,Session> map = (LazyReplicatedMap<String,Session>) sessions;
         return map.sizeFull();
     }
 
     @Override
     public Set<String> getSessionIdsFull() {
-        LazyReplicatedMap<String,Session> map = (LazyReplicatedMap<String,Session>)sessions;
+        LazyReplicatedMap<String,Session> map = (LazyReplicatedMap<String,Session>) sessions;
         Set<String> sessionIds = new HashSet<>(map.keySetFull());
         return sessionIds;
     }
diff --git a/java/org/apache/catalina/ha/session/ClusterManagerBase.java b/java/org/apache/catalina/ha/session/ClusterManagerBase.java
index 89bbf28e01..4169f81c7e 100644
--- a/java/org/apache/catalina/ha/session/ClusterManagerBase.java
+++ b/java/org/apache/catalina/ha/session/ClusterManagerBase.java
@@ -51,7 +51,7 @@ public abstract class ClusterManagerBase extends ManagerBase implements ClusterM
     /**
      * cached replication valve cluster container!
      */
-    private volatile ReplicationValve replicationValve = null ;
+    private volatile ReplicationValve replicationValve = null;
 
     /**
      * send all actions of session attributes.
@@ -106,9 +106,9 @@ public abstract class ClusterManagerBase extends ManagerBase implements ClusterM
             classLoader = tccl;
         }
         if (classLoader == tccl) {
-            return new ClassLoader[] {classLoader};
+            return new ClassLoader[] { classLoader };
         } else {
-            return new ClassLoader[] {classLoader, tccl};
+            return new ClassLoader[] { classLoader, tccl };
         }
     }
 
@@ -119,7 +119,7 @@ public abstract class ClusterManagerBase extends ManagerBase implements ClusterM
 
     @Override
     public ReplicationStream getReplicationStream(byte[] data) throws IOException {
-        return getReplicationStream(data,0,data.length);
+        return getReplicationStream(data, 0, data.length);
     }
 
     @Override
@@ -129,11 +129,11 @@ public abstract class ClusterManagerBase extends ManagerBase implements ClusterM
     }
 
 
-    //  ---------------------------------------------------- persistence handler
+    // ---------------------------------------------------- persistence handler
 
     /**
-     * {@link org.apache.catalina.Manager} implementations that also implement
-     * {@link ClusterManager} do not support local session persistence.
+     * {@link org.apache.catalina.Manager} implementations that also implement {@link ClusterManager} do not support
+     * local session persistence.
      */
     @Override
     public void load() {
@@ -141,8 +141,8 @@ public abstract class ClusterManagerBase extends ManagerBase implements ClusterM
     }
 
     /**
-     * {@link org.apache.catalina.Manager} implementations that also implement
-     * {@link ClusterManager} do not support local session persistence.
+     * {@link org.apache.catalina.Manager} implementations that also implement {@link ClusterManager} do not support
+     * local session persistence.
      */
     @Override
     public void unload() {
@@ -175,28 +175,28 @@ public abstract class ClusterManagerBase extends ManagerBase implements ClusterM
 
     /**
      * Register cross context session at replication valve thread local
+     *
      * @param session cross context session
      */
     protected void registerSessionAtReplicationValve(DeltaSession session) {
-        if(replicationValve == null) {
-            CatalinaCluster cluster = getCluster() ;
-            if(cluster != null) {
+        if (replicationValve == null) {
+            CatalinaCluster cluster = getCluster();
+            if (cluster != null) {
                 Valve[] valves = cluster.getValves();
-                if(valves != null && valves.length > 0) {
-                    for(int i=0; replicationValve == null && i < valves.length ; i++ ){
-                        if(valves[i] instanceof ReplicationValve) {
-                            replicationValve =
-                                    (ReplicationValve)valves[i] ;
+                if (valves != null && valves.length > 0) {
+                    for (int i = 0; replicationValve == null && i < valves.length; i++) {
+                        if (valves[i] instanceof ReplicationValve) {
+                            replicationValve = (ReplicationValve) valves[i];
                         }
-                    }//for
+                    } // for
 
-                    if(replicationValve == null && log.isDebugEnabled()) {
+                    if (replicationValve == null && log.isDebugEnabled()) {
                         log.debug("no ReplicationValve found for CrossContext Support");
-                    }//endif
-                }//end if
-            }//endif
-        }//end if
-        if(replicationValve != null) {
+                    } // endif
+                } // end if
+            } // endif
+        } // end if
+        if (replicationValve != null) {
             replicationValve.registerReplicationSession(session);
         }
     }
@@ -207,7 +207,7 @@ public abstract class ClusterManagerBase extends ManagerBase implements ClusterM
         if (getCluster() == null) {
             Cluster cluster = getContext().getCluster();
             if (cluster instanceof CatalinaCluster) {
-                setCluster((CatalinaCluster)cluster);
+                setCluster((CatalinaCluster) cluster);
             }
         }
         if (cluster != null) {
diff --git a/java/org/apache/catalina/ha/session/ClusterSessionListener.java b/java/org/apache/catalina/ha/session/ClusterSessionListener.java
index 36ea41d932..8683fdf24a 100644
--- a/java/org/apache/catalina/ha/session/ClusterSessionListener.java
+++ b/java/org/apache/catalina/ha/session/ClusterSessionListener.java
@@ -27,44 +27,42 @@ import org.apache.tomcat.util.res.StringManager;
 
 /**
  * Receive replicated SessionMessage form other cluster node.
+ *
  * @author Peter Rossbach
  */
 public class ClusterSessionListener extends ClusterListener {
 
-    private static final Log log =
-        LogFactory.getLog(ClusterSessionListener.class);
+    private static final Log log = LogFactory.getLog(ClusterSessionListener.class);
     private static final StringManager sm = StringManager.getManager(ClusterSessionListener.class);
 
-    //--Constructor---------------------------------------------
+    // --Constructor---------------------------------------------
 
     public ClusterSessionListener() {
         // NO-OP
     }
 
-    //--Logic---------------------------------------------------
+    // --Logic---------------------------------------------------
 
     /**
-     * Callback from the cluster, when a message is received, The cluster will
-     * broadcast it invoking the messageReceived on the receiver.
+     * Callback from the cluster, when a message is received, The cluster will broadcast it invoking the messageReceived
+     * on the receiver.
      *
-     * @param myobj
-     *            ClusterMessage - the message received from the cluster
+     * @param myobj ClusterMessage - the message received from the cluster
      */
     @Override
     public void messageReceived(ClusterMessage myobj) {
         if (myobj instanceof SessionMessage) {
             SessionMessage msg = (SessionMessage) myobj;
             String ctxname = msg.getContextName();
-            //check if the message is a EVT_GET_ALL_SESSIONS,
-            //if so, wait until we are fully started up
-            Map<String,ClusterManager> managers = cluster.getManagers() ;
+            // check if the message is a EVT_GET_ALL_SESSIONS,
+            // if so, wait until we are fully started up
+            Map<String,ClusterManager> managers = cluster.getManagers();
             if (ctxname == null) {
-                for (Map.Entry<String, ClusterManager> entry :
-                        managers.entrySet()) {
+                for (Map.Entry<String,ClusterManager> entry : managers.entrySet()) {
                     if (entry.getValue() != null) {
                         entry.getValue().messageDataReceived(msg);
                     } else {
-                        //this happens a lot before the system has started
+                        // this happens a lot before the system has started
                         // up
                         if (log.isDebugEnabled()) {
                             log.debug(sm.getString("clusterSessionListener.noManager", entry.getKey()));
@@ -83,9 +81,9 @@ public class ClusterSessionListener extends ClusterListener {
                     // A no context manager message is replied in order to avoid
                     // timeout of GET_ALL_SESSIONS sync phase.
                     if (msg.getEventType() == SessionMessage.EVT_GET_ALL_SESSIONS) {
-                        SessionMessage replymsg = new SessionMessageImpl(ctxname,
-                                SessionMessage.EVT_ALL_SESSION_NOCONTEXTMANAGER,
-                                null, "NO-CONTEXT-MANAGER","NO-CONTEXT-MANAGER-" + ctxname);
+                        SessionMessage replymsg =
+                                new SessionMessageImpl(ctxname, SessionMessage.EVT_ALL_SESSION_NOCONTEXTMANAGER, null,
+                                        "NO-CONTEXT-MANAGER", "NO-CONTEXT-MANAGER-" + ctxname);
                         cluster.send(replymsg, msg.getAddress());
                     }
                 }
@@ -96,11 +94,10 @@ public class ClusterSessionListener extends ClusterListener {
     /**
      * Accept only SessionMessage
      *
-     * @param msg
-     *            ClusterMessage
-     * @return boolean - returns true to indicate that messageReceived should be
-     *         invoked. If false is returned, the messageReceived method will
-     *         not be invoked.
+     * @param msg ClusterMessage
+     *
+     * @return boolean - returns true to indicate that messageReceived should be invoked. If false is returned, the
+     *             messageReceived method will not be invoked.
      */
     @Override
     public boolean accept(ClusterMessage msg) {
diff --git a/java/org/apache/catalina/ha/session/DeltaManager.java b/java/org/apache/catalina/ha/session/DeltaManager.java
index d796c4cadf..979d36444c 100644
--- a/java/org/apache/catalina/ha/session/DeltaManager.java
+++ b/java/org/apache/catalina/ha/session/DeltaManager.java
@@ -40,21 +40,19 @@ import org.apache.tomcat.util.ExceptionUtils;
 import org.apache.tomcat.util.res.StringManager;
 
 /**
- * The DeltaManager manages replicated sessions by only replicating the deltas
- * in data. For applications written to handle this, the DeltaManager is the
- * optimal way of replicating data.
+ * The DeltaManager manages replicated sessions by only replicating the deltas in data. For applications written to
+ * handle this, the DeltaManager is the optimal way of replicating data.
  * <p>
- * This code is almost identical to StandardManager with a difference in how it
- * persists sessions and some modifications to it.
+ * This code is almost identical to StandardManager with a difference in how it persists sessions and some modifications
+ * to it.
  * <p>
- * <b>IMPLEMENTATION NOTE </b>: Correct behavior of session storing and
- * reloading depends upon external calls to the <code>start()</code> and
- * <code>stop()</code> methods of this class at the correct times.
+ * <b>IMPLEMENTATION NOTE </b>: Correct behavior of session storing and reloading depends upon external calls to the
+ * <code>start()</code> and <code>stop()</code> methods of this class at the correct times.
  *
  * @author Craig R. McClanahan
  * @author Peter Rossbach
  */
-public class DeltaManager extends ClusterManagerBase{
+public class DeltaManager extends ClusterManagerBase {
 
     // ---------------------------------------------------- Security Classes
     public final Log log = LogFactory.getLog(DeltaManager.class);
@@ -68,6 +66,7 @@ public class DeltaManager extends ClusterManagerBase{
 
     /**
      * The descriptive name of this Manager implementation (for logging).
+     *
      * @deprecated Unused. Will be removed in Tomcat 9
      */
     @Deprecated
@@ -76,44 +75,43 @@ public class DeltaManager extends ClusterManagerBase{
 
     private boolean expireSessionsOnShutdown = false;
     private boolean notifySessionListenersOnReplication = true;
-    private boolean notifyContainerListenersOnReplication  = true;
-    private volatile boolean stateTransferred = false ;
-    private volatile boolean noContextManagerReceived = false ;
+    private boolean notifyContainerListenersOnReplication = true;
+    private volatile boolean stateTransferred = false;
+    private volatile boolean noContextManagerReceived = false;
     private int stateTransferTimeout = 60;
     private boolean sendAllSessions = true;
-    private int sendAllSessionsSize = 1000 ;
+    private int sendAllSessionsSize = 1000;
 
     /**
      * wait time between send session block (default 2 sec)
      */
-    private int sendAllSessionsWaitTime = 2 * 1000 ;
-    private final ArrayList<SessionMessage> receivedMessageQueue =
-            new ArrayList<>();
-    private boolean receiverQueue = false ;
-    private boolean stateTimestampDrop = true ;
+    private int sendAllSessionsWaitTime = 2 * 1000;
+    private final ArrayList<SessionMessage> receivedMessageQueue = new ArrayList<>();
+    private boolean receiverQueue = false;
+    private boolean stateTimestampDrop = true;
     private volatile long stateTransferCreateSendTime;
 
     // -------------------------------------------------------- stats attributes
 
-    private long sessionReplaceCounter = 0 ;
-    private long counterReceive_EVT_GET_ALL_SESSIONS = 0 ;
-    private long counterReceive_EVT_ALL_SESSION_DATA = 0 ;
-    private long counterReceive_EVT_SESSION_CREATED = 0 ;
+    private long sessionReplaceCounter = 0;
+    private long counterReceive_EVT_GET_ALL_SESSIONS = 0;
+    private long counterReceive_EVT_ALL_SESSION_DATA = 0;
+    private long counterReceive_EVT_SESSION_CREATED = 0;
     private long counterReceive_EVT_SESSION_EXPIRED = 0;
-    private long counterReceive_EVT_SESSION_ACCESSED = 0 ;
+    private long counterReceive_EVT_SESSION_ACCESSED = 0;
     private long counterReceive_EVT_SESSION_DELTA = 0;
-    private int counterReceive_EVT_ALL_SESSION_TRANSFERCOMPLETE = 0 ;
-    private long counterReceive_EVT_CHANGE_SESSION_ID = 0 ;
-    private long counterReceive_EVT_ALL_SESSION_NOCONTEXTMANAGER = 0 ;
-    private long counterSend_EVT_GET_ALL_SESSIONS = 0 ;
-    private long counterSend_EVT_ALL_SESSION_DATA = 0 ;
+    private int counterReceive_EVT_ALL_SESSION_TRANSFERCOMPLETE = 0;
+    private long counterReceive_EVT_CHANGE_SESSION_ID = 0;
+    private long counterReceive_EVT_ALL_SESSION_NOCONTEXTMANAGER = 0;
+    private long counterSend_EVT_GET_ALL_SESSIONS = 0;
+    private long counterSend_EVT_ALL_SESSION_DATA = 0;
     private long counterSend_EVT_SESSION_CREATED = 0;
-    private long counterSend_EVT_SESSION_DELTA = 0 ;
+    private long counterSend_EVT_SESSION_DELTA = 0;
     private long counterSend_EVT_SESSION_ACCESSED = 0;
     private long counterSend_EVT_SESSION_EXPIRED = 0;
-    private int counterSend_EVT_ALL_SESSION_TRANSFERCOMPLETE = 0 ;
+    private int counterSend_EVT_ALL_SESSION_TRANSFERCOMPLETE = 0;
     private long counterSend_EVT_CHANGE_SESSION_ID = 0;
-    private int counterNoStateTransferred = 0 ;
+    private int counterNoStateTransferred = 0;
 
 
     // ------------------------------------------------------------- Constructor
@@ -270,8 +268,8 @@ public class DeltaManager extends ClusterManagerBase{
 
     /**
      * @return Returns the counterNoStateTransferred.
-     * @deprecated Use {@link #getCounterNoStateTransferred()}. Will be removed
-     *             in Tomcat 10 onwards.
+     *
+     * @deprecated Use {@link #getCounterNoStateTransferred()}. Will be removed in Tomcat 10 onwards.
      */
     @Deprecated
     public int getCounterNoStateTransfered() {
@@ -286,7 +284,7 @@ public class DeltaManager extends ClusterManagerBase{
     }
 
     public int getReceivedQueueSize() {
-        return receivedMessageQueue.size() ;
+        return receivedMessageQueue.size();
     }
 
     /**
@@ -295,6 +293,7 @@ public class DeltaManager extends ClusterManagerBase{
     public int getStateTransferTimeout() {
         return stateTransferTimeout;
     }
+
     /**
      * @param timeoutAllSession The timeout
      */
@@ -304,8 +303,8 @@ public class DeltaManager extends ClusterManagerBase{
 
     /**
      * @return <code>true</code> if the state transfer is complete.
-     * @deprecated Use {@link #getStateTransferred()}. Will be removed in Tomcat
-     *             10 onwards.
+     *
+     * @deprecated Use {@link #getStateTransferred()}. Will be removed in Tomcat 10 onwards.
      */
     @Deprecated
     public boolean getStateTransfered() {
@@ -314,9 +313,10 @@ public class DeltaManager extends ClusterManagerBase{
 
     /**
      * Set that state transferred is complete
+     *
      * @param stateTransferred Flag value
-     * @deprecated Use {@link #setStateTransferred(boolean)}. Will be removed in
-     *             Tomcat 10 onwards.
+     *
+     * @deprecated Use {@link #setStateTransferred(boolean)}. Will be removed in Tomcat 10 onwards.
      */
     @Deprecated
     public void setStateTransfered(boolean stateTransferred) {
@@ -332,6 +332,7 @@ public class DeltaManager extends ClusterManagerBase{
 
     /**
      * Set that state transferred is complete
+     *
      * @param stateTransferred Flag value
      */
     public void setStateTransferred(boolean stateTransferred) {
@@ -410,11 +411,9 @@ public class DeltaManager extends ClusterManagerBase{
     }
 
     /**
-     * @param notifyListenersCreateSessionOnReplication
-     *              The notifySessionListenersOnReplication to set.
+     * @param notifyListenersCreateSessionOnReplication The notifySessionListenersOnReplication to set.
      */
-    public void setNotifySessionListenersOnReplication(
-            boolean notifyListenersCreateSessionOnReplication) {
+    public void setNotifySessionListenersOnReplication(boolean notifyListenersCreateSessionOnReplication) {
         this.notifySessionListenersOnReplication = notifyListenersCreateSessionOnReplication;
     }
 
@@ -431,8 +430,7 @@ public class DeltaManager extends ClusterManagerBase{
         return notifyContainerListenersOnReplication;
     }
 
-    public void setNotifyContainerListenersOnReplication(
-            boolean notifyContainerListenersOnReplication) {
+    public void setNotifyContainerListenersOnReplication(boolean notifyContainerListenersOnReplication) {
         this.notifyContainerListenersOnReplication = notifyContainerListenersOnReplication;
     }
 
@@ -445,38 +443,35 @@ public class DeltaManager extends ClusterManagerBase{
     }
 
     /**
-     * Create new session with check maxActiveSessions and send session creation
-     * to other cluster nodes.
+     * Create new session with check maxActiveSessions and send session creation to other cluster nodes.
      *
-     * @param sessionId The session id that should be used for the session
+     * @param sessionId  The session id that should be used for the session
      * @param distribute <code>true</code> to replicate the new session
+     *
      * @return The session
      */
     public Session createSession(String sessionId, boolean distribute) {
-        DeltaSession session = (DeltaSession) super.createSession(sessionId) ;
+        DeltaSession session = (DeltaSession) super.createSession(sessionId);
         if (distribute) {
             sendCreateSession(session.getId(), session);
         }
         if (log.isDebugEnabled()) {
-            log.debug(sm.getString("deltaManager.createSession.newSession",
-                    session.getId(), Integer.valueOf(sessions.size())));
+            log.debug(sm.getString("deltaManager.createSession.newSession", session.getId(),
+                    Integer.valueOf(sessions.size())));
         }
         return session;
     }
 
     /**
      * Send create session event to all backup node
+     *
      * @param sessionId The session id of the session
-     * @param session The session object
+     * @param session   The session object
      */
     protected void sendCreateSession(String sessionId, DeltaSession session) {
-        if(cluster.getMembers().length > 0 ) {
-            SessionMessage msg =
-                new SessionMessageImpl(getName(),
-                                       SessionMessage.EVT_SESSION_CREATED,
-                                       null,
-                                       sessionId,
-                                       sessionId + "-" + System.currentTimeMillis());
+        if (cluster.getMembers().length > 0) {
+            SessionMessage msg = new SessionMessageImpl(getName(), SessionMessage.EVT_SESSION_CREATED, null, sessionId,
+                    sessionId + "-" + System.currentTimeMillis());
             if (log.isDebugEnabled()) {
                 log.debug(sm.getString("deltaManager.sendMessage.newSession", name, sessionId));
             }
@@ -488,10 +483,11 @@ public class DeltaManager extends ClusterManagerBase{
 
     /**
      * Send messages to other backup member (domain or all)
+     *
      * @param msg Session message
      */
     protected void send(SessionMessage msg) {
-        if(cluster != null) {
+        if (cluster != null) {
             cluster.send(msg);
         }
     }
@@ -564,24 +560,24 @@ public class DeltaManager extends ClusterManagerBase{
                 // serialize sessionID
                 byte[] data = serializeSessionId(newSessionID);
                 // notify change sessionID
-                SessionMessage msg = new SessionMessageImpl(getName(),
-                        SessionMessage.EVT_CHANGE_SESSION_ID, data,
-                        orgSessionID, orgSessionID + "-"
-                                + System.currentTimeMillis());
+                SessionMessage msg = new SessionMessageImpl(getName(), SessionMessage.EVT_CHANGE_SESSION_ID, data,
+                        orgSessionID, orgSessionID + "-" + System.currentTimeMillis());
                 msg.setTimestamp(System.currentTimeMillis());
                 counterSend_EVT_CHANGE_SESSION_ID++;
                 send(msg);
             } catch (IOException e) {
-                log.error(sm.getString("deltaManager.unableSerializeSessionID",
-                        newSessionID), e);
+                log.error(sm.getString("deltaManager.unableSerializeSessionID", newSessionID), e);
             }
         }
     }
 
     /**
      * serialize sessionID
+     *
      * @param sessionId Session id to serialize
+     *
      * @return byte array with serialized session id
+     *
      * @throws IOException if an input/output error occurs
      */
     protected byte[] serializeSessionId(String sessionId) throws IOException {
@@ -595,8 +591,11 @@ public class DeltaManager extends ClusterManagerBase{
 
     /**
      * Load sessionID
+     *
      * @param data serialized session id
+     *
      * @return session id
+     *
      * @throws IOException if an input/output error occurs
      */
     protected String deserializeSessionId(byte[] data) throws IOException {
@@ -607,18 +606,20 @@ public class DeltaManager extends ClusterManagerBase{
     }
 
     /**
-     * Load Deltarequest from external node
-     * Load the Class at container classloader
+     * Load Deltarequest from external node Load the Class at container classloader
+     *
      * @see DeltaRequest#readExternal(java.io.ObjectInput)
+     *
      * @param session Corresponding session
-     * @param data message data
+     * @param data    message data
+     *
      * @return The request
+     *
      * @throws ClassNotFoundException Serialization error
-     * @throws IOException IO error with serialization
+     * @throws IOException            IO error with serialization
      *
-     * @deprecated Unused. This will be removed in Tomcat 10.
-     *             Calling this method may result in a deadlock. See:
-     *             https://bz.apache.org/bugzilla/show_bug.cgi?id=62841
+     * @deprecated Unused. This will be removed in Tomcat 10. Calling this method may result in a deadlock. See:
+     *                 https://bz.apache.org/bugzilla/show_bug.cgi?id=62841
      */
     @Deprecated
     protected DeltaRequest deserializeDeltaRequest(DeltaSession session, byte[] data)
@@ -636,20 +637,21 @@ public class DeltaManager extends ClusterManagerBase{
 
     /**
      * serialize DeltaRequest
+     *
      * @see DeltaRequest#writeExternal(java.io.ObjectOutput)
      *
-     * @param session Associated session
+     * @param session      Associated session
      * @param deltaRequest The request to serialize
+     *
      * @return serialized delta request
+     *
      * @throws IOException IO error with serialization
      *
-     * @deprecated Unused. This will be removed in Tomcat 10.
-     *             Calling this method may result in a deadlock. See:
-     *             https://bz.apache.org/bugzilla/show_bug.cgi?id=62841
+     * @deprecated Unused. This will be removed in Tomcat 10. Calling this method may result in a deadlock. See:
+     *                 https://bz.apache.org/bugzilla/show_bug.cgi?id=62841
      */
     @Deprecated
-    protected byte[] serializeDeltaRequest(DeltaSession session, DeltaRequest deltaRequest)
-            throws IOException {
+    protected byte[] serializeDeltaRequest(DeltaSession session, DeltaRequest deltaRequest) throws IOException {
         session.lock();
         try {
             return deltaRequest.serialize();
@@ -664,13 +666,13 @@ public class DeltaManager extends ClusterManagerBase{
      * FIXME replace currently sessions with same id without notification.
      * <p>
      * FIXME SSO handling is not really correct with the session replacement!
+     *
      * @param data Serialized data
-     * @exception ClassNotFoundException
-     *                if a serialized class cannot be found during the reload
-     * @exception IOException
-     *                if an input/output error occurs
+     *
+     * @exception ClassNotFoundException if a serialized class cannot be found during the reload
+     * @exception IOException            if an input/output error occurs
      */
-    protected void deserializeSessions(byte[] data) throws ClassNotFoundException,IOException {
+    protected void deserializeSessions(byte[] data) throws ClassNotFoundException, IOException {
 
         // Open an input stream to the specified pathname, if any
         // Load the previously unloaded active sessions
@@ -683,25 +685,24 @@ public class DeltaManager extends ClusterManagerBase{
                 session.setManager(this);
                 session.setValid(true);
                 session.setPrimarySession(false);
-                //in case the nodes in the cluster are out of
-                //time synch, this will make sure that we have the
-                //correct timestamp, isValid returns true, cause
+                // in case the nodes in the cluster are out of
+                // time synch, this will make sure that we have the
+                // correct timestamp, isValid returns true, cause
                 // accessCount=1
                 session.access();
-                //make sure that the session gets ready to expire if
+                // make sure that the session gets ready to expire if
                 // needed
                 session.setAccessCount(0);
                 session.resetDeltaRequest();
                 // FIXME How inform other session id cache like SingleSignOn
                 // increment sessionCounter to correct stats report
-                if (findSession(session.getIdInternal()) == null ) {
+                if (findSession(session.getIdInternal()) == null) {
                     sessionCounter++;
                 } else {
                     sessionReplaceCounter++;
                     // FIXME better is to grap this sessions again !
                     if (log.isWarnEnabled()) {
-                        log.warn(sm.getString("deltaManager.loading.existing.session",
-                                session.getIdInternal()));
+                        log.warn(sm.getString("deltaManager.loading.existing.session", session.getIdInternal()));
                     }
                 }
                 add(session);
@@ -720,14 +721,14 @@ public class DeltaManager extends ClusterManagerBase{
 
 
     /**
-     * Save any currently active sessions in the appropriate persistence
-     * mechanism, if any. If persistence is not supported, this method returns
-     * without doing anything.
+     * Save any currently active sessions in the appropriate persistence mechanism, if any. If persistence is not
+     * supported, this method returns without doing anything.
      *
      * @param currentSessions Sessions to serialize
+     *
      * @return serialized data
-     * @exception IOException
-     *                if an input/output error occurs
+     *
+     * @exception IOException if an input/output error occurs
      */
     protected byte[] serializeSessions(Session[] currentSessions) throws IOException {
 
@@ -750,11 +751,11 @@ public class DeltaManager extends ClusterManagerBase{
     }
 
     /**
-     * Start this component and implement the requirements
-     * of {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
+     * Start this component and implement the requirements of
+     * {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
      *
-     * @exception LifecycleException if this component detects a fatal error
-     *  that prevents this component from being used
+     * @exception LifecycleException if this component detects a fatal error that prevents this component from being
+     *                                   used
      */
     @Override
     protected synchronized void startInternal() throws LifecycleException {
@@ -768,14 +769,13 @@ public class DeltaManager extends ClusterManagerBase{
                 return;
             } else {
                 if (log.isInfoEnabled()) {
-                    String type = "unknown" ;
-                    if( cluster.getContainer() instanceof Host){
-                        type = "Host" ;
-                    } else if( cluster.getContainer() instanceof Engine){
-                        type = "Engine" ;
+                    String type = "unknown";
+                    if (cluster.getContainer() instanceof Host) {
+                        type = "Host";
+                    } else if (cluster.getContainer() instanceof Engine) {
+                        type = "Engine";
                     }
-                    log.info(sm.getString("deltaManager.registerCluster",
-                            getName(), type, cluster.getClusterName()));
+                    log.info(sm.getString("deltaManager.registerCluster", getName(), type, cluster.getClusterName()));
                 }
             }
             if (log.isInfoEnabled()) {
@@ -794,38 +794,39 @@ public class DeltaManager extends ClusterManagerBase{
 
     /**
      * get from first session master the backup from all clustered sessions
+     *
      * @see #findSessionMasterMember()
      */
     public synchronized void getAllClusterSessions() {
         if (cluster != null && cluster.getMembers().length > 0) {
             long beforeSendTime = System.currentTimeMillis();
             Member mbr = findSessionMasterMember();
-            if(mbr == null) { // No domain member found
-                 return;
+            if (mbr == null) { // No domain member found
+                return;
             }
-            SessionMessage msg = new SessionMessageImpl(this.getName(),
-                    SessionMessage.EVT_GET_ALL_SESSIONS, null, "GET-ALL", "GET-ALL-" + getName());
+            SessionMessage msg = new SessionMessageImpl(this.getName(), SessionMessage.EVT_GET_ALL_SESSIONS, null,
+                    "GET-ALL", "GET-ALL-" + getName());
             msg.setTimestamp(beforeSendTime);
             // set reference time
-            stateTransferCreateSendTime = beforeSendTime ;
+            stateTransferCreateSendTime = beforeSendTime;
             // request session state
             counterSend_EVT_GET_ALL_SESSIONS++;
-            stateTransferred = false ;
+            stateTransferred = false;
             // FIXME This send call block the deploy thread, when sender waitForAck is enabled
             try {
-                synchronized(receivedMessageQueue) {
-                     receiverQueue = true ;
+                synchronized (receivedMessageQueue) {
+                    receiverQueue = true;
                 }
                 cluster.send(msg, mbr);
                 if (log.isInfoEnabled()) {
-                    log.info(sm.getString("deltaManager.waitForSessionState",
-                            getName(), mbr, Integer.valueOf(getStateTransferTimeout())));
+                    log.info(sm.getString("deltaManager.waitForSessionState", getName(), mbr,
+                            Integer.valueOf(getStateTransferTimeout())));
                 }
                 // FIXME At sender ack mode this method check only the state
-                //       transfer and resend is a problem!
+                // transfer and resend is a problem!
                 waitForSendAllSessions(beforeSendTime);
             } finally {
-                synchronized(receivedMessageQueue) {
+                synchronized (receivedMessageQueue) {
                     for (SessionMessage smsg : receivedMessageQueue) {
                         if (!stateTimestampDrop) {
                             messageReceived(smsg, smsg.getAddress());
@@ -836,19 +837,17 @@ public class DeltaManager extends ClusterManagerBase{
                                 messageReceived(smsg, smsg.getAddress());
                             } else {
                                 if (log.isWarnEnabled()) {
-                                    log.warn(sm.getString("deltaManager.dropMessage",
-                                            getName(),
-                                            smsg.getEventTypeString(),
-                                            new Date(stateTransferCreateSendTime),
+                                    log.warn(sm.getString("deltaManager.dropMessage", getName(),
+                                            smsg.getEventTypeString(), new Date(stateTransferCreateSendTime),
                                             new Date(smsg.getTimestamp())));
                                 }
                             }
                         }
                     }
                     receivedMessageQueue.clear();
-                    receiverQueue = false ;
+                    receiverQueue = false;
                 }
-           }
+            }
         } else {
             if (log.isInfoEnabled()) {
                 log.info(sm.getString("deltaManager.noMembers", getName()));
@@ -858,33 +857,35 @@ public class DeltaManager extends ClusterManagerBase{
 
     /**
      * Find the master of the session state
+     *
      * @return master member of sessions
      */
     protected Member findSessionMasterMember() {
         Member mbr = null;
         Member mbrs[] = cluster.getMembers();
-        if(mbrs.length != 0 ) {
+        if (mbrs.length != 0) {
             mbr = mbrs[0];
         }
-        if(mbr == null && log.isWarnEnabled()) {
-            log.warn(sm.getString("deltaManager.noMasterMember",getName(), ""));
+        if (mbr == null && log.isWarnEnabled()) {
+            log.warn(sm.getString("deltaManager.noMasterMember", getName(), ""));
         }
-        if(mbr != null && log.isDebugEnabled()) {
-            log.debug(sm.getString("deltaManager.foundMasterMember",getName(), mbr));
+        if (mbr != null && log.isDebugEnabled()) {
+            log.debug(sm.getString("deltaManager.foundMasterMember", getName(), mbr));
         }
         return mbr;
     }
 
     /**
-     * Wait that cluster session state is transferred or timeout after 60 Sec
-     * With stateTransferTimeout == -1 wait that backup is transferred (forever mode)
+     * Wait that cluster session state is transferred or timeout after 60 Sec With stateTransferTimeout == -1 wait that
+     * backup is transferred (forever mode)
+     *
      * @param beforeSendTime Start instant of the operation
      */
     protected void waitForSendAllSessions(long beforeSendTime) {
         long reqStart = System.currentTimeMillis();
-        long reqNow = reqStart ;
+        long reqNow = reqStart;
         boolean isTimeout = false;
-        if(getStateTransferTimeout() > 0) {
+        if (getStateTransferTimeout() > 0) {
             // wait that state is transferred with timeout check
             do {
                 try {
@@ -896,40 +897,40 @@ public class DeltaManager extends ClusterManagerBase{
                 isTimeout = ((reqNow - reqStart) > (1000L * getStateTransferTimeout()));
             } while ((!getStateTransferred()) && (!isTimeout) && (!isNoContextManagerReceived()));
         } else {
-            if(getStateTransferTimeout() == -1) {
+            if (getStateTransferTimeout() == -1) {
                 // wait that state is transferred
                 do {
                     try {
                         Thread.sleep(100);
                     } catch (Exception sleep) {
                     }
-                } while ((!getStateTransferred())&& (!isNoContextManagerReceived()));
+                } while ((!getStateTransferred()) && (!isNoContextManagerReceived()));
                 reqNow = System.currentTimeMillis();
             }
         }
         if (isTimeout) {
-            counterNoStateTransferred++ ;
-            log.error(sm.getString("deltaManager.noSessionState", getName(),
-                    new Date(beforeSendTime), Long.valueOf(reqNow - beforeSendTime)));
-        }else if (isNoContextManagerReceived()) {
+            counterNoStateTransferred++;
+            log.error(sm.getString("deltaManager.noSessionState", getName(), new Date(beforeSendTime),
+                    Long.valueOf(reqNow - beforeSendTime)));
+        } else if (isNoContextManagerReceived()) {
             if (log.isWarnEnabled()) {
-                log.warn(sm.getString("deltaManager.noContextManager", getName(),
-                        new Date(beforeSendTime), Long.valueOf(reqNow - beforeSendTime)));
+                log.warn(sm.getString("deltaManager.noContextManager", getName(), new Date(beforeSendTime),
+                        Long.valueOf(reqNow - beforeSendTime)));
             }
         } else {
             if (log.isInfoEnabled()) {
-                log.info(sm.getString("deltaManager.sessionReceived", getName(),
-                        new Date(beforeSendTime), Long.valueOf(reqNow - beforeSendTime)));
+                log.info(sm.getString("deltaManager.sessionReceived", getName(), new Date(beforeSendTime),
+                        Long.valueOf(reqNow - beforeSendTime)));
             }
         }
     }
 
     /**
-     * Stop this component and implement the requirements
-     * of {@link org.apache.catalina.util.LifecycleBase#stopInternal()}.
+     * Stop this component and implement the requirements of
+     * {@link org.apache.catalina.util.LifecycleBase#stopInternal()}.
      *
-     * @exception LifecycleException if this component detects a fatal error
-     *  that prevents this component from being used
+     * @exception LifecycleException if this component detects a fatal error that prevents this component from being
+     *                                   used
      */
     @Override
     protected synchronized void stopInternal() throws LifecycleException {
@@ -965,11 +966,10 @@ public class DeltaManager extends ClusterManagerBase{
     // Methods
 
     /**
-     * A message was received from another node, this is the callback method to
-     * implement if you are interested in receiving replication messages.
+     * A message was received from another node, this is the callback method to implement if you are interested in
+     * receiving replication messages.
      *
-     * @param cmsg -
-     *            the message received.
+     * @param cmsg - the message received.
      */
     @Override
     public void messageDataReceived(ClusterMessage cmsg) {
@@ -982,51 +982,45 @@ public class DeltaManager extends ClusterManagerBase{
                 case SessionMessage.EVT_SESSION_ACCESSED:
                 case SessionMessage.EVT_SESSION_DELTA:
                 case SessionMessage.EVT_CHANGE_SESSION_ID:
-                    synchronized(receivedMessageQueue) {
-                        if(receiverQueue) {
+                    synchronized (receivedMessageQueue) {
+                        if (receiverQueue) {
                             receivedMessageQueue.add(msg);
-                            return ;
+                            return;
                         }
                     }
-                   break;
+                    break;
                 default:
-                    //we didn't queue, do nothing
+                    // we didn't queue, do nothing
                     break;
-            } //switch
+            } // switch
 
             messageReceived(msg, msg.getAddress());
         }
     }
 
     /**
-     * When the request has been completed, the replication valve will notify
-     * the manager, and the manager will decide whether any replication is
-     * needed or not. If there is a need for replication, the manager will
-     * create a session message and that will be replicated. The cluster
-     * determines where it gets sent.
+     * When the request has been completed, the replication valve will notify the manager, and the manager will decide
+     * whether any replication is needed or not. If there is a need for replication, the manager will create a session
+     * message and that will be replicated. The cluster determines where it gets sent.
+     *
+     * @param sessionId - the sessionId that just completed.
      *
-     * @param sessionId -
-     *            the sessionId that just completed.
      * @return a SessionMessage to be sent,
      */
     @Override
     public ClusterMessage requestCompleted(String sessionId) {
-         return requestCompleted(sessionId, false);
+        return requestCompleted(sessionId, false);
     }
 
     /**
-     * When the request has been completed, the replication valve will notify
-     * the manager, and the manager will decide whether any replication is
-     * needed or not. If there is a need for replication, the manager will
-     * create a session message and that will be replicated. The cluster
-     * determines where it gets sent.
+     * When the request has been completed, the replication valve will notify the manager, and the manager will decide
+     * whether any replication is needed or not. If there is a need for replication, the manager will create a session
+     * message and that will be replicated. The cluster determines where it gets sent. Session expiration also calls
+     * this method, but with expires == true.
      *
-     * Session expiration also calls this method, but with expires == true.
+     * @param sessionId - the sessionId that just completed.
+     * @param expires   - whether this method has been called during session expiration
      *
-     * @param sessionId -
-     *            the sessionId that just completed.
-     * @param expires -
-     *            whether this method has been called during session expiration
      * @return a SessionMessage to be sent,
      */
     public ClusterMessage requestCompleted(String sessionId, boolean expires) {
@@ -1041,28 +1035,20 @@ public class DeltaManager extends ClusterManagerBase{
             }
             if (session.isDirty()) {
                 counterSend_EVT_SESSION_DELTA++;
-                msg = new SessionMessageImpl(getName(),
-                                             SessionMessage.EVT_SESSION_DELTA,
-                                             session.getDiff(),
-                                             sessionId,
-                                             sessionId + "-" + System.currentTimeMillis());
+                msg = new SessionMessageImpl(getName(), SessionMessage.EVT_SESSION_DELTA, session.getDiff(), sessionId,
+                        sessionId + "-" + System.currentTimeMillis());
             }
         } catch (IOException x) {
-            log.error(sm.getString("deltaManager.createMessage.unableCreateDeltaRequest",
-                    sessionId), x);
+            log.error(sm.getString("deltaManager.createMessage.unableCreateDeltaRequest", sessionId), x);
             return null;
         }
-        if(msg == null) {
-            if(!expires && !session.isPrimarySession()) {
+        if (msg == null) {
+            if (!expires && !session.isPrimarySession()) {
                 counterSend_EVT_SESSION_ACCESSED++;
-                msg = new SessionMessageImpl(getName(),
-                                             SessionMessage.EVT_SESSION_ACCESSED,
-                                             null,
-                                             sessionId,
-                                             sessionId + "-" + System.currentTimeMillis());
+                msg = new SessionMessageImpl(getName(), SessionMessage.EVT_SESSION_ACCESSED, null, sessionId,
+                        sessionId + "-" + System.currentTimeMillis());
                 if (log.isDebugEnabled()) {
-                    log.debug(sm.getString("deltaManager.createMessage.accessChangePrimary",
-                            getName(), sessionId));
+                    log.debug(sm.getString("deltaManager.createMessage.accessChangePrimary", getName(), sessionId));
                 }
             }
         } else { // log only outside synch block!
@@ -1073,88 +1059,81 @@ public class DeltaManager extends ClusterManagerBase{
         if (!expires) {
             session.setPrimarySession(true);
         }
-        //check to see if we need to send out an access message
+        // check to see if we need to send out an access message
         if (!expires && (msg == null)) {
             long replDelta = System.currentTimeMillis() - session.getLastTimeReplicated();
-            if (session.getMaxInactiveInterval() >=0 &&
-                    replDelta > (session.getMaxInactiveInterval() * 1000L)) {
+            if (session.getMaxInactiveInterval() >= 0 && replDelta > (session.getMaxInactiveInterval() * 1000L)) {
                 counterSend_EVT_SESSION_ACCESSED++;
-                msg = new SessionMessageImpl(getName(),
-                                             SessionMessage.EVT_SESSION_ACCESSED,
-                                             null,
-                                             sessionId,
-                                             sessionId + "-" + System.currentTimeMillis());
+                msg = new SessionMessageImpl(getName(), SessionMessage.EVT_SESSION_ACCESSED, null, sessionId,
+                        sessionId + "-" + System.currentTimeMillis());
                 if (log.isDebugEnabled()) {
-                    log.debug(sm.getString("deltaManager.createMessage.access",
-                            getName(), sessionId));
+                    log.debug(sm.getString("deltaManager.createMessage.access", getName(), sessionId));
                 }
             }
         }
 
-        //update last replicated time
+        // update last replicated time
         if (msg != null) {
-           session.setLastTimeReplicated(System.currentTimeMillis());
-           msg.setTimestamp(session.getLastTimeReplicated());
+            session.setLastTimeReplicated(System.currentTimeMillis());
+            msg.setTimestamp(session.getLastTimeReplicated());
         }
         return msg;
     }
+
     /**
      * Reset manager statistics
      */
     public synchronized void resetStatistics() {
-        processingTime = 0 ;
+        processingTime = 0;
         expiredSessions.set(0);
         synchronized (sessionCreationTiming) {
             sessionCreationTiming.clear();
-            while (sessionCreationTiming.size() <
-                    ManagerBase.TIMING_STATS_CACHE_SIZE) {
+            while (sessionCreationTiming.size() < ManagerBase.TIMING_STATS_CACHE_SIZE) {
                 sessionCreationTiming.add(null);
             }
         }
         synchronized (sessionExpirationTiming) {
             sessionExpirationTiming.clear();
-            while (sessionExpirationTiming.size() <
-                    ManagerBase.TIMING_STATS_CACHE_SIZE) {
+            while (sessionExpirationTiming.size() < ManagerBase.TIMING_STATS_CACHE_SIZE) {
                 sessionExpirationTiming.add(null);
             }
         }
-        rejectedSessions = 0 ;
-        sessionReplaceCounter = 0 ;
-        counterNoStateTransferred = 0 ;
+        rejectedSessions = 0;
+        sessionReplaceCounter = 0;
+        counterNoStateTransferred = 0;
         setMaxActive(getActiveSessions());
-        sessionCounter = getActiveSessions() ;
+        sessionCounter = getActiveSessions();
         counterReceive_EVT_ALL_SESSION_DATA = 0;
         counterReceive_EVT_GET_ALL_SESSIONS = 0;
-        counterReceive_EVT_SESSION_ACCESSED = 0 ;
-        counterReceive_EVT_SESSION_CREATED = 0 ;
-        counterReceive_EVT_SESSION_DELTA = 0 ;
-        counterReceive_EVT_SESSION_EXPIRED = 0 ;
+        counterReceive_EVT_SESSION_ACCESSED = 0;
+        counterReceive_EVT_SESSION_CREATED = 0;
+        counterReceive_EVT_SESSION_DELTA = 0;
+        counterReceive_EVT_SESSION_EXPIRED = 0;
         counterReceive_EVT_ALL_SESSION_TRANSFERCOMPLETE = 0;
         counterReceive_EVT_CHANGE_SESSION_ID = 0;
         counterSend_EVT_ALL_SESSION_DATA = 0;
         counterSend_EVT_GET_ALL_SESSIONS = 0;
-        counterSend_EVT_SESSION_ACCESSED = 0 ;
-        counterSend_EVT_SESSION_CREATED = 0 ;
-        counterSend_EVT_SESSION_DELTA = 0 ;
-        counterSend_EVT_SESSION_EXPIRED = 0 ;
+        counterSend_EVT_SESSION_ACCESSED = 0;
+        counterSend_EVT_SESSION_CREATED = 0;
+        counterSend_EVT_SESSION_DELTA = 0;
+        counterSend_EVT_SESSION_EXPIRED = 0;
         counterSend_EVT_ALL_SESSION_TRANSFERCOMPLETE = 0;
         counterSend_EVT_CHANGE_SESSION_ID = 0;
 
     }
 
-    //  -------------------------------------------------------- expire
+    // -------------------------------------------------------- expire
 
     /**
      * send session expired to other cluster nodes
      *
-     * @param id
-     *            session id
+     * @param id session id
      */
     protected void sessionExpired(String id) {
-        if(cluster.getMembers().length > 0 ) {
-            counterSend_EVT_SESSION_EXPIRED++ ;
-            SessionMessage msg = new SessionMessageImpl(getName(),
-                    SessionMessage.EVT_SESSION_EXPIRED, null, id, id+ "-EXPIRED-MSG");
+        if (cluster.getMembers().length > 0) {
+            counterSend_EVT_SESSION_EXPIRED++;
+            SessionMessage msg = new SessionMessageImpl(getName(), SessionMessage.EVT_SESSION_EXPIRED, null, id,
+                    id + "-EXPIRED-MSG");
             msg.setTimestamp(System.currentTimeMillis());
             if (log.isDebugEnabled()) {
                 log.debug(sm.getString("deltaManager.createMessage.expire", getName(), id));
@@ -1166,16 +1145,14 @@ public class DeltaManager extends ClusterManagerBase{
     /**
      * Expire all find sessions.
      */
-    public void expireAllLocalSessions()
-    {
+    public void expireAllLocalSessions() {
         long timeNow = System.currentTimeMillis();
         Session sessions[] = findSessions();
-        int expireDirect  = 0 ;
-        int expireIndirect = 0 ;
+        int expireDirect = 0;
+        int expireIndirect = 0;
 
         if (log.isDebugEnabled()) {
-            log.debug("Start expire all sessions " + getName() + " at " + timeNow +
-                    " sessioncount " + sessions.length);
+            log.debug("Start expire all sessions " + getName() + " at " + timeNow + " sessioncount " + sessions.length);
         }
         for (Session value : sessions) {
             if (value instanceof DeltaSession) {
@@ -1186,16 +1163,14 @@ public class DeltaManager extends ClusterManagerBase{
                         expireDirect++;
                     } else {
                         expireIndirect++;
-                    }//end if
-                }//end if
-            }//end if
-        }//for
+                    } // end if
+                } // end if
+            } // end if
+        } // for
         long timeEnd = System.currentTimeMillis();
         if (log.isDebugEnabled()) {
-            log.debug("End expire sessions " + getName() +
-                    " expire processingTime " + (timeEnd - timeNow) +
-                    " expired direct sessions: " + expireDirect +
-                    " expired direct sessions: " + expireIndirect);
+            log.debug("End expire sessions " + getName() + " expire processingTime " + (timeEnd - timeNow) +
+                    " expired direct sessions: " + expireDirect + " expired direct sessions: " + expireIndirect);
         }
     }
 
@@ -1204,18 +1179,15 @@ public class DeltaManager extends ClusterManagerBase{
         return new String[0];
     }
 
-    //  -------------------------------------------------------- message receive
+    // -------------------------------------------------------- message receive
 
     /**
-     * This method is called by the received thread when a SessionMessage has
-     * been received from one of the other nodes in the cluster.
+     * This method is called by the received thread when a SessionMessage has been received from one of the other nodes
+     * in the cluster.
      *
-     * @param msg -
-     *            the message received
-     * @param sender -
-     *            the sender of the message, this is used if we receive a
-     *            EVT_GET_ALL_SESSION message, so that we only reply to the
-     *            requesting node
+     * @param msg    - the message received
+     * @param sender - the sender of the message, this is used if we receive a EVT_GET_ALL_SESSION message, so that we
+     *                   only reply to the requesting node
      */
     protected void messageReceived(SessionMessage msg, Member sender) {
         Thread currentThread = Thread.currentThread();
@@ -1225,44 +1197,44 @@ public class DeltaManager extends ClusterManagerBase{
             ClassLoader[] loaders = getClassLoaders();
             currentThread.setContextClassLoader(loaders[0]);
             if (log.isDebugEnabled()) {
-                log.debug(sm.getString("deltaManager.receiveMessage.eventType",
-                        getName(), msg.getEventTypeString(), sender));
+                log.debug(sm.getString("deltaManager.receiveMessage.eventType", getName(), msg.getEventTypeString(),
+                        sender));
             }
 
             switch (msg.getEventType()) {
                 case SessionMessage.EVT_GET_ALL_SESSIONS:
-                    handleGET_ALL_SESSIONS(msg,sender);
+                    handleGET_ALL_SESSIONS(msg, sender);
                     break;
                 case SessionMessage.EVT_ALL_SESSION_DATA:
-                    handleALL_SESSION_DATA(msg,sender);
+                    handleALL_SESSION_DATA(msg, sender);
                     break;
                 case SessionMessage.EVT_ALL_SESSION_TRANSFERCOMPLETE:
-                    handleALL_SESSION_TRANSFERCOMPLETE(msg,sender);
+                    handleALL_SESSION_TRANSFERCOMPLETE(msg, sender);
                     break;
                 case SessionMessage.EVT_SESSION_CREATED:
-                    handleSESSION_CREATED(msg,sender);
+                    handleSESSION_CREATED(msg, sender);
                     break;
                 case SessionMessage.EVT_SESSION_EXPIRED:
-                    handleSESSION_EXPIRED(msg,sender);
+                    handleSESSION_EXPIRED(msg, sender);
                     break;
                 case SessionMessage.EVT_SESSION_ACCESSED:
-                    handleSESSION_ACCESSED(msg,sender);
+                    handleSESSION_ACCESSED(msg, sender);
                     break;
                 case SessionMessage.EVT_SESSION_DELTA:
-                   handleSESSION_DELTA(msg,sender);
-                   break;
+                    handleSESSION_DELTA(msg, sender);
+                    break;
                 case SessionMessage.EVT_CHANGE_SESSION_ID:
-                    handleCHANGE_SESSION_ID(msg,sender);
+                    handleCHANGE_SESSION_ID(msg, sender);
                     break;
                 case SessionMessage.EVT_ALL_SESSION_NOCONTEXTMANAGER:
-                    handleALL_SESSION_NOCONTEXTMANAGER(msg,sender);
+                    handleALL_SESSION_NOCONTEXTMANAGER(msg, sender);
                     break;
                 default:
-                    //we didn't recognize the message type, do nothing
+                    // we didn't recognize the message type, do nothing
                     break;
-            } //switch
+            } // switch
         } catch (Exception x) {
-            log.error(sm.getString("deltaManager.receiveMessage.error",getName()), x);
+            log.error(sm.getString("deltaManager.receiveMessage.error", getName()), x);
         } finally {
             currentThread.setContextClassLoader(contextLoader);
         }
@@ -1273,40 +1245,40 @@ public class DeltaManager extends ClusterManagerBase{
 
     /**
      * handle receive session state is complete transferred
-     * @param msg Session message
+     *
+     * @param msg    Session message
      * @param sender Member which sent the message
      */
     protected void handleALL_SESSION_TRANSFERCOMPLETE(SessionMessage msg, Member sender) {
-        counterReceive_EVT_ALL_SESSION_TRANSFERCOMPLETE++ ;
+        counterReceive_EVT_ALL_SESSION_TRANSFERCOMPLETE++;
         if (log.isDebugEnabled()) {
-            log.debug(sm.getString("deltaManager.receiveMessage.transfercomplete",
-                    getName(), sender.getHost(), Integer.valueOf(sender.getPort())));
+            log.debug(sm.getString("deltaManager.receiveMessage.transfercomplete", getName(), sender.getHost(),
+                    Integer.valueOf(sender.getPort())));
         }
-        stateTransferCreateSendTime = msg.getTimestamp() ;
-        stateTransferred = true ;
+        stateTransferCreateSendTime = msg.getTimestamp();
+        stateTransferred = true;
     }
 
     /**
      * handle receive session delta
-     * @param msg Session message
+     *
+     * @param msg    Session message
      * @param sender Member which sent the message
-     * @throws IOException IO error with serialization
+     *
+     * @throws IOException            IO error with serialization
      * @throws ClassNotFoundException Serialization error
      */
-    protected void handleSESSION_DELTA(SessionMessage msg, Member sender)
-            throws IOException, ClassNotFoundException {
+    protected void handleSESSION_DELTA(SessionMessage msg, Member sender) throws IOException, ClassNotFoundException {
         counterReceive_EVT_SESSION_DELTA++;
         byte[] delta = msg.getSession();
         DeltaSession session = (DeltaSession) findSession(msg.getSessionID());
         if (session == null) {
             if (log.isDebugEnabled()) {
-                log.debug(sm.getString("deltaManager.receiveMessage.delta.unknown",
-                        getName(), msg.getSessionID()));
+                log.debug(sm.getString("deltaManager.receiveMessage.delta.unknown", getName(), msg.getSessionID()));
             }
         } else {
             if (log.isDebugEnabled()) {
-                log.debug(sm.getString("deltaManager.receiveMessage.delta",
-                        getName(), msg.getSessionID()));
+                log.debug(sm.getString("deltaManager.receiveMessage.delta", getName(), msg.getSessionID()));
             }
 
             session.deserializeAndExecuteDeltaRequest(delta);
@@ -1315,17 +1287,18 @@ public class DeltaManager extends ClusterManagerBase{
 
     /**
      * handle receive session is access at other node ( primary session is now false)
-     * @param msg Session message
+     *
+     * @param msg    Session message
      * @param sender Member which sent the message
+     *
      * @throws IOException Propagated IO error
      */
-    protected void handleSESSION_ACCESSED(SessionMessage msg,Member sender) throws IOException {
+    protected void handleSESSION_ACCESSED(SessionMessage msg, Member sender) throws IOException {
         counterReceive_EVT_SESSION_ACCESSED++;
         DeltaSession session = (DeltaSession) findSession(msg.getSessionID());
         if (session != null) {
             if (log.isDebugEnabled()) {
-                log.debug(sm.getString("deltaManager.receiveMessage.accessed",
-                        getName(), msg.getSessionID()));
+                log.debug(sm.getString("deltaManager.receiveMessage.accessed", getName(), msg.getSessionID()));
             }
             session.access();
             session.setPrimarySession(false);
@@ -1335,17 +1308,18 @@ public class DeltaManager extends ClusterManagerBase{
 
     /**
      * handle receive session is expire at other node ( expire session also here)
-     * @param msg Session message
+     *
+     * @param msg    Session message
      * @param sender Member which sent the message
+     *
      * @throws IOException Propagated IO error
      */
-    protected void handleSESSION_EXPIRED(SessionMessage msg,Member sender) throws IOException {
+    protected void handleSESSION_EXPIRED(SessionMessage msg, Member sender) throws IOException {
         counterReceive_EVT_SESSION_EXPIRED++;
         DeltaSession session = (DeltaSession) findSession(msg.getSessionID());
         if (session != null) {
             if (log.isDebugEnabled()) {
-                log.debug(sm.getString("deltaManager.receiveMessage.expired",
-                        getName(), msg.getSessionID()));
+                log.debug(sm.getString("deltaManager.receiveMessage.expired", getName(), msg.getSessionID()));
             }
             session.expire(notifySessionListenersOnReplication, false);
         }
@@ -1353,14 +1327,14 @@ public class DeltaManager extends ClusterManagerBase{
 
     /**
      * handle receive new session is created at other node (create backup - primary false)
-     * @param msg Session message
+     *
+     * @param msg    Session message
      * @param sender Member which sent the message
      */
-    protected void handleSESSION_CREATED(SessionMessage msg,Member sender) {
+    protected void handleSESSION_CREATED(SessionMessage msg, Member sender) {
         counterReceive_EVT_SESSION_CREATED++;
         if (log.isDebugEnabled()) {
-            log.debug(sm.getString("deltaManager.receiveMessage.createNewSession",
-                    getName(), msg.getSessionID()));
+            log.debug(sm.getString("deltaManager.receiveMessage.createNewSession", getName(), msg.getSessionID()));
         }
         DeltaSession session = (DeltaSession) createEmptySession();
         session.setValid(true);
@@ -1377,12 +1351,14 @@ public class DeltaManager extends ClusterManagerBase{
 
     /**
      * handle receive sessions from other not ( restart )
-     * @param msg Session message
+     *
+     * @param msg    Session message
      * @param sender Member which sent the message
+     *
      * @throws ClassNotFoundException Serialization error
-     * @throws IOException IO error with serialization
+     * @throws IOException            IO error with serialization
      */
-    protected void handleALL_SESSION_DATA(SessionMessage msg,Member sender)
+    protected void handleALL_SESSION_DATA(SessionMessage msg, Member sender)
             throws ClassNotFoundException, IOException {
         counterReceive_EVT_ALL_SESSION_DATA++;
         if (log.isDebugEnabled()) {
@@ -1393,39 +1369,39 @@ public class DeltaManager extends ClusterManagerBase{
         if (log.isDebugEnabled()) {
             log.debug(sm.getString("deltaManager.receiveMessage.allSessionDataAfter", getName()));
         }
-        //stateTransferred = true;
+        // stateTransferred = true;
     }
 
     /**
      * Handle a get all sessions message from another node. Depending on {@link #sendAllSessions}, sessions are either
      * sent in a single message or in batches. Sending is complete when this method exits.
      *
-     * @param msg Session message
+     * @param msg    Session message
      * @param sender Member which sent the message
+     *
      * @throws IOException IO error sending messages
      */
     protected void handleGET_ALL_SESSIONS(SessionMessage msg, Member sender) throws IOException {
         counterReceive_EVT_GET_ALL_SESSIONS++;
-        //get a list of all the session from this manager
+        // get a list of all the session from this manager
         if (log.isDebugEnabled()) {
             log.debug(sm.getString("deltaManager.receiveMessage.unloadingBegin", getName()));
         }
         // Write the number of active sessions, followed by the details
         // get all sessions and serialize without sync
         Session[] currentSessions = findSessions();
-        long findSessionTimestamp = System.currentTimeMillis() ;
+        long findSessionTimestamp = System.currentTimeMillis();
         if (isSendAllSessions()) {
             sendSessions(sender, currentSessions, findSessionTimestamp);
         } else {
             // send sessions in batches
             int remain = currentSessions.length;
             for (int i = 0; i < currentSessions.length; i += getSendAllSessionsSize()) {
-                int len = i + getSendAllSessionsSize() > currentSessions.length ?
-                        currentSessions.length - i :
+                int len = i + getSendAllSessionsSize() > currentSessions.length ? currentSessions.length - i :
                         getSendAllSessionsSize();
                 Session[] sendSessions = new Session[len];
                 System.arraycopy(currentSessions, i, sendSessions, 0, len);
-                sendSessions(sender, sendSessions,findSessionTimestamp);
+                sendSessions(sender, sendSessions, findSessionTimestamp);
                 remain = remain - len;
                 if (getSendAllSessionsWaitTime() > 0 && remain > 0) {
                     try {
@@ -1436,12 +1412,11 @@ public class DeltaManager extends ClusterManagerBase{
             }
         }
 
-        SessionMessage newmsg = new SessionMessageImpl(name,
-                SessionMessage.EVT_ALL_SESSION_TRANSFERCOMPLETE, null, "SESSION-STATE-TRANSFERRED",
-                "SESSION-STATE-TRANSFERRED" + getName());
+        SessionMessage newmsg = new SessionMessageImpl(name, SessionMessage.EVT_ALL_SESSION_TRANSFERCOMPLETE, null,
+                "SESSION-STATE-TRANSFERRED", "SESSION-STATE-TRANSFERRED" + getName());
         newmsg.setTimestamp(findSessionTimestamp);
         if (log.isDebugEnabled()) {
-            log.debug(sm.getString("deltaManager.createMessage.allSessionTransferred",getName()));
+            log.debug(sm.getString("deltaManager.createMessage.allSessionTransferred", getName()));
         }
         counterSend_EVT_ALL_SESSION_TRANSFERCOMPLETE++;
         cluster.send(newmsg, sender);
@@ -1449,11 +1424,13 @@ public class DeltaManager extends ClusterManagerBase{
 
     /**
      * handle receive change sessionID at other node
-     * @param msg Session message
+     *
+     * @param msg    Session message
      * @param sender Member which sent the message
+     *
      * @throws IOException IO error with serialization
      */
-    protected void handleCHANGE_SESSION_ID(SessionMessage msg,Member sender) throws IOException {
+    protected void handleCHANGE_SESSION_ID(SessionMessage msg, Member sender) throws IOException {
         counterReceive_EVT_CHANGE_SESSION_ID++;
         DeltaSession session = (DeltaSession) findSession(msg.getSessionID());
         if (session != null) {
@@ -1467,33 +1444,35 @@ public class DeltaManager extends ClusterManagerBase{
 
     /**
      * handle receive no context manager.
-     * @param msg Session message
+     *
+     * @param msg    Session message
      * @param sender Member which sent the message
      */
     protected void handleALL_SESSION_NOCONTEXTMANAGER(SessionMessage msg, Member sender) {
-        counterReceive_EVT_ALL_SESSION_NOCONTEXTMANAGER++ ;
+        counterReceive_EVT_ALL_SESSION_NOCONTEXTMANAGER++;
         if (log.isDebugEnabled()) {
-            log.debug(sm.getString("deltaManager.receiveMessage.noContextManager",
-                    getName(), sender.getHost(), Integer.valueOf(sender.getPort())));
+            log.debug(sm.getString("deltaManager.receiveMessage.noContextManager", getName(), sender.getHost(),
+                    Integer.valueOf(sender.getPort())));
         }
-        noContextManagerReceived = true ;
+        noContextManagerReceived = true;
     }
 
     /**
      * send a block of session to sender
-     * @param sender Sender member
+     *
+     * @param sender          Sender member
      * @param currentSessions Sessions to send
-     * @param sendTimestamp Timestamp
+     * @param sendTimestamp   Timestamp
+     *
      * @throws IOException IO error sending messages
      */
-    protected void sendSessions(Member sender, Session[] currentSessions,long sendTimestamp)
-            throws IOException {
+    protected void sendSessions(Member sender, Session[] currentSessions, long sendTimestamp) throws IOException {
         byte[] data = serializeSessions(currentSessions);
         if (log.isDebugEnabled()) {
             log.debug(sm.getString("deltaManager.receiveMessage.unloadingAfter", getName()));
         }
-        SessionMessage newmsg = new SessionMessageImpl(name, SessionMessage.EVT_ALL_SESSION_DATA,
-                data, "SESSION-STATE", "SESSION-STATE-" + getName());
+        SessionMessage newmsg = new SessionMessageImpl(name, SessionMessage.EVT_ALL_SESSION_DATA, data, "SESSION-STATE",
+                "SESSION-STATE-" + getName());
         newmsg.setTimestamp(sendTimestamp);
         if (log.isDebugEnabled()) {
             log.debug(sm.getString("deltaManager.createMessage.allSessionData", getName()));
@@ -1512,8 +1491,8 @@ public class DeltaManager extends ClusterManagerBase{
         result.stateTransferTimeout = stateTransferTimeout;
         result.sendAllSessions = sendAllSessions;
         result.sendAllSessionsSize = sendAllSessionsSize;
-        result.sendAllSessionsWaitTime = sendAllSessionsWaitTime ;
-        result.stateTimestampDrop = stateTimestampDrop ;
+        result.sendAllSessionsWaitTime = sendAllSessionsWaitTime;
+        result.stateTimestampDrop = stateTimestampDrop;
         return result;
     }
 }
diff --git a/java/org/apache/catalina/ha/session/DeltaRequest.java b/java/org/apache/catalina/ha/session/DeltaRequest.java
index 50d5095ce6..7daadae0fe 100644
--- a/java/org/apache/catalina/ha/session/DeltaRequest.java
+++ b/java/org/apache/catalina/ha/session/DeltaRequest.java
@@ -31,9 +31,8 @@ import org.apache.juli.logging.LogFactory;
 import org.apache.tomcat.util.res.StringManager;
 
 /**
- * This class is used to track the series of actions that happens when
- * a request is executed. These actions will then translate into invocations of methods
- * on the actual session.
+ * This class is used to track the series of actions that happens when a request is executed. These actions will then
+ * translate into invocations of methods on the actual session.
  * <p>
  * This class is NOT thread safe. One DeltaRequest per session.
  */
@@ -74,16 +73,16 @@ public class DeltaRequest implements Externalizable {
     }
 
     public DeltaRequest(String sessionId, boolean recordAllActions) {
-        this.recordAllActions=recordAllActions;
-        if(sessionId != null) {
+        this.recordAllActions = recordAllActions;
+        if (sessionId != null) {
             setSessionId(sessionId);
         }
     }
 
 
     public void setAttribute(String name, Object value) {
-        int action = (value==null)?ACTION_REMOVE:ACTION_SET;
-        addAction(TYPE_ATTRIBUTE,action,name,value);
+        int action = (value == null) ? ACTION_REMOVE : ACTION_SET;
+        addAction(TYPE_ATTRIBUTE, action, name, value);
     }
 
     public void removeAttribute(String name) {
@@ -105,20 +104,22 @@ public class DeltaRequest implements Externalizable {
 
     /**
      * Only support principals from type {@link GenericPrincipal GenericPrincipal}
+     *
      * @param p Session principal
+     *
      * @see GenericPrincipal
      */
     public void setPrincipal(Principal p) {
-        int action = (p==null)?ACTION_REMOVE:ACTION_SET;
+        int action = (p == null) ? ACTION_REMOVE : ACTION_SET;
         GenericPrincipal gp = null;
         if (p != null) {
             if (p instanceof GenericPrincipal) {
                 gp = (GenericPrincipal) p;
-                if(log.isDebugEnabled()) {
-                    log.debug(sm.getString("deltaRequest.showPrincipal", p.getName() , getSessionId()));
+                if (log.isDebugEnabled()) {
+                    log.debug(sm.getString("deltaRequest.showPrincipal", p.getName(), getSessionId()));
                 }
             } else {
-                log.error(sm.getString("deltaRequest.wrongPrincipalClass",p.getClass().getName()));
+                log.error(sm.getString("deltaRequest.wrongPrincipalClass", p.getClass().getName()));
             }
         }
         addAction(TYPE_PRINCIPAL, action, NAME_PRINCIPAL, gp);
@@ -126,53 +127,50 @@ public class DeltaRequest implements Externalizable {
 
     public void setNew(boolean n) {
         int action = ACTION_SET;
-        addAction(TYPE_ISNEW,action,NAME_ISNEW,Boolean.valueOf(n));
+        addAction(TYPE_ISNEW, action, NAME_ISNEW, Boolean.valueOf(n));
     }
 
     public void setAuthType(String authType) {
-        int action = (authType==null)?ACTION_REMOVE:ACTION_SET;
-        addAction(TYPE_AUTHTYPE,action,NAME_AUTHTYPE, authType);
+        int action = (authType == null) ? ACTION_REMOVE : ACTION_SET;
+        addAction(TYPE_AUTHTYPE, action, NAME_AUTHTYPE, authType);
     }
 
     public void addSessionListener(SessionListener listener) {
-        addAction(TYPE_LISTENER, ACTION_SET, NAME_LISTENER ,listener);
+        addAction(TYPE_LISTENER, ACTION_SET, NAME_LISTENER, listener);
     }
 
     public void removeSessionListener(SessionListener listener) {
-        addAction(TYPE_LISTENER, ACTION_REMOVE, NAME_LISTENER ,listener);
+        addAction(TYPE_LISTENER, ACTION_REMOVE, NAME_LISTENER, listener);
     }
 
-    protected void addAction(int type,
-                             int action,
-                             String name,
-                             Object value) {
+    protected void addAction(int type, int action, String name, Object value) {
         AttributeInfo info = null;
-        if ( this.actionPool.size() > 0 ) {
+        if (this.actionPool.size() > 0) {
             try {
                 info = actionPool.removeFirst();
-            }catch ( Exception x ) {
-                log.error(sm.getString("deltaRequest.removeUnable"),x);
+            } catch (Exception x) {
+                log.error(sm.getString("deltaRequest.removeUnable"), x);
                 info = new AttributeInfo(type, action, name, value);
             }
-            info.init(type,action,name,value);
+            info.init(type, action, name, value);
         } else {
             info = new AttributeInfo(type, action, name, value);
         }
-        //if we have already done something to this attribute, make sure
-        //we don't send multiple actions across the wire
-        if ( !recordAllActions) {
+        // if we have already done something to this attribute, make sure
+        // we don't send multiple actions across the wire
+        if (!recordAllActions) {
             try {
                 actions.remove(info);
             } catch (java.util.NoSuchElementException x) {
-                //do nothing, we wanted to remove it anyway
+                // do nothing, we wanted to remove it anyway
             }
         }
-        //add the action
+        // add the action
         actions.addLast(info);
     }
 
     public void execute(DeltaSession session, boolean notifyListeners) {
-        if ( !this.sessionId.equals( session.getId() ) ) {
+        if (!this.sessionId.equals(session.getId())) {
             throw new java.lang.IllegalArgumentException(sm.getString("deltaRequest.ssid.mismatch"));
         }
         session.access();
@@ -242,20 +240,20 @@ public class DeltaRequest implements Externalizable {
                     break;
                 default:
                     log.warn(sm.getString("deltaRequest.invalidAttributeInfoType", info));
-            }//switch
-        }//for
+            }// switch
+        } // for
         session.endAccess();
         reset();
     }
 
     public void reset() {
-        while ( actions.size() > 0 ) {
+        while (actions.size() > 0) {
             try {
                 AttributeInfo info = actions.removeFirst();
                 info.recycle();
                 actionPool.addLast(info);
-            }catch  ( Exception x ) {
-                log.error(sm.getString("deltaRequest.removeUnable"),x);
+            } catch (Exception x) {
+                log.error(sm.getString("deltaRequest.removeUnable"), x);
             }
         }
         actions.clear();
@@ -264,12 +262,14 @@ public class DeltaRequest implements Externalizable {
     public String getSessionId() {
         return sessionId;
     }
+
     public void setSessionId(String sessionId) {
         this.sessionId = sessionId;
-        if ( sessionId == null ) {
+        if (sessionId == null) {
             new Exception(sm.getString("deltaRequest.ssid.null")).fillInStackTrace().printStackTrace();
         }
     }
+
     public int getSize() {
         return actions.size();
     }
@@ -280,11 +280,11 @@ public class DeltaRequest implements Externalizable {
     }
 
     @Override
-    public void readExternal(java.io.ObjectInput in) throws IOException,ClassNotFoundException {
-        //sessionId - String
-        //recordAll - boolean
-        //size - int
-        //AttributeInfo - in an array
+    public void readExternal(java.io.ObjectInput in) throws IOException, ClassNotFoundException {
+        // sessionId - String
+        // recordAll - boolean
+        // size - int
+        // AttributeInfo - in an array
         reset();
         sessionId = in.readUTF();
         recordAllActions = in.readBoolean();
@@ -299,8 +299,8 @@ public class DeltaRequest implements Externalizable {
             if (this.actionPool.size() > 0) {
                 try {
                     info = actionPool.removeFirst();
-                } catch ( Exception x )  {
-                    log.error(sm.getString("deltaRequest.removeUnable"),x);
+                } catch (Exception x) {
+                    log.error(sm.getString("deltaRequest.removeUnable"), x);
                     info = new AttributeInfo();
                 }
             } else {
@@ -308,16 +308,16 @@ public class DeltaRequest implements Externalizable {
             }
             info.readExternal(in);
             actions.addLast(info);
-        }//for
+        } // for
     }
 
 
     @Override
-    public void writeExternal(java.io.ObjectOutput out ) throws java.io.IOException {
-        //sessionId - String
-        //recordAll - boolean
-        //size - int
-        //AttributeInfo - in an array
+    public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException {
+        // sessionId - String
+        // recordAll - boolean
+        // size - int
+        // AttributeInfo - in an array
         out.writeUTF(getSessionId());
         out.writeBoolean(recordAllActions);
         out.writeInt(getSize());
@@ -328,9 +328,11 @@ public class DeltaRequest implements Externalizable {
 
     /**
      * serialize DeltaRequest
+     *
      * @see DeltaRequest#writeExternal(java.io.ObjectOutput)
      *
      * @return serialized delta request
+     *
      * @throws IOException IO error serializing
      */
     protected byte[] serialize() throws IOException {
@@ -352,18 +354,12 @@ public class DeltaRequest implements Externalizable {
             this(-1, -1, null, null);
         }
 
-        AttributeInfo(int type,
-                             int action,
-                             String name,
-                             Object value) {
+        AttributeInfo(int type, int action, String name, Object value) {
             super();
-            init(type,action,name,value);
+            init(type, action, name, value);
         }
 
-        public void init(int type,
-                         int action,
-                         String name,
-                         Object value) {
+        public void init(int type, int action, String name, Object value) {
             this.name = name;
             this.value = value;
             this.action = action;
@@ -381,6 +377,7 @@ public class DeltaRequest implements Externalizable {
         public Object getValue() {
             return value;
         }
+
         @Override
         public int hashCode() {
             return name.hashCode();
@@ -393,47 +390,47 @@ public class DeltaRequest implements Externalizable {
         public void recycle() {
             name = null;
             value = null;
-            type=-1;
-            action=-1;
+            type = -1;
+            action = -1;
         }
 
         @Override
         public boolean equals(Object o) {
-            if ( ! (o instanceof AttributeInfo ) ) {
+            if (!(o instanceof AttributeInfo)) {
                 return false;
             }
-            AttributeInfo other =  (AttributeInfo)o;
+            AttributeInfo other = (AttributeInfo) o;
             return other.getName().equals(this.getName());
         }
 
         @Override
-        public void readExternal(java.io.ObjectInput in ) throws IOException,ClassNotFoundException {
-            //type - int
-            //action - int
-            //name - String
-            //hasvalue - boolean
-            //value - object
+        public void readExternal(java.io.ObjectInput in) throws IOException, ClassNotFoundException {
+            // type - int
+            // action - int
+            // name - String
+            // hasvalue - boolean
+            // value - object
             type = in.readInt();
             action = in.readInt();
             name = in.readUTF();
             boolean hasValue = in.readBoolean();
-            if ( hasValue ) {
+            if (hasValue) {
                 value = in.readObject();
             }
         }
 
         @Override
         public void writeExternal(java.io.ObjectOutput out) throws IOException {
-            //type - int
-            //action - int
-            //name - String
-            //hasvalue - boolean
-            //value - object
+            // type - int
+            // action - int
+            // name - String
+            // hasvalue - boolean
+            // value - object
             out.writeInt(getType());
             out.writeInt(getAction());
             out.writeUTF(getName());
-            out.writeBoolean(getValue()!=null);
-            if (getValue()!=null) {
+            out.writeBoolean(getValue() != null);
+            if (getValue() != null) {
                 out.writeObject(getValue());
             }
         }
diff --git a/java/org/apache/catalina/ha/session/DeltaSession.java b/java/org/apache/catalina/ha/session/DeltaSession.java
index 5cd5329783..fd34e85435 100644
--- a/java/org/apache/catalina/ha/session/DeltaSession.java
+++ b/java/org/apache/catalina/ha/session/DeltaSession.java
@@ -49,10 +49,9 @@ import org.apache.tomcat.util.collections.SynchronizedStack;
 import org.apache.tomcat.util.res.StringManager;
 
 /**
- * Similar to the StandardSession except that this session will keep
- * track of deltas during a request.
+ * Similar to the StandardSession except that this session will keep track of deltas during a request.
  */
-public class DeltaSession extends StandardSession implements Externalizable,ClusterSession,ReplicatedMapEntry {
+public class DeltaSession extends StandardSession implements Externalizable, ClusterSession, ReplicatedMapEntry {
 
     public static final Log log = LogFactory.getLog(DeltaSession.class);
 
@@ -64,22 +63,19 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus
     // ----------------------------------------------------- Instance Variables
 
     /**
-     * only the primary session will expire, or be able to expire due to
-     * inactivity. This is set to false as soon as I receive this session over
-     * the wire in a session message. That means that someone else has made a
-     * request on another server.
+     * only the primary session will expire, or be able to expire due to inactivity. This is set to false as soon as I
+     * receive this session over the wire in a session message. That means that someone else has made a request on
+     * another server.
      */
     private transient boolean isPrimarySession = true;
 
     /**
      * The delta request contains all the action info
-     *
      */
     private transient DeltaRequest deltaRequest = null;
 
     /**
-     * Last time the session was replicated, used for distributed expiring of
-     * session
+     * Last time the session was replicated, used for distributed expiring of session
      */
     private transient long lastTimeReplicated = System.currentTimeMillis();
 
@@ -97,13 +93,12 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus
     /**
      * Construct a new Session associated with the specified Manager.
      *
-     * @param manager
-     *            The manager with which this Session is associated
+     * @param manager The manager with which this Session is associated
      */
     public DeltaSession(Manager manager) {
         super(manager);
-        boolean recordAllActions = manager instanceof ClusterManagerBase &&
-                ((ClusterManagerBase)manager).isRecordAllActions();
+        boolean recordAllActions =
+                manager instanceof ClusterManagerBase && ((ClusterManagerBase) manager).isRecordAllActions();
         deltaRequest = createRequest(getIdInternal(), recordAllActions);
     }
 
@@ -112,9 +107,8 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus
     }
 
     /*
-     * DeltaRequest instances are created via this protected method to enable
-     * sub-classes to over-ride the method to use custom DeltaRequest
-     * implementations.
+     * DeltaRequest instances are created via this protected method to enable sub-classes to over-ride the method to use
+     * custom DeltaRequest implementations.
      */
     protected DeltaRequest createRequest(String sessionId, boolean recordAllActions) {
         return new DeltaRequest(sessionId, recordAllActions);
@@ -123,18 +117,19 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus
     // ----------------------------------------------------- ReplicatedMapEntry
 
     /**
-     * Has the object changed since last replication
-     * and is not in a locked state
+     * Has the object changed since last replication and is not in a locked state
+     *
      * @return boolean
      */
     @Override
     public boolean isDirty() {
-        return getDeltaRequest().getSize()>0;
+        return getDeltaRequest().getSize() > 0;
     }
 
     /**
-     * If this returns true, the map will extract the diff using getDiff()
-     * Otherwise it will serialize the entire object.
+     * If this returns true, the map will extract the diff using getDiff() Otherwise it will serialize the entire
+     * object.
+     *
      * @return boolean
      */
     @Override
@@ -144,7 +139,9 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus
 
     /**
      * Returns a diff and sets the dirty map to false
+     *
      * @return a serialized view of the difference
+     *
      * @throws IOException IO error serializing
      */
     @Override
@@ -178,9 +175,9 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus
 
     public ClassLoader[] getClassLoaders() {
         if (manager instanceof ClusterManagerBase) {
-            return ((ClusterManagerBase)manager).getClassLoaders();
+            return ((ClusterManagerBase) manager).getClassLoaders();
         } else if (manager instanceof ManagerBase) {
-            ManagerBase mb = (ManagerBase)manager;
+            ManagerBase mb = (ManagerBase) manager;
             return ClusterManagerBase.getClassLoaders(mb.getContext());
         }
         return null;
@@ -188,9 +185,11 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus
 
     /**
      * Applies a diff to an existing object.
-     * @param diff Serialized diff data
+     *
+     * @param diff   Serialized diff data
      * @param offset Array offset
      * @param length Array length
+     *
      * @throws IOException IO error deserializing
      */
     @Override
@@ -205,7 +204,7 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus
                     currentThread.setContextClassLoader(loaders[0]);
                 }
                 getDeltaRequest().readExternal(stream);
-                getDeltaRequest().execute(this, ((ClusterManager)getManager()).isNotifyListenersOnReplication());
+                getDeltaRequest().execute(this, ((ClusterManager) getManager()).isNotifyListenersOnReplication());
             } finally {
                 currentThread.setContextClassLoader(contextLoader);
             }
@@ -227,8 +226,7 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus
     /**
      * {@inheritDoc}
      * <p>
-     * This implementation is a NO-OP. Any required locking takes place in the
-     * methods that make modifications.
+     * This implementation is a NO-OP. Any required locking takes place in the methods that make modifications.
      */
     @Override
     public void lock() {
@@ -238,8 +236,7 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus
     /**
      * {@inheritDoc}
      * <p>
-     * This implementation is a NO-OP. Any required unlocking takes place in the
-     * methods that make modifications.
+     * This implementation is a NO-OP. Any required unlocking takes place in the methods that make modifications.
      */
     @Override
     public void unlock() {
@@ -262,8 +259,8 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus
 
     @Override
     public void setOwner(Object owner) {
-        if ( owner instanceof ClusterManager && getManager()==null) {
-            ClusterManager cm = (ClusterManager)owner;
+        if (owner instanceof ClusterManager && getManager() == null) {
+            ClusterManager cm = (ClusterManager) owner;
             this.setManager(cm);
             this.setValid(true);
             this.setPrimarySession(false);
@@ -275,12 +272,13 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus
 
     /**
      * If this returns true, to replicate that an object has been accessed
+     *
      * @return boolean
      */
     @Override
     public boolean isAccessReplicate() {
         long replDelta = System.currentTimeMillis() - getLastTimeReplicated();
-        if (maxInactiveInterval >=0 && replDelta > (maxInactiveInterval * 1000L)) {
+        if (maxInactiveInterval >= 0 && replDelta > (maxInactiveInterval * 1000L)) {
             return true;
         }
         return false;
@@ -299,8 +297,7 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus
     // ----------------------------------------------------- Session Properties
 
     /**
-     * returns true if this session is the primary session, if that is the case,
-     * the manager can expire it upon timeout.
+     * returns true if this session is the primary session, if that is the case, the manager can expire it upon timeout.
      */
     @Override
     public boolean isPrimarySession() {
@@ -310,8 +307,7 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus
     /**
      * Sets whether this is the primary session or not.
      *
-     * @param primarySession
-     *            Flag value
+     * @param primarySession Flag value
      */
     @Override
     public void setPrimarySession(boolean primarySession) {
@@ -328,7 +324,7 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus
         lockInternal();
         try {
             deltaRequest.setSessionId(getIdInternal());
-        } finally{
+        } finally {
             unlockInternal();
         }
     }
@@ -337,8 +333,7 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus
     /**
      * Set the session identifier for this session.
      *
-     * @param id
-     *            The new session identifier
+     * @param id The new session identifier
      */
     @Override
     public void setId(String id) {
@@ -348,7 +343,7 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus
 
     @Override
     public void setMaxInactiveInterval(int interval) {
-        this.setMaxInactiveInterval(interval,true);
+        this.setMaxInactiveInterval(interval, true);
     }
 
 
@@ -367,8 +362,7 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus
     /**
      * Set the <code>isNew</code> flag for this session.
      *
-     * @param isNew
-     *            The new value for the <code>isNew</code> flag
+     * @param isNew The new value for the <code>isNew</code> flag
      */
     @Override
     public void setNew(boolean isNew) {
@@ -377,7 +371,7 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus
 
     public void setNew(boolean isNew, boolean addDeltaRequest) {
         super.setNew(isNew);
-        if (addDeltaRequest){
+        if (addDeltaRequest) {
             lockInternal();
             try {
                 deltaRequest.setNew(isNew);
@@ -388,13 +382,11 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus
     }
 
     /**
-     * Set the authenticated Principal that is associated with this Session.
-     * This provides an <code>Authenticator</code> with a means to cache a
-     * previously authenticated Principal, and avoid potentially expensive
+     * Set the authenticated Principal that is associated with this Session. This provides an <code>Authenticator</code>
+     * with a means to cache a previously authenticated Principal, and avoid potentially expensive
      * <code>Realm.authenticate()</code> calls on every request.
      *
-     * @param principal
-     *            The new Principal, or <code>null</code> if none
+     * @param principal The new Principal, or <code>null</code> if none
      */
     @Override
     public void setPrincipal(Principal principal) {
@@ -414,8 +406,7 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus
     }
 
     /**
-     * Set the authentication type used to authenticate our cached
-     * Principal, if any.
+     * Set the authentication type used to authenticate our cached Principal, if any.
      *
      * @param authType The new cached authentication type
      */
@@ -458,10 +449,10 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus
                 }
             } else {
                 if (timeIdle >= (2 * maxInactiveInterval)) {
-                    //if the session has been idle twice as long as allowed,
-                    //the primary session has probably crashed, and no other
-                    //requests are coming in. that is why we do this. otherwise
-                    //we would have a memory leak
+                    // if the session has been idle twice as long as allowed,
+                    // the primary session has probably crashed, and no other
+                    // requests are coming in. that is why we do this. otherwise
+                    // we would have a memory leak
                     expire(true, false);
                 }
             }
@@ -475,20 +466,19 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus
      */
     @Override
     public void endAccess() {
-        super.endAccess() ;
-        if(manager instanceof ClusterManagerBase) {
-            ((ClusterManagerBase)manager).registerSessionAtReplicationValve(this);
+        super.endAccess();
+        if (manager instanceof ClusterManagerBase) {
+            ((ClusterManagerBase) manager).registerSessionAtReplicationValve(this);
         }
     }
 
     // ------------------------------------------------- Session Public Methods
 
     /**
-     * Perform the internal processing required to invalidate this session,
-     * without triggering an exception if the session has already expired.
+     * Perform the internal processing required to invalidate this session, without triggering an exception if the
+     * session has already expired.
      *
-     * @param notify
-     *            Should we notify listeners about the demise of this session?
+     * @param notify Should we notify listeners about the demise of this session?
      */
     @Override
     public void expire(boolean notify) {
@@ -517,9 +507,8 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus
 
             String expiredId = getIdInternal();
 
-            if(notifyCluster && expiredId != null &&
-                    manager instanceof DeltaManager) {
-                DeltaManager dmanager = (DeltaManager)manager;
+            if (notifyCluster && expiredId != null && manager instanceof DeltaManager) {
+                DeltaManager dmanager = (DeltaManager) manager;
                 CatalinaCluster cluster = dmanager.getCluster();
                 ClusterMessage msg = dmanager.requestCompleted(expiredId, true);
                 if (msg != null) {
@@ -531,21 +520,18 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus
 
             if (notifyCluster) {
                 if (log.isDebugEnabled()) {
-                    log.debug(sm.getString("deltaSession.notifying",
-                                           ((ClusterManager)manager).getName(),
-                                           Boolean.valueOf(isPrimarySession()),
-                                           expiredId));
+                    log.debug(sm.getString("deltaSession.notifying", ((ClusterManager) manager).getName(),
+                            Boolean.valueOf(isPrimarySession()), expiredId));
                 }
-                if ( manager instanceof DeltaManager ) {
-                    ( (DeltaManager) manager).sessionExpired(expiredId);
+                if (manager instanceof DeltaManager) {
+                    ((DeltaManager) manager).sessionExpired(expiredId);
                 }
             }
         }
     }
 
     /**
-     * Release all object references, and initialize instance variables, in
-     * preparation for reuse of this object.
+     * Release all object references, and initialize instance variables, in preparation for reuse of this object.
      */
     @Override
     public void recycle() {
@@ -609,7 +595,7 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus
     // ------------------------------------------------ Session Package Methods
 
     @Override
-    public void readExternal(ObjectInput in) throws IOException,ClassNotFoundException {
+    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
         lockInternal();
         try {
             readObjectData(in);
@@ -620,41 +606,36 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus
 
 
     /**
-     * Read a serialized version of the contents of this session object from the
-     * specified object input stream, without requiring that the StandardSession
-     * itself have been serialized.
+     * Read a serialized version of the contents of this session object from the specified object input stream, without
+     * requiring that the StandardSession itself have been serialized.
      *
-     * @param stream
-     *            The object input stream to read from
+     * @param stream The object input stream to read from
      *
-     * @exception ClassNotFoundException
-     *                if an unknown class is specified
-     * @exception IOException
-     *                if an input/output error occurs
+     * @exception ClassNotFoundException if an unknown class is specified
+     * @exception IOException            if an input/output error occurs
      */
     @Override
     public void readObjectData(ObjectInputStream stream) throws ClassNotFoundException, IOException {
-        doReadObject((ObjectInput)stream);
+        doReadObject((ObjectInput) stream);
     }
+
     public void readObjectData(ObjectInput stream) throws ClassNotFoundException, IOException {
         doReadObject(stream);
     }
 
     /**
-     * Write a serialized version of the contents of this session object to the
-     * specified object output stream, without requiring that the
-     * StandardSession itself have been serialized.
+     * Write a serialized version of the contents of this session object to the specified object output stream, without
+     * requiring that the StandardSession itself have been serialized.
      *
-     * @param stream
-     *            The object output stream to write to
+     * @param stream The object output stream to write to
      *
-     * @exception IOException
-     *                if an input/output error occurs
+     * @exception IOException if an input/output error occurs
      */
     @Override
     public void writeObjectData(ObjectOutputStream stream) throws IOException {
-        writeObjectData((ObjectOutput)stream);
+        writeObjectData((ObjectOutput) stream);
     }
+
     public void writeObjectData(ObjectOutput stream) throws IOException {
         doWriteObject(stream);
     }
@@ -664,7 +645,7 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus
         try {
             deltaRequest.reset();
             deltaRequest.setSessionId(getIdInternal());
-        } finally{
+        } finally {
             unlockInternal();
         }
     }
@@ -676,8 +657,8 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus
     /**
      * Replace the existing deltaRequest with the provided replacement.
      *
-     * @param deltaRequest The new deltaRequest. Expected to be either a newly
-     *                     created object or an instance that has been reset.
+     * @param deltaRequest The new deltaRequest. Expected to be either a newly created object or an instance that has
+     *                         been reset.
      *
      * @return The old deltaRequest
      */
@@ -696,8 +677,7 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus
 
     protected void deserializeAndExecuteDeltaRequest(byte[] delta) throws IOException, ClassNotFoundException {
         if (manager instanceof ClusterManagerBase) {
-            SynchronizedStack<DeltaRequest> deltaRequestPool =
-                    ((ClusterManagerBase) manager).getDeltaRequestPool();
+            SynchronizedStack<DeltaRequest> deltaRequestPool = ((ClusterManagerBase) manager).getDeltaRequestPool();
 
             DeltaRequest newDeltaRequest = deltaRequestPool.pop();
             if (newDeltaRequest == null) {
@@ -728,29 +708,23 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus
     // ----------------------------------------------HttpSession Public Methods
 
     /**
-     * Remove the object bound with the specified name from this session. If the
-     * session does not have an object bound with this name, this method does
-     * nothing.
+     * Remove the object bound with the specified name from this session. If the session does not have an object bound
+     * with this name, this method does nothing.
      * <p>
-     * After this method executes, and if the object implements
-     * <code>HttpSessionBindingListener</code>, the container calls
-     * <code>valueUnbound()</code> on the object.
+     * After this method executes, and if the object implements <code>HttpSessionBindingListener</code>, the container
+     * calls <code>valueUnbound()</code> on the object.
      *
-     * @param name
-     *            Name of the object to remove from this session.
-     * @param notify
-     *            Should we notify interested listeners that this attribute is
-     *            being removed?
+     * @param name   Name of the object to remove from this session.
+     * @param notify Should we notify interested listeners that this attribute is being removed?
      *
-     * @exception IllegalStateException
-     *                if this method is called on an invalidated session
+     * @exception IllegalStateException if this method is called on an invalidated session
      */
     @Override
     public void removeAttribute(String name, boolean notify) {
         removeAttribute(name, notify, true);
     }
 
-    public void removeAttribute(String name, boolean notify,boolean addDeltaRequest) {
+    public void removeAttribute(String name, boolean notify, boolean addDeltaRequest) {
         // Validate our current state
         if (!isValid()) {
             throw new IllegalStateException(sm.getString("standardSession.removeAttribute.ise"));
@@ -759,30 +733,25 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus
     }
 
     /**
-     * Bind an object to this session, using the specified name. If an object of
-     * the same name is already bound to this session, the object is replaced.
+     * Bind an object to this session, using the specified name. If an object of the same name is already bound to this
+     * session, the object is replaced.
      * <p>
-     * After this method executes, and if the object implements
-     * <code>HttpSessionBindingListener</code>, the container calls
-     * <code>valueBound()</code> on the object.
+     * After this method executes, and if the object implements <code>HttpSessionBindingListener</code>, the container
+     * calls <code>valueBound()</code> on the object.
      *
-     * @param name
-     *            Name to which the object is bound, cannot be null
-     * @param value
-     *            Object to be bound, cannot be null
+     * @param name  Name to which the object is bound, cannot be null
+     * @param value Object to be bound, cannot be null
      *
-     * @exception IllegalArgumentException
-     *                if an attempt is made to add a non-serializable object in
-     *                an environment marked distributable.
-     * @exception IllegalStateException
-     *                if this method is called on an invalidated session
+     * @exception IllegalArgumentException if an attempt is made to add a non-serializable object in an environment
+     *                                         marked distributable.
+     * @exception IllegalStateException    if this method is called on an invalidated session
      */
     @Override
     public void setAttribute(String name, Object value) {
         setAttribute(name, value, true, true);
     }
 
-    public void setAttribute(String name, Object value, boolean notify,boolean addDeltaRequest) {
+    public void setAttribute(String name, Object value, boolean notify, boolean addDeltaRequest) {
 
         // Name cannot be null
         if (name == null) {
@@ -797,7 +766,7 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus
 
         lockInternal();
         try {
-            super.setAttribute(name,value, notify);
+            super.setAttribute(name, value, notify);
             if (addDeltaRequest && !exclude(name, value)) {
                 deltaRequest.setAttribute(name, value);
             }
@@ -856,36 +825,32 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus
     // -------------------------------------------- HttpSession Private Methods
 
     /**
-     * Read a serialized version of this session object from the specified
-     * object input stream.
+     * Read a serialized version of this session object from the specified object input stream.
      * <p>
-     * <b>IMPLEMENTATION NOTE </b>: The reference to the owning Manager is not
-     * restored by this method, and must be set explicitly.
+     * <b>IMPLEMENTATION NOTE </b>: The reference to the owning Manager is not restored by this method, and must be set
+     * explicitly.
      *
-     * @param stream
-     *            The input stream to read from
+     * @param stream The input stream to read from
      *
-     * @exception ClassNotFoundException
-     *                if an unknown class is specified
-     * @exception IOException
-     *                if an input/output error occurs
+     * @exception ClassNotFoundException if an unknown class is specified
+     * @exception IOException            if an input/output error occurs
      */
     @Override
     protected void doReadObject(ObjectInputStream stream) throws ClassNotFoundException, IOException {
-        doReadObject((ObjectInput)stream);
+        doReadObject((ObjectInput) stream);
     }
 
     private void doReadObject(ObjectInput stream) throws ClassNotFoundException, IOException {
 
         // Deserialize the scalar instance variables (except Manager)
         authType = null; // Transient only
-        creationTime = ( (Long) stream.readObject()).longValue();
-        lastAccessedTime = ( (Long) stream.readObject()).longValue();
-        maxInactiveInterval = ( (Integer) stream.readObject()).intValue();
-        isNew = ( (Boolean) stream.readObject()).booleanValue();
-        isValid = ( (Boolean) stream.readObject()).booleanValue();
-        thisAccessedTime = ( (Long) stream.readObject()).longValue();
-        version = ( (Long) stream.readObject()).longValue();
+        creationTime = ((Long) stream.readObject()).longValue();
+        lastAccessedTime = ((Long) stream.readObject()).longValue();
+        maxInactiveInterval = ((Integer) stream.readObject()).intValue();
+        isNew = ((Boolean) stream.readObject()).booleanValue();
+        isValid = ((Boolean) stream.readObject()).booleanValue();
+        thisAccessedTime = ((Long) stream.readObject()).longValue();
+        version = ((Long) stream.readObject()).longValue();
         boolean hasPrincipal = stream.readBoolean();
         principal = null;
         if (hasPrincipal) {
@@ -941,7 +906,7 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus
                 continue;
             }
             // ConcurrentHashMap does not allow null keys or values
-            if(null != value) {
+            if (null != value) {
                 attributes.put(name, value);
             }
         }
@@ -964,7 +929,7 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus
     }
 
     @Override
-    public void writeExternal(ObjectOutput out ) throws java.io.IOException {
+    public void writeExternal(ObjectOutput out) throws java.io.IOException {
         lockInternal();
         try {
             doWriteObject(out);
@@ -975,29 +940,22 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus
 
 
     /**
-     * Write a serialized version of this session object to the specified object
-     * output stream.
+     * Write a serialized version of this session object to the specified object output stream.
      * <p>
-     * <b>IMPLEMENTATION NOTE </b>: The owning Manager will not be stored in the
-     * serialized representation of this Session. After calling
-     * <code>readObject()</code>, you must set the associated Manager
-     * explicitly.
+     * <b>IMPLEMENTATION NOTE </b>: The owning Manager will not be stored in the serialized representation of this
+     * Session. After calling <code>readObject()</code>, you must set the associated Manager explicitly.
      * <p>
-     * <b>IMPLEMENTATION NOTE </b>: Any attribute that is not Serializable will
-     * be unbound from the session, with appropriate actions if it implements
-     * HttpSessionBindingListener. If you do not want any such attributes, be
-     * sure the <code>distributable</code> property of the associated Manager
-     * is set to <code>true</code>.
+     * <b>IMPLEMENTATION NOTE </b>: Any attribute that is not Serializable will be unbound from the session, with
+     * appropriate actions if it implements HttpSessionBindingListener. If you do not want any such attributes, be sure
+     * the <code>distributable</code> property of the associated Manager is set to <code>true</code>.
      *
-     * @param stream
-     *            The output stream to write to
+     * @param stream The output stream to write to
      *
-     * @exception IOException
-     *                if an input/output error occurs
+     * @exception IOException if an input/output error occurs
      */
     @Override
     protected void doWriteObject(ObjectOutputStream stream) throws IOException {
-        doWriteObject((ObjectOutput)stream);
+        doWriteObject((ObjectOutput) stream);
     }
 
     @SuppressWarnings("deprecation")
@@ -1035,8 +993,7 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus
         for (String key : keys) {
             Object value = null;
             value = attributes.get(key);
-            if (value != null && !exclude(key, value) &&
-                    isAttributeDistributable(key, value)) {
+            if (value != null && !exclude(key, value) && isAttributeDistributable(key, value)) {
                 saveNames.add(key);
                 saveValues.add(value);
             }
@@ -1046,7 +1003,7 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus
         int n = saveNames.size();
         stream.writeObject(Integer.valueOf(n));
         for (int i = 0; i < n; i++) {
-            stream.writeObject( saveNames.get(i));
+            stream.writeObject(saveNames.get(i));
             try {
                 stream.writeObject(saveValues.get(i));
             } catch (NotSerializableException e) {
@@ -1070,8 +1027,7 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus
 
     // -------------------------------------------------------- Private Methods
 
-    protected void removeAttributeInternal(String name, boolean notify,
-                                           boolean addDeltaRequest) {
+    protected void removeAttributeInternal(String name, boolean notify, boolean addDeltaRequest) {
         lockInternal();
         try {
             // Remove this attribute from our collection
@@ -1080,7 +1036,7 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus
                 return;
             }
 
-            super.removeAttributeInternal(name,notify);
+            super.removeAttributeInternal(name, notify);
             if (addDeltaRequest && !exclude(name, null)) {
                 deltaRequest.removeAttribute(name);
             }
@@ -1111,10 +1067,10 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus
     }
 
     protected void setAccessCount(int count) {
-        if ( accessCount == null && ACTIVITY_CHECK ) {
+        if (accessCount == null && ACTIVITY_CHECK) {
             accessCount = new AtomicInteger();
         }
-        if ( accessCount != null ) {
+        if (accessCount != null) {
             super.accessCount.set(count);
         }
     }
diff --git a/java/org/apache/catalina/ha/session/JvmRouteBinderValve.java b/java/org/apache/catalina/ha/session/JvmRouteBinderValve.java
index be01f158bb..195f7f0965 100644
--- a/java/org/apache/catalina/ha/session/JvmRouteBinderValve.java
+++ b/java/org/apache/catalina/ha/session/JvmRouteBinderValve.java
@@ -38,18 +38,13 @@ import org.apache.juli.logging.LogFactory;
 import org.apache.tomcat.util.res.StringManager;
 
 /**
- * Valve to handle Tomcat jvmRoute takeover using mod_jk module after node
- * failure. After a node crashes, subsequent requests go to other cluster nodes.
- * That incurs a drop in performance. When this Valve is enabled on a backup
- * node and sees a request, which was intended for another (thus failed) node,
- * it will rewrite the cookie jsessionid information to use the route to this
- * backup cluster node, that answered the request. After the response is
- * delivered to the client, all subsequent client requests will go directly to
- * the backup node. The change of sessionid is also sent to all other cluster
- * nodes. After all that, the session stickiness will work directly to the
- * backup node and the traffic will not go back to the failed node after it is
- * restarted!
- *
+ * Valve to handle Tomcat jvmRoute takeover using mod_jk module after node failure. After a node crashes, subsequent
+ * requests go to other cluster nodes. That incurs a drop in performance. When this Valve is enabled on a backup node
+ * and sees a request, which was intended for another (thus failed) node, it will rewrite the cookie jsessionid
+ * information to use the route to this backup cluster node, that answered the request. After the response is delivered
+ * to the client, all subsequent client requests will go directly to the backup node. The change of sessionid is also
+ * sent to all other cluster nodes. After all that, the session stickiness will work directly to the backup node and the
+ * traffic will not go back to the failed node after it is restarted!
  * <p>
  * Add this Valve to your cluster definition at conf/server.xml .
  *
@@ -60,11 +55,9 @@ import org.apache.tomcat.util.res.StringManager;
  * </pre>
  *
  * <em>A Trick:</em><br>
- * You can enable this mod_jk turnover mode via JMX before you drop a node to
- * all backup nodes! Set enable true on all JvmRouteBinderValve backups, disable
- * worker at mod_jk and then drop node and restart it! Then enable mod_jk worker
- * and disable JvmRouteBinderValves again. This use case means that only
- * requested sessions are migrated.
+ * You can enable this mod_jk turnover mode via JMX before you drop a node to all backup nodes! Set enable true on all
+ * JvmRouteBinderValve backups, disable worker at mod_jk and then drop node and restart it! Then enable mod_jk worker
+ * and disable JvmRouteBinderValves again. This use case means that only requested sessions are migrated.
  *
  * @author Peter Rossbach
  */
@@ -73,7 +66,7 @@ public class JvmRouteBinderValve extends ValveBase implements ClusterValve {
     /*--Static Variables----------------------------------------*/
     public static final Log log = LogFactory.getLog(JvmRouteBinderValve.class);
 
-    //------------------------------------------------------ Constructor
+    // ------------------------------------------------------ Constructor
     public JvmRouteBinderValve() {
         super(true);
     }
@@ -117,8 +110,7 @@ public class JvmRouteBinderValve extends ValveBase implements ClusterValve {
     /**
      * get name of failed request session attribute
      *
-     * @param sessionIdAttribute
-     *            The sessionIdAttribute to set.
+     * @param sessionIdAttribute The sessionIdAttribute to set.
      */
     public void setSessionIdAttribute(String sessionIdAttribute) {
         this.sessionIdAttribute = sessionIdAttribute;
@@ -139,8 +131,7 @@ public class JvmRouteBinderValve extends ValveBase implements ClusterValve {
     }
 
     /**
-     * @param enabled
-     *            The enabled to set.
+     * @param enabled The enabled to set.
      */
     public void setEnabled(boolean enabled) {
         this.enabled = enabled;
@@ -149,33 +140,24 @@ public class JvmRouteBinderValve extends ValveBase implements ClusterValve {
     /**
      * Detect possible the JVMRoute change at cluster backup node..
      *
-     * @param request
-     *            tomcat request being processed
-     * @param response
-     *            tomcat response being processed
-     * @exception IOException
-     *                if an input/output error has occurred
-     * @exception ServletException
-     *                if a servlet error has occurred
+     * @param request  tomcat request being processed
+     * @param response tomcat response being processed
+     *
+     * @exception IOException      if an input/output error has occurred
+     * @exception ServletException if a servlet error has occurred
      */
     @Override
-    public void invoke(Request request, Response response) throws IOException,
-            ServletException {
-
-         if (getEnabled() &&
-                 request.getContext() != null &&
-                 request.getContext().getDistributable() &&
-                 !request.isAsyncDispatching()) {
-             // valve cluster can access manager - other cluster handle turnover
-             // at host level - hopefully!
-             Manager manager = request.getContext().getManager();
-
-             if (manager != null && (
-                     (manager instanceof ClusterManager
-                       && getCluster() != null
-                       && getCluster().getManager(((ClusterManager)manager).getName()) != null)
-                     ||
-                     (manager instanceof PersistentManager))) {
+    public void invoke(Request request, Response response) throws IOException, ServletException {
+
+        if (getEnabled() && request.getContext() != null && request.getContext().getDistributable() &&
+                !request.isAsyncDispatching()) {
+            // valve cluster can access manager - other cluster handle turnover
+            // at host level - hopefully!
+            Manager manager = request.getContext().getManager();
+
+            if (manager != null && ((manager instanceof ClusterManager && getCluster() != null &&
+                    getCluster().getManager(((ClusterManager) manager).getName()) != null) ||
+                    (manager instanceof PersistentManager))) {
                 handlePossibleTurnover(request);
             }
         }
@@ -187,10 +169,11 @@ public class JvmRouteBinderValve extends ValveBase implements ClusterValve {
      * handle possible session turn over.
      *
      * @see JvmRouteBinderValve#handleJvmRoute(Request, String, String)
+     *
      * @param request current request
      */
     protected void handlePossibleTurnover(Request request) {
-        String sessionID = request.getRequestedSessionId() ;
+        String sessionID = request.getRequestedSessionId();
         if (sessionID != null) {
             long t1 = System.currentTimeMillis();
             String jvmRoute = getLocalJvmRoute(request);
@@ -200,7 +183,7 @@ public class JvmRouteBinderValve extends ValveBase implements ClusterValve {
                 }
                 return;
             }
-            handleJvmRoute( request, sessionID, jvmRoute);
+            handleJvmRoute(request, sessionID, jvmRoute);
             if (log.isDebugEnabled()) {
                 long t2 = System.currentTimeMillis();
                 long time = t2 - t1;
@@ -213,27 +196,29 @@ public class JvmRouteBinderValve extends ValveBase implements ClusterValve {
      * get jvmroute from engine
      *
      * @param request current request
+     *
      * @return return jvmRoute from ManagerBase or null
      */
     protected String getLocalJvmRoute(Request request) {
         Manager manager = getManager(request);
-        if(manager instanceof ManagerBase) {
+        if (manager instanceof ManagerBase) {
             return ((ManagerBase) manager).getJvmRoute();
         }
-        return null ;
+        return null;
     }
 
     /**
      * get ClusterManager
      *
      * @param request current request
+     *
      * @return manager or null
      */
     protected Manager getManager(Request request) {
         Manager manager = request.getContext().getManager();
         if (log.isDebugEnabled()) {
-            if(manager != null) {
-                log.debug(sm.getString("jvmRoute.foundManager", manager,  request.getContext().getName()));
+            if (manager != null) {
+                log.debug(sm.getString("jvmRoute.foundManager", manager, request.getContext().getName()));
             } else {
                 log.debug(sm.getString("jvmRoute.notFoundManager", request.getContext().getName()));
             }
@@ -258,18 +243,14 @@ public class JvmRouteBinderValve extends ValveBase implements ClusterValve {
     }
 
     /**
-     * Handle jvmRoute stickiness after tomcat instance failed. After this
-     * correction a new Cookie send to client with new jvmRoute and the
-     * SessionID change propagate to the other cluster nodes.
+     * Handle jvmRoute stickiness after tomcat instance failed. After this correction a new Cookie send to client with
+     * new jvmRoute and the SessionID change propagate to the other cluster nodes.
      *
-     * @param request current request
-     * @param sessionId
-     *            request SessionID from Cookie
-     * @param localJvmRoute
-     *            local jvmRoute
+     * @param request       current request
+     * @param sessionId     request SessionID from Cookie
+     * @param localJvmRoute local jvmRoute
      */
-    protected void handleJvmRoute(
-            Request request, String sessionId, String localJvmRoute) {
+    protected void handleJvmRoute(Request request, String sessionId, String localJvmRoute) {
         // get requested jvmRoute.
         String requestJvmRoute = null;
         int index = sessionId.indexOf('.');
@@ -278,8 +259,7 @@ public class JvmRouteBinderValve extends ValveBase implements ClusterValve {
         }
         if (requestJvmRoute != null && !requestJvmRoute.equals(localJvmRoute)) {
             if (log.isDebugEnabled()) {
-                log.debug(sm.getString("jvmRoute.failover", requestJvmRoute,
-                        localJvmRoute, sessionId));
+                log.debug(sm.getString("jvmRoute.failover", requestJvmRoute, localJvmRoute, sessionId));
             }
             Session catalinaSession = null;
             try {
@@ -291,8 +271,7 @@ public class JvmRouteBinderValve extends ValveBase implements ClusterValve {
             String newSessionID = id + "." + localJvmRoute;
             // OK - turnover the session and inform other cluster nodes
             if (catalinaSession != null) {
-                changeSessionID(request, sessionId, newSessionID,
-                        catalinaSession);
+                changeSessionID(request, sessionId, newSessionID, catalinaSession);
                 numberOfSessions++;
             } else {
                 try {
@@ -305,7 +284,7 @@ public class JvmRouteBinderValve extends ValveBase implements ClusterValve {
                     changeRequestSessionID(request, sessionId, newSessionID);
                 } else {
                     if (log.isDebugEnabled()) {
-                        log.debug(sm.getString("jvmRoute.cannotFindSession",sessionId));
+                        log.debug(sm.getString("jvmRoute.cannotFindSession", sessionId));
                     }
                 }
             }
@@ -315,34 +294,28 @@ public class JvmRouteBinderValve extends ValveBase implements ClusterValve {
     /**
      * change session id and send to all cluster nodes
      *
-     * @param request current request
-     * @param sessionId
-     *            original session id
-     * @param newSessionID
-     *            new session id for node migration
-     * @param catalinaSession
-     *            current session with original session id
+     * @param request         current request
+     * @param sessionId       original session id
+     * @param newSessionID    new session id for node migration
+     * @param catalinaSession current session with original session id
      */
-    protected void changeSessionID(Request request, String sessionId,
-            String newSessionID, Session catalinaSession) {
+    protected void changeSessionID(Request request, String sessionId, String newSessionID, Session catalinaSession) {
         fireLifecycleEvent("Before session migration", catalinaSession);
         catalinaSession.getManager().changeSessionId(catalinaSession, newSessionID);
         changeRequestSessionID(request, sessionId, newSessionID);
         changeSessionAuthenticationNote(sessionId, newSessionID, catalinaSession);
         fireLifecycleEvent("After session migration", catalinaSession);
         if (log.isDebugEnabled()) {
-            log.debug(sm.getString("jvmRoute.changeSession", sessionId,
-                    newSessionID));
+            log.debug(sm.getString("jvmRoute.changeSession", sessionId, newSessionID));
         }
     }
 
     /**
      * Change Request Session id
-     * @param request current request
-     * @param sessionId
-     *            original session id
-     * @param newSessionID
-     *            new session id for node migration
+     *
+     * @param request      current request
+     * @param sessionId    original session id
+     * @param newSessionID new session id for node migration
      */
     protected void changeRequestSessionID(Request request, String sessionId, String newSessionID) {
         request.changeSessionId(newSessionID);
@@ -351,7 +324,7 @@ public class JvmRouteBinderValve extends ValveBase implements ClusterValve {
         // change
         if (sessionIdAttribute != null && !sessionIdAttribute.isEmpty()) {
             if (log.isDebugEnabled()) {
-                log.debug(sm.getString("jvmRoute.set.originalsessionid",sessionIdAttribute,sessionId));
+                log.debug(sm.getString("jvmRoute.set.originalsessionid", sessionIdAttribute, sessionId));
             }
             request.setAttribute(sessionIdAttribute, sessionId);
         }
@@ -359,14 +332,13 @@ public class JvmRouteBinderValve extends ValveBase implements ClusterValve {
 
 
     /**
-     * Change the current session ID that is stored in a session note during
-     * authentication. It is part of the CSRF protection.
+     * Change the current session ID that is stored in a session note during authentication. It is part of the CSRF
+     * protection.
      *
-     * @param sessionId         The original session ID
-     * @param newSessionID      The new session ID for node migration
-     * @param catalinaSession   The session object (that will be using the new
-     *                              session ID at the point this method is
-     *                              called)
+     * @param sessionId       The original session ID
+     * @param newSessionID    The new session ID for node migration
+     * @param catalinaSession The session object (that will be using the new session ID at the point this method is
+     *                            called)
      */
     protected void changeSessionAuthenticationNote(String sessionId, String newSessionID, Session catalinaSession) {
         if (sessionId.equals(catalinaSession.getNote(Constants.SESSION_ID_NOTE))) {
@@ -376,11 +348,11 @@ public class JvmRouteBinderValve extends ValveBase implements ClusterValve {
 
 
     /**
-     * Start this component and implement the requirements
-     * of {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
+     * Start this component and implement the requirements of
+     * {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
      *
-     * @exception LifecycleException if this component detects a fatal error
-     *  that prevents this component from being used
+     * @exception LifecycleException if this component detects a fatal error that prevents this component from being
+     *                                   used
      */
     @Override
     protected synchronized void startInternal() throws LifecycleException {
@@ -388,7 +360,7 @@ public class JvmRouteBinderValve extends ValveBase implements ClusterValve {
         if (cluster == null) {
             Cluster containerCluster = getContainer().getCluster();
             if (containerCluster instanceof CatalinaCluster) {
-                setCluster((CatalinaCluster)containerCluster);
+                setCluster((CatalinaCluster) containerCluster);
             }
         }
 
@@ -404,11 +376,11 @@ public class JvmRouteBinderValve extends ValveBase implements ClusterValve {
 
 
     /**
-     * Stop this component and implement the requirements
-     * of {@link org.apache.catalina.util.LifecycleBase#stopInternal()}.
+     * Stop this component and implement the requirements of
+     * {@link org.apache.catalina.util.LifecycleBase#stopInternal()}.
      *
-     * @exception LifecycleException if this component detects a fatal error
-     *  that prevents this component from being used
+     * @exception LifecycleException if this component detects a fatal error that prevents this component from being
+     *                                   used
      */
     @Override
     protected synchronized void stopInternal() throws LifecycleException {
diff --git a/java/org/apache/catalina/ha/session/ReplicatedSessionListener.java b/java/org/apache/catalina/ha/session/ReplicatedSessionListener.java
index 412d64602f..a27ac9964b 100644
--- a/java/org/apache/catalina/ha/session/ReplicatedSessionListener.java
+++ b/java/org/apache/catalina/ha/session/ReplicatedSessionListener.java
@@ -21,9 +21,8 @@ import java.io.Serializable;
 import org.apache.catalina.SessionListener;
 
 /**
- * This is a marker interface used to indicate an implementation of
- * {@link SessionListener} that should be replicated with the session across the
- * cluster.
+ * This is a marker interface used to indicate an implementation of {@link SessionListener} that should be replicated
+ * with the session across the cluster.
  */
 public interface ReplicatedSessionListener extends SessionListener, Serializable {
 }
diff --git a/java/org/apache/catalina/ha/session/SessionMessage.java b/java/org/apache/catalina/ha/session/SessionMessage.java
index 8183ee653e..2688b291eb 100644
--- a/java/org/apache/catalina/ha/session/SessionMessage.java
+++ b/java/org/apache/catalina/ha/session/SessionMessage.java
@@ -15,23 +15,23 @@
  * limitations under the License.
  */
 package org.apache.catalina.ha.session;
+
 import org.apache.catalina.ha.ClusterMessage;
 
 /**
- * The SessionMessage interface is used when a session has been created,
- * modified, expired in a Tomcat cluster node.
+ * The SessionMessage interface is used when a session has been created, modified, expired in a Tomcat cluster node.
  * <p>
  * The following events are currently available:
  * <ul>
- *   <li>{@code public static final int EVT_SESSION_CREATED}</li>
- *   <li>{@code public static final int EVT_SESSION_EXPIRED}</li>
- *   <li>{@code public static final int EVT_SESSION_ACCESSED}</li>
- *   <li>{@code public static final int EVT_GET_ALL_SESSIONS}</li>
- *   <li>{@code public static final int EVT_SESSION_DELTA}</li>
- *   <li>{@code public static final int EVT_ALL_SESSION_DATA}</li>
- *   <li>{@code public static final int EVT_ALL_SESSION_TRANSFERCOMPLETE}</li>
- *   <li>{@code public static final int EVT_CHANGE_SESSION_ID}</li>
- *   <li>{@code public static final int EVT_ALL_SESSION_NOCONTEXTMANAGER}</li>
+ * <li>{@code public static final int EVT_SESSION_CREATED}</li>
+ * <li>{@code public static final int EVT_SESSION_EXPIRED}</li>
+ * <li>{@code public static final int EVT_SESSION_ACCESSED}</li>
+ * <li>{@code public static final int EVT_GET_ALL_SESSIONS}</li>
+ * <li>{@code public static final int EVT_SESSION_DELTA}</li>
+ * <li>{@code public static final int EVT_ALL_SESSION_DATA}</li>
+ * <li>{@code public static final int EVT_ALL_SESSION_TRANSFERCOMPLETE}</li>
+ * <li>{@code public static final int EVT_CHANGE_SESSION_ID}</li>
+ * <li>{@code public static final int EVT_ALL_SESSION_NOCONTEXTMANAGER}</li>
  * </ul>
  */
 public interface SessionMessage extends ClusterMessage {
@@ -46,22 +46,20 @@ public interface SessionMessage extends ClusterMessage {
     int EVT_SESSION_EXPIRED = 2;
 
     /**
-     * Event type used when a session has been accessed (ie, last access time
-     * has been updated. This is used so that the replicated sessions will not expire
-     * on the network
+     * Event type used when a session has been accessed (ie, last access time has been updated. This is used so that the
+     * replicated sessions will not expire on the network
      */
     int EVT_SESSION_ACCESSED = 3;
     /**
-     * Event type used when a server comes online for the first time.
-     * The first thing the newly started server wants to do is to grab the
-     * all the sessions from one of the nodes and keep the same state in there
+     * Event type used when a server comes online for the first time. The first thing the newly started server wants to
+     * do is to grab the all the sessions from one of the nodes and keep the same state in there
      */
     int EVT_GET_ALL_SESSIONS = 4;
     /**
-     * Event type used when an attribute has been added to a session,
-     * the attribute will be sent to all the other nodes in the cluster
+     * Event type used when an attribute has been added to a session, the attribute will be sent to all the other nodes
+     * in the cluster
      */
-    int EVT_SESSION_DELTA  = 13;
+    int EVT_SESSION_DELTA = 13;
 
     /**
      * When a session state is transferred, this is the event.
@@ -79,8 +77,8 @@ public interface SessionMessage extends ClusterMessage {
     int EVT_CHANGE_SESSION_ID = 15;
 
     /**
-     * Event type used when context manager doesn't exist.
-     * This is used when the manager which send a session state does not exist.
+     * Event type used when context manager doesn't exist. This is used when the manager which send a session state does
+     * not exist.
      */
     int EVT_ALL_SESSION_NOCONTEXTMANAGER = 16;
 
@@ -90,17 +88,20 @@ public interface SessionMessage extends ClusterMessage {
 
     /**
      * returns the event type
+     *
      * @return one of the event types EVT_XXXX
      */
     int getEventType();
+
     /**
      * @return the serialized data for the session
      */
     byte[] getSession();
+
     /**
      * @return the session ID for the session
      */
     String getSessionID();
 
 
-}//SessionMessage
+}// SessionMessage
diff --git a/java/org/apache/catalina/ha/session/SessionMessageImpl.java b/java/org/apache/catalina/ha/session/SessionMessageImpl.java
index b6ce9cf03e..3c2884ae9a 100644
--- a/java/org/apache/catalina/ha/session/SessionMessageImpl.java
+++ b/java/org/apache/catalina/ha/session/SessionMessageImpl.java
@@ -38,15 +38,11 @@ public class SessionMessageImpl extends ClusterMessageBase implements SessionMes
 
     private final String mContextName;
     private long serializationTimestamp;
-    private boolean timestampSet = false ;
+    private boolean timestampSet = false;
     private String uniqueId;
 
 
-    private SessionMessageImpl( String contextName,
-                           int eventtype,
-                           byte[] session,
-                           String sessionID)
-    {
+    private SessionMessageImpl(String contextName, int eventtype, byte[] session, String sessionID) {
         mEvtType = eventtype;
         mSession = session;
         mSessionID = sessionID;
@@ -55,105 +51,117 @@ public class SessionMessageImpl extends ClusterMessageBase implements SessionMes
     }
 
     /**
-     * Creates a session message. Depending on what event type you want this
-     * message to represent, you populate the different parameters in the constructor<BR>
-      * The following rules apply dependent on what event type argument you use:<BR>
+     * Creates a session message. Depending on what event type you want this message to represent, you populate the
+     * different parameters in the constructor<BR>
+     * The following rules apply dependent on what event type argument you use:<BR>
      * <B>EVT_SESSION_CREATED</B><BR>
-     *    The parameters: session, sessionID must be set.<BR>
+     * The parameters: session, sessionID must be set.<BR>
      * <B>EVT_SESSION_EXPIRED</B><BR>
-     *    The parameters: sessionID must be set.<BR>
+     * The parameters: sessionID must be set.<BR>
      * <B>EVT_SESSION_ACCESSED</B><BR>
-     *    The parameters: sessionID must be set.<BR>
+     * The parameters: sessionID must be set.<BR>
      * <B>EVT_GET_ALL_SESSIONS</B><BR>
-     *    get all sessions from from one of the nodes.<BR>
+     * get all sessions from from one of the nodes.<BR>
      * <B>EVT_SESSION_DELTA</B><BR>
-     *    Send attribute delta (add,update,remove attribute or principal, ...).<BR>
+     * Send attribute delta (add,update,remove attribute or principal, ...).<BR>
      * <B>EVT_ALL_SESSION_DATA</B><BR>
-     *    Send complete serializes session list<BR>
+     * Send complete serializes session list<BR>
      * <B>EVT_ALL_SESSION_TRANSFERCOMPLETE</B><BR>
-     *    send that all session state information are transferred
-     *    after GET_ALL_SESSION received from this sender.<BR>
+     * send that all session state information are transferred after GET_ALL_SESSION received from this sender.<BR>
      * <B>EVT_CHANGE_SESSION_ID</B><BR>
-     *    send original sessionID and new sessionID.<BR>
+     * send original sessionID and new sessionID.<BR>
      * <B>EVT_ALL_SESSION_NOCONTEXTMANAGER</B><BR>
-     *    send that context manager does not exist
-     *    after GET_ALL_SESSION received from this sender.<BR>
+     * send that context manager does not exist after GET_ALL_SESSION received from this sender.<BR>
+     *
      * @param contextName - the name of the context (application
-     * @param eventtype - one of the 8 event type defined in this class
-     * @param session - the serialized byte array of the session itself
-     * @param sessionID - the id that identifies this session
-     * @param uniqueID - the id that identifies this message
+     * @param eventtype   - one of the 8 event type defined in this class
+     * @param session     - the serialized byte array of the session itself
+     * @param sessionID   - the id that identifies this session
+     * @param uniqueID    - the id that identifies this message
      */
-    public SessionMessageImpl( String contextName,
-                           int eventtype,
-                           byte[] session,
-                           String sessionID,
-                           String uniqueID)
-    {
-        this(contextName,eventtype,session,sessionID);
+    public SessionMessageImpl(String contextName, int eventtype, byte[] session, String sessionID, String uniqueID) {
+        this(contextName, eventtype, session, sessionID);
         uniqueId = uniqueID;
     }
 
     /**
      * returns the event type
+     *
      * @return one of the event types EVT_XXXX
      */
     @Override
-    public int getEventType() { return mEvtType; }
+    public int getEventType() {
+        return mEvtType;
+    }
 
     /**
      * @return the serialized data for the session
      */
     @Override
-    public byte[] getSession() { return mSession;}
+    public byte[] getSession() {
+        return mSession;
+    }
 
     /**
      * @return the session ID for the session
      */
     @Override
-    public String getSessionID(){ return mSessionID; }
+    public String getSessionID() {
+        return mSessionID;
+    }
 
     /**
      * set message send time but only the first setting works (one shot)
      */
     @Override
     public void setTimestamp(long time) {
-        synchronized(this) {
-            if(!timestampSet) {
-                serializationTimestamp=time;
-                timestampSet = true ;
+        synchronized (this) {
+            if (!timestampSet) {
+                serializationTimestamp = time;
+                timestampSet = true;
             }
         }
     }
 
     @Override
-    public long getTimestamp() { return serializationTimestamp;}
+    public long getTimestamp() {
+        return serializationTimestamp;
+    }
 
     /**
      * clear text event type name (for logging purpose only)
+     *
      * @return the event type in a string representation, useful for debugging
      */
     @Override
-    public String getEventTypeString()
-    {
-        switch (mEvtType)
-        {
-            case EVT_SESSION_CREATED : return "SESSION-MODIFIED";
-            case EVT_SESSION_EXPIRED : return "SESSION-EXPIRED";
-            case EVT_SESSION_ACCESSED : return "SESSION-ACCESSED";
-            case EVT_GET_ALL_SESSIONS : return "SESSION-GET-ALL";
-            case EVT_SESSION_DELTA : return "SESSION-DELTA";
-            case EVT_ALL_SESSION_DATA : return "ALL-SESSION-DATA";
-            case EVT_ALL_SESSION_TRANSFERCOMPLETE : return "SESSION-STATE-TRANSFERRED";
-            case EVT_CHANGE_SESSION_ID : return "SESSION-ID-CHANGED";
-            case EVT_ALL_SESSION_NOCONTEXTMANAGER : return "NO-CONTEXT-MANAGER";
-            default : return "UNKNOWN-EVENT-TYPE";
+    public String getEventTypeString() {
+        switch (mEvtType) {
+            case EVT_SESSION_CREATED:
+                return "SESSION-MODIFIED";
+            case EVT_SESSION_EXPIRED:
+                return "SESSION-EXPIRED";
+            case EVT_SESSION_ACCESSED:
+                return "SESSION-ACCESSED";
+            case EVT_GET_ALL_SESSIONS:
+                return "SESSION-GET-ALL";
+            case EVT_SESSION_DELTA:
+                return "SESSION-DELTA";
+            case EVT_ALL_SESSION_DATA:
+                return "ALL-SESSION-DATA";
+            case EVT_ALL_SESSION_TRANSFERCOMPLETE:
+                return "SESSION-STATE-TRANSFERRED";
+            case EVT_CHANGE_SESSION_ID:
+                return "SESSION-ID-CHANGED";
+            case EVT_ALL_SESSION_NOCONTEXTMANAGER:
+                return "NO-CONTEXT-MANAGER";
+            default:
+                return "UNKNOWN-EVENT-TYPE";
         }
     }
 
     @Override
     public String getContextName() {
-       return mContextName;
+        return mContextName;
     }
 
     @Override
@@ -163,6 +171,6 @@ public class SessionMessageImpl extends ClusterMessageBase implements SessionMes
 
     @Override
     public String toString() {
-        return getEventTypeString() + "#" + getContextName() + "#" + getSessionID() ;
+        return getEventTypeString() + "#" + getContextName() + "#" + getSessionID();
     }
 }
diff --git a/java/org/apache/catalina/ha/tcp/Constants.java b/java/org/apache/catalina/ha/tcp/Constants.java
index 869fa2b2f0..7b7c34c0ac 100644
--- a/java/org/apache/catalina/ha/tcp/Constants.java
+++ b/java/org/apache/catalina/ha/tcp/Constants.java
@@ -17,8 +17,7 @@
 package org.apache.catalina.ha.tcp;
 
 /**
- * Manifest constants for the <code>org.apache.catalina.ha.tcp</code>
- * package.
+ * Manifest constants for the <code>org.apache.catalina.ha.tcp</code> package.
  *
  * @author Peter Rossbach
  */
diff --git a/java/org/apache/catalina/ha/tcp/ReplicationValve.java b/java/org/apache/catalina/ha/tcp/ReplicationValve.java
index d141106f13..fbe34e8687 100644
--- a/java/org/apache/catalina/ha/tcp/ReplicationValve.java
+++ b/java/org/apache/catalina/ha/tcp/ReplicationValve.java
@@ -46,23 +46,23 @@ import org.apache.juli.logging.LogFactory;
 import org.apache.tomcat.util.res.StringManager;
 
 /**
- * <p>Implementation of a Valve that logs interesting contents from the
- * specified Request (before processing) and the corresponding Response
- * (after processing).  It is especially useful in debugging problems
- * related to headers and cookies.</p>
- *
- * <p>This Valve may be attached to any Container, depending on the granularity
- * of the logging you wish to perform.</p>
- *
- * <p>primaryIndicator=true, then the request attribute <i>org.apache.catalina.ha.tcp.isPrimarySession.</i>
- * is set true, when request processing is at sessions primary node.
+ * <p>
+ * Implementation of a Valve that logs interesting contents from the specified Request (before processing) and the
+ * corresponding Response (after processing). It is especially useful in debugging problems related to headers and
+ * cookies.
+ * </p>
+ * <p>
+ * This Valve may be attached to any Container, depending on the granularity of the logging you wish to perform.
+ * </p>
+ * <p>
+ * primaryIndicator=true, then the request attribute <i>org.apache.catalina.ha.tcp.isPrimarySession.</i> is set true,
+ * when request processing is at sessions primary node.
  * </p>
  *
  * @author Craig R. McClanahan
  * @author Peter Rossbach
  */
-public class ReplicationValve
-    extends ValveBase implements ClusterValve {
+public class ReplicationValve extends ValveBase implements ClusterValve {
 
     private static final Log log = LogFactory.getLog(ReplicationValve.class);
 
@@ -71,10 +71,9 @@ public class ReplicationValve
     /**
      * The StringManager for this package.
      */
-    protected static final StringManager sm =
-        StringManager.getManager(Constants.Package);
+    protected static final StringManager sm = StringManager.getManager(Constants.Package);
 
-    private CatalinaCluster cluster = null ;
+    private CatalinaCluster cluster = null;
 
     /**
      * Filter expression
@@ -84,8 +83,7 @@ public class ReplicationValve
     /**
      * crossContext session container
      */
-    protected final ThreadLocal<ArrayList<DeltaSession>> crossContextSessions =
-        new ThreadLocal<>() ;
+    protected final ThreadLocal<ArrayList<DeltaSession>> crossContextSessions = new ThreadLocal<>();
 
     /**
      * doProcessingStats (default = off)
@@ -93,12 +91,9 @@ public class ReplicationValve
     protected boolean doProcessingStats = false;
 
     /*
-     * Note: The statistics are volatile to ensure the concurrent updates do not
-     *       corrupt them but it is still possible that:
-     *       - some updates may be lost;
-     *       - the individual statistics may not be consistent which each other.
-     *       This is a deliberate design choice to reduce the requirement for
-     *       synchronization.
+     * Note: The statistics are volatile to ensure the concurrent updates do not corrupt them but it is still possible
+     * that: - some updates may be lost; - the individual statistics may not be consistent which each other. This is a
+     * deliberate design choice to reduce the requirement for synchronization.
      */
     protected volatile long totalRequestTime = 0;
     protected volatile long totalSendTime = 0;
@@ -111,7 +106,7 @@ public class ReplicationValve
     /**
      * must primary change indicator set
      */
-    protected boolean primaryIndicator = false ;
+    protected boolean primaryIndicator = false;
 
     /**
      * Name of primary change indicator as request attribute
@@ -144,17 +139,18 @@ public class ReplicationValve
      * @return the filter
      */
     public String getFilter() {
-       if (filter == null) {
-           return null;
-       }
-       return filter.toString();
+        if (filter == null) {
+            return null;
+        }
+        return filter.toString();
     }
 
     /**
      * compile filter string to regular expression
+     *
      * @see Pattern#compile(java.lang.String)
-     * @param filter
-     *            The filter to set.
+     *
+     * @param filter The filter to set.
      */
     public void setFilter(String filter) {
         if (log.isDebugEnabled()) {
@@ -167,8 +163,7 @@ public class ReplicationValve
             try {
                 this.filter = Pattern.compile(filter);
             } catch (PatternSyntaxException pse) {
-                log.error(sm.getString("ReplicationValve.filter.failure",
-                        filter), pse);
+                log.error(sm.getString("ReplicationValve.filter.failure", filter), pse);
             }
         }
     }
@@ -203,6 +198,7 @@ public class ReplicationValve
 
     /**
      * Calc processing stats
+     *
      * @return <code>true</code> if statistics are enabled
      */
     public boolean doStatistics() {
@@ -213,6 +209,7 @@ public class ReplicationValve
      * Set Calc processing stats
      *
      * @param doProcessingStats New flag value
+     *
      * @see #resetStatistics()
      */
     public void setStatistics(boolean doProcessingStats) {
@@ -271,20 +268,18 @@ public class ReplicationValve
     // --------------------------------------------------------- Public Methods
 
     /**
-     * Register all cross context sessions inside endAccess.
-     * Use a list with contains check, that the Portlet API can include a lot of fragments from same or
-     * different applications with session changes.
+     * Register all cross context sessions inside endAccess. Use a list with contains check, that the Portlet API can
+     * include a lot of fragments from same or different applications with session changes.
      *
      * @param session cross context session
      */
     public void registerReplicationSession(DeltaSession session) {
         List<DeltaSession> sessions = crossContextSessions.get();
-        if(sessions != null) {
-            if(!sessions.contains(session)) {
-                if(log.isDebugEnabled()) {
-                    log.debug(sm.getString("ReplicationValve.crossContext.registerSession",
-                        session.getIdInternal(),
-                        session.getManager().getContext().getName()));
+        if (sessions != null) {
+            if (!sessions.contains(session)) {
+                if (log.isDebugEnabled()) {
+                    log.debug(sm.getString("ReplicationValve.crossContext.registerSession", session.getIdInternal(),
+                            session.getManager().getContext().getName()));
                 }
                 sessions.add(session);
             }
@@ -292,61 +287,56 @@ public class ReplicationValve
     }
 
     /**
-     * Log the interesting request parameters, invoke the next Valve in the
-     * sequence, and log the interesting response parameters.
+     * Log the interesting request parameters, invoke the next Valve in the sequence, and log the interesting response
+     * parameters.
      *
-     * @param request The servlet request to be processed
+     * @param request  The servlet request to be processed
      * @param response The servlet response to be created
      *
-     * @exception IOException if an input/output error occurs
+     * @exception IOException      if an input/output error occurs
      * @exception ServletException if a servlet error occurs
      */
     @Override
-    public void invoke(Request request, Response response)
-        throws IOException, ServletException
-    {
+    public void invoke(Request request, Response response) throws IOException, ServletException {
         long totalstart = 0;
 
-        //this happens before the request
-        if(doStatistics()) {
+        // this happens before the request
+        if (doStatistics()) {
             totalstart = System.currentTimeMillis();
         }
         if (primaryIndicator) {
-            createPrimaryIndicator(request) ;
+            createPrimaryIndicator(request);
         }
         Context context = request.getContext();
-        boolean isCrossContext = context != null
-                && context instanceof StandardContext
-                && context.getCrossContext();
+        boolean isCrossContext = context != null && context instanceof StandardContext && context.getCrossContext();
         try {
-            if(isCrossContext) {
-                if(log.isDebugEnabled()) {
+            if (isCrossContext) {
+                if (log.isDebugEnabled()) {
                     log.debug(sm.getString("ReplicationValve.crossContext.add"));
                 }
-                //FIXME add Pool of Arraylists
+                // FIXME add Pool of Arraylists
                 crossContextSessions.set(new ArrayList<DeltaSession>());
             }
             getNext().invoke(request, response);
-            if(context != null && cluster != null
-                    && context.getManager() instanceof ClusterManager) {
+            if (context != null && cluster != null && context.getManager() instanceof ClusterManager) {
                 ClusterManager clusterManager = (ClusterManager) context.getManager();
 
                 // valve cluster can access manager - other cluster handle replication
                 // at host level - hopefully!
-                if(cluster.getManager(clusterManager.getName()) == null) {
-                    return ;
+                if (cluster.getManager(clusterManager.getName()) == null) {
+                    return;
                 }
-                if(cluster.hasMembers()) {
+                if (cluster.hasMembers()) {
                     sendReplicationMessage(request, totalstart, isCrossContext, clusterManager);
                 } else {
-                    resetReplicationRequest(request,isCrossContext);
+                    resetReplicationRequest(request, isCrossContext);
                 }
             }
         } finally {
             // Array must be remove: Current master request send endAccess at recycle.
             // Don't register this request session again!
             if (isCrossContext) {
-                if(log.isDebugEnabled()) {
+                if (log.isDebugEnabled()) {
                     log.debug(sm.getString("ReplicationValve.crossContext.remove"));
                 }
                 crossContextSessions.remove();
@@ -369,18 +359,18 @@ public class ReplicationValve
     }
 
     /**
-     * Start this component and implement the requirements
-     * of {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
+     * Start this component and implement the requirements of
+     * {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
      *
-     * @exception LifecycleException if this component detects a fatal error
-     *  that prevents this component from being used
+     * @exception LifecycleException if this component detects a fatal error that prevents this component from being
+     *                                   used
      */
     @Override
     protected synchronized void startInternal() throws LifecycleException {
         if (cluster == null) {
             Cluster containerCluster = getContainer().getCluster();
             if (containerCluster instanceof CatalinaCluster) {
-                setCluster((CatalinaCluster)containerCluster);
+                setCluster((CatalinaCluster) containerCluster);
             } else {
                 if (log.isWarnEnabled()) {
                     log.warn(sm.getString("ReplicationValve.nocluster"));
@@ -393,10 +383,11 @@ public class ReplicationValve
 
     // --------------------------------------------------------- Protected Methods
 
-    protected void sendReplicationMessage(Request request, long totalstart, boolean isCrossContext, ClusterManager clusterManager) {
-        //this happens after the request
+    protected void sendReplicationMessage(Request request, long totalstart, boolean isCrossContext,
+            ClusterManager clusterManager) {
+        // this happens after the request
         long start = 0;
-        if(doStatistics()) {
+        if (doStatistics()) {
             start = System.currentTimeMillis();
         }
         try {
@@ -407,7 +398,7 @@ public class ReplicationValve
             }
             // send replication
             sendSessionReplicationMessage(request, clusterManager);
-            if(isCrossContext) {
+            if (isCrossContext) {
                 sendCrossContextSession();
             }
         } catch (Exception x) {
@@ -415,8 +406,8 @@ public class ReplicationValve
             log.error(sm.getString("ReplicationValve.send.failure"), x);
         } finally {
             // FIXME this stats update are not cheap!!
-            if(doStatistics()) {
-                updateStats(totalstart,start);
+            if (doStatistics()) {
+                updateStats(totalstart, start);
             }
         }
     }
@@ -426,14 +417,14 @@ public class ReplicationValve
      */
     protected void sendCrossContextSession() {
         List<DeltaSession> sessions = crossContextSessions.get();
-        if(sessions != null && sessions.size() >0) {
+        if (sessions != null && sessions.size() > 0) {
             for (DeltaSession session : sessions) {
-                if(log.isDebugEnabled()) {
+                if (log.isDebugEnabled()) {
                     log.debug(sm.getString("ReplicationValve.crossContext.sendDelta",
-                            session.getManager().getContext().getName() ));
+                            session.getManager().getContext().getName()));
                 }
-                sendMessage(session,(ClusterManager)session.getManager());
-                if(doStatistics()) {
+                sendMessage(session, (ClusterManager) session.getManager());
+                if (doStatistics()) {
                     nrOfCrossContextSendRequests++;
                 }
             }
@@ -442,24 +433,25 @@ public class ReplicationValve
 
     /**
      * Fix memory leak for long sessions with many changes, when no backup member exists!
-     * @param request current request after response is generated
+     *
+     * @param request        current request after response is generated
      * @param isCrossContext check crosscontext threadlocal
      */
     protected void resetReplicationRequest(Request request, boolean isCrossContext) {
         Session contextSession = request.getSessionInternal(false);
-        if(contextSession instanceof DeltaSession){
+        if (contextSession instanceof DeltaSession) {
             resetDeltaRequest(contextSession);
-            ((DeltaSession)contextSession).setPrimarySession(true);
+            ((DeltaSession) contextSession).setPrimarySession(true);
         }
-        if(isCrossContext) {
+        if (isCrossContext) {
             List<DeltaSession> sessions = crossContextSessions.get();
-            if(sessions != null && sessions.size() >0) {
+            if (sessions != null && sessions.size() > 0) {
                 Iterator<DeltaSession> iter = sessions.iterator();
-                for(; iter.hasNext() ;) {
+                for (; iter.hasNext();) {
                     Session session = iter.next();
                     resetDeltaRequest(session);
-                    if(session instanceof DeltaSession) {
-                        ((DeltaSession)contextSession).setPrimarySession(true);
+                    if (session instanceof DeltaSession) {
+                        ((DeltaSession) contextSession).setPrimarySession(true);
                     }
 
                 }
@@ -469,23 +461,23 @@ public class ReplicationValve
 
     /**
      * Reset DeltaRequest from session
+     *
      * @param session HttpSession from current request or cross context session
      */
     protected void resetDeltaRequest(Session session) {
-        if(log.isDebugEnabled()) {
-            log.debug(sm.getString("ReplicationValve.resetDeltaRequest" ,
-                session.getManager().getContext().getName() ));
+        if (log.isDebugEnabled()) {
+            log.debug(sm.getString("ReplicationValve.resetDeltaRequest", session.getManager().getContext().getName()));
         }
-        ((DeltaSession)session).resetDeltaRequest();
+        ((DeltaSession) session).resetDeltaRequest();
     }
 
     /**
      * Send Cluster Replication Request
+     *
      * @param request current request
      * @param manager session manager
      */
-    protected void sendSessionReplicationMessage(Request request,
-            ClusterManager manager) {
+    protected void sendSessionReplicationMessage(Request request, ClusterManager manager) {
         Session session = request.getSessionInternal(false);
         if (session != null) {
             String uri = request.getDecodedRequestURI();
@@ -494,22 +486,21 @@ public class ReplicationValve
                 if (log.isDebugEnabled()) {
                     log.debug(sm.getString("ReplicationValve.invoke.uri", uri));
                 }
-                sendMessage(session,manager);
-            } else
-                if(doStatistics()) {
-                    nrOfFilterRequests++;
-                }
+                sendMessage(session, manager);
+            } else if (doStatistics()) {
+                nrOfFilterRequests++;
+            }
         }
 
     }
 
-   /**
-    * Send message delta message from request session
-    * @param session current session
-    * @param manager session manager
-    */
-    protected void sendMessage(Session session,
-             ClusterManager manager) {
+    /**
+     * Send message delta message from request session
+     *
+     * @param session current session
+     * @param manager session manager
+     */
+    protected void sendMessage(Session session, ClusterManager manager) {
         String id = session.getIdInternal();
         if (id != null) {
             send(manager, id);
@@ -518,8 +509,10 @@ public class ReplicationValve
 
     /**
      * send manager requestCompleted message to cluster
-     * @param manager SessionManager
+     *
+     * @param manager   SessionManager
      * @param sessionId sessionid from the manager
+     *
      * @see DeltaManager#requestCompleted(String)
      * @see SimpleTcpCluster#send(ClusterMessage)
      */
@@ -527,7 +520,7 @@ public class ReplicationValve
         ClusterMessage msg = manager.requestCompleted(sessionId);
         if (msg != null && cluster != null) {
             cluster.send(msg);
-            if(doStatistics()) {
+            if (doStatistics()) {
                 nrOfSendRequests++;
             }
         }
@@ -535,11 +528,12 @@ public class ReplicationValve
 
     /**
      * check for session invalidations
+     *
      * @param manager Associated manager
      */
     protected void sendInvalidSessions(ClusterManager manager) {
-        String[] invalidIds=manager.getInvalidatedSessions();
-        if ( invalidIds.length > 0 ) {
+        String[] invalidIds = manager.getInvalidatedSessions();
+        if (invalidIds.length > 0) {
             for (String invalidId : invalidIds) {
                 try {
                     send(manager, invalidId);
@@ -552,7 +546,9 @@ public class ReplicationValve
 
     /**
      * is request without possible session change
+     *
      * @param uri The request uri
+     *
      * @return True if no session change
      */
     protected boolean isRequestWithoutSessionChange(String uri) {
@@ -562,39 +558,36 @@ public class ReplicationValve
 
     /**
      * Protocol cluster replications stats
+     *
      * @param requestTime Request time
      * @param clusterTime Cluster time
      */
-    protected  void updateStats(long requestTime, long clusterTime) {
+    protected void updateStats(long requestTime, long clusterTime) {
         // TODO: Async requests may trigger multiple replication requests. How,
-        //       if at all, should the stats handle this?
+        // if at all, should the stats handle this?
         long currentTime = System.currentTimeMillis();
         lastSendTime = currentTime;
         totalSendTime += currentTime - clusterTime;
         totalRequestTime += currentTime - requestTime;
         nrOfRequests++;
-        if(log.isInfoEnabled()) {
-            if ( (nrOfRequests % 100) == 0 ) {
-                 log.info(sm.getString("ReplicationValve.stats",
-                     new Object[]{
-                         Long.valueOf(totalRequestTime/nrOfRequests),
-                         Long.valueOf(totalSendTime/nrOfRequests),
-                         Long.valueOf(nrOfRequests),
-                         Long.valueOf(nrOfSendRequests),
-                         Long.valueOf(nrOfCrossContextSendRequests),
-                         Long.valueOf(nrOfFilterRequests),
-                         Long.valueOf(totalRequestTime),
-                         Long.valueOf(totalSendTime)}));
-             }
+        if (log.isInfoEnabled()) {
+            if ((nrOfRequests % 100) == 0) {
+                log.info(sm.getString("ReplicationValve.stats",
+                        new Object[] { Long.valueOf(totalRequestTime / nrOfRequests),
+                                Long.valueOf(totalSendTime / nrOfRequests), Long.valueOf(nrOfRequests),
+                                Long.valueOf(nrOfSendRequests), Long.valueOf(nrOfCrossContextSendRequests),
+                                Long.valueOf(nrOfFilterRequests), Long.valueOf(totalRequestTime),
+                                Long.valueOf(totalSendTime) }));
+            }
         }
     }
 
 
     /**
-     * Mark Request that processed at primary node with attribute
-     * primaryIndicatorName
+     * Mark Request that processed at primary node with attribute primaryIndicatorName
      *
      * @param request The Servlet request
+     *
      * @throws IOException IO error finding session
      */
     protected void createPrimaryIndicator(Request request) throws IOException {
@@ -605,20 +598,16 @@ public class ReplicationValve
             if (session instanceof ClusterSession) {
                 ClusterSession cses = (ClusterSession) session;
                 if (log.isDebugEnabled()) {
-                    log.debug(sm.getString(
-                            "ReplicationValve.session.indicator", request.getContext().getName(),id,
-                            primaryIndicatorName,
-                            Boolean.valueOf(cses.isPrimarySession())));
+                    log.debug(sm.getString("ReplicationValve.session.indicator", request.getContext().getName(), id,
+                            primaryIndicatorName, Boolean.valueOf(cses.isPrimarySession())));
                 }
-                request.setAttribute(primaryIndicatorName, cses.isPrimarySession()?Boolean.TRUE:Boolean.FALSE);
+                request.setAttribute(primaryIndicatorName, cses.isPrimarySession() ? Boolean.TRUE : Boolean.FALSE);
             } else {
                 if (log.isDebugEnabled()) {
                     if (session != null) {
-                        log.debug(sm.getString(
-                                "ReplicationValve.session.found", request.getContext().getName(),id));
+                        log.debug(sm.getString("ReplicationValve.session.found", request.getContext().getName(), id));
                     } else {
-                        log.debug(sm.getString(
-                                "ReplicationValve.session.invalid", request.getContext().getName(),id));
+                        log.debug(sm.getString("ReplicationValve.session.invalid", request.getContext().getName(), id));
                     }
                 }
             }
diff --git a/java/org/apache/catalina/ha/tcp/SendMessageData.java b/java/org/apache/catalina/ha/tcp/SendMessageData.java
index 5f1fc12c30..12e3a54429 100644
--- a/java/org/apache/catalina/ha/tcp/SendMessageData.java
+++ b/java/org/apache/catalina/ha/tcp/SendMessageData.java
@@ -23,18 +23,17 @@ import org.apache.catalina.tribes.Member;
  */
 public class SendMessageData {
 
-    private Object message ;
-    private Member destination ;
-    private Exception exception ;
+    private Object message;
+    private Member destination;
+    private Exception exception;
 
 
     /**
-     * @param message The message to send
+     * @param message     The message to send
      * @param destination Member destination
-     * @param exception Associated error
+     * @param exception   Associated error
      */
-    public SendMessageData(Object message, Member destination,
-            Exception exception) {
+    public SendMessageData(Object message, Member destination, Exception exception) {
         super();
         this.message = message;
         this.destination = destination;
@@ -47,12 +46,14 @@ public class SendMessageData {
     public Member getDestination() {
         return destination;
     }
+
     /**
      * @return the exception.
      */
     public Exception getException() {
         return exception;
     }
+
     /**
      * @return the message.
      */
diff --git a/java/org/apache/catalina/ha/tcp/SimpleTcpCluster.java b/java/org/apache/catalina/ha/tcp/SimpleTcpCluster.java
index 534fd862f8..5512b6858a 100644
--- a/java/org/apache/catalina/ha/tcp/SimpleTcpCluster.java
+++ b/java/org/apache/catalina/ha/tcp/SimpleTcpCluster.java
@@ -59,17 +59,14 @@ import org.apache.juli.logging.LogFactory;
 import org.apache.tomcat.util.res.StringManager;
 
 /**
- * A <b>Cluster </b> implementation using simple multicast. Responsible for
- * setting up a cluster and provides callers with a valid multicast
- * receiver/sender.
- *
- * FIXME wrote testcases
+ * A <b>Cluster </b> implementation using simple multicast. Responsible for setting up a cluster and provides callers
+ * with a valid multicast receiver/sender. FIXME wrote testcases
  *
  * @author Remy Maucherat
  * @author Peter Rossbach
  */
 public class SimpleTcpCluster extends LifecycleMBeanBase
-        implements CatalinaCluster, MembershipListener, ChannelListener{
+        implements CatalinaCluster, MembershipListener, ChannelListener {
 
     public static final Log log = LogFactory.getLog(SimpleTcpCluster.class);
 
@@ -109,13 +106,14 @@ public class SimpleTcpCluster extends LifecycleMBeanBase
     /**
      * The cluster name to join
      */
-    protected String clusterName ;
+    protected String clusterName;
 
     /**
      * call Channel.heartbeat() at container background thread
+     *
      * @see org.apache.catalina.tribes.group.GroupChannel#heartbeat()
      */
-    protected boolean heartbeatBackgroundEnabled =false ;
+    protected boolean heartbeatBackgroundEnabled = false;
 
     /**
      * The Container associated with this Cluster.
@@ -130,7 +128,7 @@ public class SimpleTcpCluster extends LifecycleMBeanBase
     /**
      * The context name &lt;-&gt; manager association for distributed contexts.
      */
-    protected final Map<String, ClusterManager> managers = new HashMap<>();
+    protected final Map<String,ClusterManager> managers = new HashMap<>();
 
     protected ClusterManager managerTemplate = new DeltaManager();
 
@@ -163,6 +161,7 @@ public class SimpleTcpCluster extends LifecycleMBeanBase
 
     /**
      * Return heartbeat enable flag (default false)
+     *
      * @return the heartbeatBackgroundEnabled
      */
     public boolean isHeartbeatBackgroundEnabled() {
@@ -171,6 +170,7 @@ public class SimpleTcpCluster extends LifecycleMBeanBase
 
     /**
      * enabled that container backgroundThread call heartbeat at channel
+     *
      * @param heartbeatBackgroundEnabled the heartbeatBackgroundEnabled to set
      */
     public void setHeartbeatBackgroundEnabled(boolean heartbeatBackgroundEnabled) {
@@ -178,11 +178,9 @@ public class SimpleTcpCluster extends LifecycleMBeanBase
     }
 
     /**
-     * Set the name of the cluster to join, if no cluster with this name is
-     * present create one.
+     * Set the name of the cluster to join, if no cluster with this name is present create one.
      *
-     * @param clusterName
-     *            The clustername to join
+     * @param clusterName The clustername to join
      */
     @Override
     public void setClusterName(String clusterName) {
@@ -190,15 +188,14 @@ public class SimpleTcpCluster extends LifecycleMBeanBase
     }
 
     /**
-     * Return the name of the cluster that this Server is currently configured
-     * to operate within.
+     * Return the name of the cluster that this Server is currently configured to operate within.
      *
      * @return The name of the cluster associated with this server
      */
     @Override
     public String getClusterName() {
-        if(clusterName == null && container != null) {
-            return container.getName() ;
+        if (clusterName == null && container != null) {
+            return container.getName();
         }
         return clusterName;
     }
@@ -206,8 +203,7 @@ public class SimpleTcpCluster extends LifecycleMBeanBase
     /**
      * Set the Container associated with our Cluster
      *
-     * @param container
-     *            The Container to use
+     * @param container The Container to use
      */
     @Override
     public void setContainer(Container container) {
@@ -234,21 +230,18 @@ public class SimpleTcpCluster extends LifecycleMBeanBase
     }
 
     /**
-     * @param notifyListenerOnFailure
-     *            The notifyLifecycleListenerOnFailure to set.
+     * @param notifyListenerOnFailure The notifyLifecycleListenerOnFailure to set.
      */
-    public void setNotifyLifecycleListenerOnFailure(
-            boolean notifyListenerOnFailure) {
+    public void setNotifyLifecycleListenerOnFailure(boolean notifyListenerOnFailure) {
         boolean oldNotifyListenerOnFailure = this.notifyLifecycleListenerOnFailure;
         this.notifyLifecycleListenerOnFailure = notifyListenerOnFailure;
-        support.firePropertyChange("notifyLifecycleListenerOnFailure",
-                oldNotifyListenerOnFailure,
+        support.firePropertyChange("notifyLifecycleListenerOnFailure", oldNotifyListenerOnFailure,
                 this.notifyLifecycleListenerOnFailure);
     }
 
     /**
-     * Add cluster valve
-     * Cluster Valves are only add to container when cluster is started!
+     * Add cluster valve Cluster Valves are only add to container when cluster is started!
+     *
      * @param valve The new cluster Valve.
      */
     @Override
@@ -260,6 +253,7 @@ public class SimpleTcpCluster extends LifecycleMBeanBase
 
     /**
      * get all cluster valves
+     *
      * @return current cluster valves
      */
     @Override
@@ -268,8 +262,9 @@ public class SimpleTcpCluster extends LifecycleMBeanBase
     }
 
     /**
-     * Get the cluster listeners associated with this cluster. If this Array has
-     * no listeners registered, a zero-length array is returned.
+     * Get the cluster listeners associated with this cluster. If this Array has no listeners registered, a zero-length
+     * array is returned.
+     *
      * @return the listener array
      */
     public ClusterListener[] findClusterListeners() {
@@ -280,6 +275,7 @@ public class SimpleTcpCluster extends LifecycleMBeanBase
      * Add cluster message listener and register cluster to this listener.
      *
      * @param listener The new listener
+     *
      * @see org.apache.catalina.ha.CatalinaCluster#addClusterListener(org.apache.catalina.ha.ClusterListener)
      */
     @Override
@@ -294,6 +290,7 @@ public class SimpleTcpCluster extends LifecycleMBeanBase
      * Remove message listener and deregister Cluster from listener.
      *
      * @param listener The listener to remove
+     *
      * @see org.apache.catalina.ha.CatalinaCluster#removeClusterListener(org.apache.catalina.ha.ClusterListener)
      */
     @Override
@@ -314,6 +311,7 @@ public class SimpleTcpCluster extends LifecycleMBeanBase
 
     /**
      * set a new Deployer, must be set before cluster started!
+     *
      * @param clusterDeployer The associated deployer
      */
     @Override
@@ -338,6 +336,7 @@ public class SimpleTcpCluster extends LifecycleMBeanBase
      * has members
      */
     protected boolean hasMembers = false;
+
     @Override
     public boolean hasMembers() {
         return hasMembers;
@@ -345,6 +344,7 @@ public class SimpleTcpCluster extends LifecycleMBeanBase
 
     /**
      * Get all current cluster members
+     *
      * @return all members or empty array
      */
     @Override
@@ -369,7 +369,7 @@ public class SimpleTcpCluster extends LifecycleMBeanBase
      * @return Returns the managers.
      */
     @Override
-    public Map<String, ClusterManager> getManagers() {
+    public Map<String,ClusterManager> getManagers() {
         return managers;
     }
 
@@ -389,16 +389,16 @@ public class SimpleTcpCluster extends LifecycleMBeanBase
     /**
      * Create new Manager without add to cluster (comes with start the manager)
      *
-     * @param name
-     *            Context Name of this manager
+     * @param name Context Name of this manager
+     *
      * @see org.apache.catalina.Cluster#createManager(java.lang.String)
      * @see DeltaManager#start()
      */
     @Override
     public synchronized Manager createManager(String name) {
         if (log.isDebugEnabled()) {
-            log.debug("Creating ClusterManager for context " + name +
-                    " using class " + getManagerTemplate().getClass().getName());
+            log.debug("Creating ClusterManager for context " + name + " using class " +
+                    getManagerTemplate().getClass().getName());
         }
         ClusterManager manager = null;
         try {
@@ -408,7 +408,7 @@ public class SimpleTcpCluster extends LifecycleMBeanBase
             log.error(sm.getString("simpleTcpCluster.clustermanager.cloneFailed"), x);
             manager = new org.apache.catalina.ha.session.DeltaManager();
         } finally {
-            if ( manager != null) {
+            if (manager != null) {
                 manager.setCluster(this);
             }
         }
@@ -418,7 +418,7 @@ public class SimpleTcpCluster extends LifecycleMBeanBase
     @Override
     public void registerManager(Manager manager) {
 
-        if (! (manager instanceof ClusterManager)) {
+        if (!(manager instanceof ClusterManager)) {
             log.warn(sm.getString("simpleTcpCluster.clustermanager.notImplement", manager));
             return;
         }
@@ -438,6 +438,7 @@ public class SimpleTcpCluster extends LifecycleMBeanBase
      * Remove an application from cluster replication bus.
      *
      * @param manager The manager
+     *
      * @see org.apache.catalina.Cluster#removeManager(Manager)
      */
     @Override
@@ -445,8 +446,8 @@ public class SimpleTcpCluster extends LifecycleMBeanBase
         if (manager instanceof ClusterManager) {
             ClusterManager cmgr = (ClusterManager) manager;
             // Notify our interested LifecycleListeners
-            fireLifecycleEvent(BEFORE_MANAGERUNREGISTER_EVENT,manager);
-            managers.remove(getManagerName(cmgr.getName(),manager));
+            fireLifecycleEvent(BEFORE_MANAGERUNREGISTER_EVENT, manager);
+            managers.remove(getManagerName(cmgr.getName(), manager));
             cmgr.setCluster(null);
             // Notify our interested LifecycleListeners
             fireLifecycleEvent(AFTER_MANAGERUNREGISTER_EVENT, manager);
@@ -455,16 +456,15 @@ public class SimpleTcpCluster extends LifecycleMBeanBase
 
     @Override
     public String getManagerName(String name, Manager manager) {
-        String clusterName = name ;
+        String clusterName = name;
         if (clusterName == null) {
             clusterName = manager.getContext().getName();
         }
         if (getContainer() instanceof Engine) {
             Context context = manager.getContext();
             Container host = context.getParent();
-            if (host instanceof Host && clusterName != null &&
-                    !(clusterName.startsWith(host.getName() +"#"))) {
-                clusterName = host.getName() +"#" + clusterName ;
+            if (host instanceof Host && clusterName != null && !(clusterName.startsWith(host.getName() + "#"))) {
+                clusterName = host.getName() + "#" + clusterName;
             }
         }
         return clusterName;
@@ -478,13 +478,12 @@ public class SimpleTcpCluster extends LifecycleMBeanBase
     // ------------------------------------------------------ Lifecycle Methods
 
     /**
-     * Execute a periodic task, such as reloading, etc. This method will be
-     * invoked inside the classloading context of this container. Unexpected
-     * throwables will be caught and logged.
+     * Execute a periodic task, such as reloading, etc. This method will be invoked inside the classloading context of
+     * this container. Unexpected throwables will be caught and logged.
+     *
      * @see org.apache.catalina.ha.deploy.FarmWarDeployer#backgroundProcess()
      * @see org.apache.catalina.tribes.group.GroupChannel#heartbeat()
      * @see org.apache.catalina.tribes.group.GroupChannel.HeartbeatThread#run()
-     *
      */
     @Override
     public void backgroundProcess() {
@@ -492,8 +491,8 @@ public class SimpleTcpCluster extends LifecycleMBeanBase
             clusterDeployer.backgroundProcess();
         }
 
-        //send a heartbeat through the channel
-        if ( isHeartbeatBackgroundEnabled() && channel !=null ) {
+        // send a heartbeat through the channel
+        if (isHeartbeatBackgroundEnabled() && channel != null) {
             channel.heartbeat();
         }
 
@@ -520,11 +519,10 @@ public class SimpleTcpCluster extends LifecycleMBeanBase
 
 
     /**
-     * Start Cluster and implement the requirements
-     * of {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
+     * Start Cluster and implement the requirements of {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
      *
-     * @exception LifecycleException if this component detects a fatal error
-     *  that prevents this component from being used
+     * @exception LifecycleException if this component detects a fatal error that prevents this component from being
+     *                                   used
      */
     @Override
     protected void startInternal() throws LifecycleException {
@@ -553,20 +551,20 @@ public class SimpleTcpCluster extends LifecycleMBeanBase
     }
 
     protected void checkDefaults() {
-        if ( clusterListeners.size() == 0 && managerTemplate instanceof DeltaManager ) {
+        if (clusterListeners.size() == 0 && managerTemplate instanceof DeltaManager) {
             addClusterListener(new ClusterSessionListener());
         }
-        if ( valves.size() == 0 ) {
+        if (valves.size() == 0) {
             addValve(new JvmRouteBinderValve());
             addValve(new ReplicationValve());
         }
-        if ( clusterDeployer != null ) {
+        if (clusterDeployer != null) {
             clusterDeployer.setCluster(this);
         }
-        if ( channel == null ) {
+        if (channel == null) {
             channel = new GroupChannel();
         }
-        if ( channel instanceof GroupChannel && !((GroupChannel)channel).getInterceptors().hasNext()) {
+        if (channel instanceof GroupChannel && !((GroupChannel) channel).getInterceptors().hasNext()) {
             channel.addInterceptor(new MessageDispatchInterceptor());
             channel.addInterceptor(new TcpFailureDetector());
         }
@@ -579,12 +577,11 @@ public class SimpleTcpCluster extends LifecycleMBeanBase
      * register all cluster valve to host or engine
      */
     protected void registerClusterValve() {
-        if(container != null ) {
+        if (container != null) {
             for (Iterator<Valve> iter = valves.iterator(); iter.hasNext();) {
                 ClusterValve valve = (ClusterValve) iter.next();
                 if (log.isDebugEnabled()) {
-                    log.debug("Invoking addValve on " + getContainer()
-                            + " with class=" + valve.getClass().getName());
+                    log.debug("Invoking addValve on " + getContainer() + " with class=" + valve.getClass().getName());
                 }
                 if (valve != null) {
                     container.getPipeline().addValve(valve);
@@ -601,8 +598,7 @@ public class SimpleTcpCluster extends LifecycleMBeanBase
         for (Iterator<Valve> iter = valves.iterator(); iter.hasNext();) {
             ClusterValve valve = (ClusterValve) iter.next();
             if (log.isDebugEnabled()) {
-                log.debug("Invoking removeValve on " + getContainer()
-                        + " with class=" + valve.getClass().getName());
+                log.debug("Invoking removeValve on " + getContainer() + " with class=" + valve.getClass().getName());
             }
             if (valve != null) {
                 container.getPipeline().removeValve(valve);
@@ -613,11 +609,10 @@ public class SimpleTcpCluster extends LifecycleMBeanBase
 
 
     /**
-     * Stop Cluster and implement the requirements
-     * of {@link org.apache.catalina.util.LifecycleBase#stopInternal()}.
+     * Stop Cluster and implement the requirements of {@link org.apache.catalina.util.LifecycleBase#stopInternal()}.
      *
-     * @exception LifecycleException if this component detects a fatal error
-     *  that prevents this component from being used
+     * @exception LifecycleException if this component detects a fatal error that prevents this component from being
+     *                                   used
      */
     @Override
     protected void stopInternal() throws LifecycleException {
@@ -630,7 +625,7 @@ public class SimpleTcpCluster extends LifecycleMBeanBase
         }
         this.managers.clear();
         try {
-            if ( clusterDeployer != null ) {
+            if (clusterDeployer != null) {
                 clusterDeployer.setCluster(null);
             }
             channel.stop(channelStartOptions);
@@ -672,6 +667,7 @@ public class SimpleTcpCluster extends LifecycleMBeanBase
 
     /**
      * send message to all cluster members
+     *
      * @param msg message to transfer
      *
      * @see org.apache.catalina.ha.CatalinaCluster#send(org.apache.catalina.ha.ClusterMessage)
@@ -684,32 +680,33 @@ public class SimpleTcpCluster extends LifecycleMBeanBase
     /**
      * send a cluster message to one member
      *
-     * @param msg message to transfer
+     * @param msg  message to transfer
      * @param dest Receiver member
+     *
      * @see org.apache.catalina.ha.CatalinaCluster#send(org.apache.catalina.ha.ClusterMessage,
-     *      org.apache.catalina.tribes.Member)
+     *          org.apache.catalina.tribes.Member)
      */
     @Override
     public void send(ClusterMessage msg, Member dest) {
         try {
             msg.setAddress(getLocalMember());
             int sendOptions = channelSendOptions;
-            if (msg instanceof SessionMessage
-                    && ((SessionMessage)msg).getEventType() == SessionMessage.EVT_ALL_SESSION_DATA) {
-                sendOptions = Channel.SEND_OPTIONS_SYNCHRONIZED_ACK|Channel.SEND_OPTIONS_USE_ACK;
+            if (msg instanceof SessionMessage &&
+                    ((SessionMessage) msg).getEventType() == SessionMessage.EVT_ALL_SESSION_DATA) {
+                sendOptions = Channel.SEND_OPTIONS_SYNCHRONIZED_ACK | Channel.SEND_OPTIONS_USE_ACK;
             }
             if (dest != null) {
                 if (!getLocalMember().equals(dest)) {
-                    channel.send(new Member[] {dest}, msg, sendOptions);
+                    channel.send(new Member[] { dest }, msg, sendOptions);
                 } else {
                     log.error(sm.getString("simpleTcpCluster.unableSend.localMember", msg));
                 }
             } else {
                 Member[] destmembers = channel.getMembers();
-                if (destmembers.length>0) {
-                    channel.send(destmembers,msg, sendOptions);
+                if (destmembers.length > 0) {
+                    channel.send(destmembers, msg, sendOptions);
                 } else if (log.isDebugEnabled()) {
-                    log.debug("No members in cluster, ignoring message:"+msg);
+                    log.debug("No members in cluster, ignoring message:" + msg);
                 }
             }
         } catch (Exception x) {
@@ -770,11 +767,9 @@ public class SimpleTcpCluster extends LifecycleMBeanBase
     // messages
 
     /**
-     * notify all listeners from receiving a new message is not ClusterMessage
-     * emit Failure Event to LifecycleListener
+     * notify all listeners from receiving a new message is not ClusterMessage emit Failure Event to LifecycleListener
      *
-     * @param msg
-     *            received Message
+     * @param msg received Message
      */
     @Override
     public boolean accept(Serializable msg, Member sender) {
@@ -784,7 +779,7 @@ public class SimpleTcpCluster extends LifecycleMBeanBase
 
     @Override
     public void messageReceived(Serializable message, Member sender) {
-        ClusterMessage fwd = (ClusterMessage)message;
+        ClusterMessage fwd = (ClusterMessage) message;
         fwd.setAddress(sender);
         messageReceived(fwd);
     }
@@ -792,17 +787,14 @@ public class SimpleTcpCluster extends LifecycleMBeanBase
     public void messageReceived(ClusterMessage message) {
 
         if (log.isDebugEnabled() && message != null) {
-            log.debug("Assuming clocks are synched: Replication for "
-                    + message.getUniqueId() + " took="
-                    + (System.currentTimeMillis() - (message).getTimestamp())
-                    + " ms.");
+            log.debug("Assuming clocks are synched: Replication for " + message.getUniqueId() + " took=" +
+                    (System.currentTimeMillis() - (message).getTimestamp()) + " ms.");
         }
 
-        //invoke all the listeners
+        // invoke all the listeners
         boolean accepted = false;
         if (message != null) {
-            for (Iterator<ClusterListener> iter = clusterListeners.iterator();
-                    iter.hasNext();) {
+            for (Iterator<ClusterListener> iter = clusterListeners.iterator(); iter.hasNext();) {
                 ClusterListener listener = iter.next();
                 if (listener.accept(message)) {
                     accepted = true;
@@ -812,12 +804,10 @@ public class SimpleTcpCluster extends LifecycleMBeanBase
             if (!accepted && notifyLifecycleListenerOnFailure) {
                 Member dest = message.getAddress();
                 // Notify our interested LifecycleListeners
-                fireLifecycleEvent(RECEIVE_MESSAGE_FAILURE_EVENT,
-                        new SendMessageData(message, dest, null));
+                fireLifecycleEvent(RECEIVE_MESSAGE_FAILURE_EVENT, new SendMessageData(message, dest, null));
                 if (log.isDebugEnabled()) {
-                    log.debug("Message " + message.toString() + " from type "
-                            + message.getClass().getName()
-                            + " transferred but no listener registered");
+                    log.debug("Message " + message.toString() + " from type " + message.getClass().getName() +
+                            " transferred but no listener registered");
                 }
             }
         }


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org