Author: markt
Date: Fri Jul 13 21:44:35 2012
New Revision: 1361407

URL: http://svn.apache.org/viewvc?rev=1361407&view=rev
Log:
UCDetector clean-up
 - Remove unused code
 - Use final where appropriate

Modified:
    tomcat/trunk/java/org/apache/catalina/ha/context/ReplicatedContext.java
    tomcat/trunk/java/org/apache/catalina/ha/deploy/FarmWarDeployer.java
    tomcat/trunk/java/org/apache/catalina/ha/deploy/FileMessage.java
    tomcat/trunk/java/org/apache/catalina/ha/deploy/FileMessageFactory.java
    tomcat/trunk/java/org/apache/catalina/ha/deploy/LocalStrings.properties
    tomcat/trunk/java/org/apache/catalina/ha/deploy/UndeployMessage.java
    tomcat/trunk/java/org/apache/catalina/ha/deploy/WarWatcher.java

Modified: 
tomcat/trunk/java/org/apache/catalina/ha/context/ReplicatedContext.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/ha/context/ReplicatedContext.java?rev=1361407&r1=1361406&r2=1361407&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/ha/context/ReplicatedContext.java 
(original)
+++ tomcat/trunk/java/org/apache/catalina/ha/context/ReplicatedContext.java Fri 
Jul 13 21:44:35 2012
@@ -44,7 +44,7 @@ import org.apache.juli.logging.LogFactor
 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 long DEFAULT_REPL_TIMEOUT = 15000;//15 seconds
+    protected static final long DEFAULT_REPL_TIMEOUT = 15000;//15 seconds
 
     /**
      * Start this component and implement the requirements
@@ -60,10 +60,9 @@ public class ReplicatedContext extends S
             CatalinaCluster catclust = (CatalinaCluster)this.getCluster();
             if (this.context == null) this.context = new ReplApplContext(this);
             if ( catclust != null ) {
-                ReplicatedMap<String,Object> map =
-                        new ReplicatedMap<String,Object>(this,
-                                catclust.getChannel(),DEFAULT_REPL_TIMEOUT,
-                                getName(),getClassLoaders());
+                ReplicatedMap<String,Object> map = new ReplicatedMap<>(
+                        this, catclust.getChannel(),DEFAULT_REPL_TIMEOUT,
+                        getName(),getClassLoaders());
                 map.setChannelSendOptions(mapSendOptions);
                 ((ReplApplContext)this.context).setAttributeMap(map);
                 if (getAltDDName() != null) 
context.setAttribute(Globals.ALT_DD_ATTR, getAltDDName());
@@ -130,8 +129,8 @@ public class ReplicatedContext extends S
 
 
     protected static class ReplApplContext extends ApplicationContext {
-        protected ConcurrentHashMap<String, Object> tomcatAttributes =
-            new ConcurrentHashMap<String, Object>();
+        protected final ConcurrentHashMap<String, Object> tomcatAttributes =
+            new ConcurrentHashMap<>();
 
         public ReplApplContext(ReplicatedContext context) {
             super(context);
@@ -181,17 +180,17 @@ public class ReplicatedContext extends S
         @SuppressWarnings("unchecked")
         @Override
         public Enumeration<String> getAttributeNames() {
-            Set<String> names = new HashSet<String>();
+            Set<String> names = new HashSet<>();
             names.addAll(attributes.keySet());
 
-            return new MultiEnumeration<String>(new Enumeration[] {
+            return new MultiEnumeration<>(new Enumeration[] {
                     super.getAttributeNames(),
                     Collections.enumeration(names) });
         }
     }
 
     protected static class MultiEnumeration<T> implements Enumeration<T> {
-        Enumeration<T>[] e=null;
+        private final Enumeration<T>[] e;
         public MultiEnumeration(Enumeration<T>[] lists) {
             e = lists;
         }

Modified: tomcat/trunk/java/org/apache/catalina/ha/deploy/FarmWarDeployer.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/ha/deploy/FarmWarDeployer.java?rev=1361407&r1=1361406&r2=1361407&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/ha/deploy/FarmWarDeployer.java 
(original)
+++ tomcat/trunk/java/org/apache/catalina/ha/deploy/FarmWarDeployer.java Fri 
Jul 13 21:44:35 2012
@@ -69,8 +69,8 @@ public class FarmWarDeployer extends Clu
     /*--Instance Variables--------------------------------------*/
     protected boolean started = false; //default 5 seconds
 
-    protected HashMap<String, FileMessageFactory> fileFactories =
-        new HashMap<String, FileMessageFactory>();
+    protected final HashMap<String, FileMessageFactory> fileFactories =
+        new HashMap<>();
 
     protected String deployDir;
 
@@ -105,11 +105,6 @@ public class FarmWarDeployer extends Clu
     protected Host host = null;
 
     /**
-     * The host appBase.
-     */
-    protected File appBase = null;
-
-    /**
      * MBean server.
      */
     protected MBeanServer mBeanServer = null;
@@ -196,11 +191,6 @@ public class FarmWarDeployer extends Clu
             log.info(sm.getString("farmWarDeployer.stopped"));
     }
 
-    public void cleanDeployDir() {
-        throw new java.lang.UnsupportedOperationException(sm.getString(
-                "farmWarDeployer.notImplemented", "cleanDeployDir()"));
-    }
-
     /**
      * Callback from the cluster, when a message is received, The cluster will
      * broadcast it invoking the messageReceived on the receiver.
@@ -407,7 +397,7 @@ public class FarmWarDeployer extends Clu
         Member localMember = getCluster().getLocalMember();
         UndeployMessage msg = new UndeployMessage(localMember, System
                 .currentTimeMillis(), "Undeploy:" + contextName + ":"
-                + System.currentTimeMillis(), contextName, undeploy);
+                + System.currentTimeMillis(), contextName);
         if (log.isDebugEnabled())
             log.debug(sm.getString("farmWarDeployer.removeTxMsg", 
contextName));
         cluster.send(msg);

Modified: tomcat/trunk/java/org/apache/catalina/ha/deploy/FileMessage.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/ha/deploy/FileMessage.java?rev=1361407&r1=1361406&r2=1361407&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/ha/deploy/FileMessage.java (original)
+++ tomcat/trunk/java/org/apache/catalina/ha/deploy/FileMessage.java Fri Jul 13 
21:44:35 2012
@@ -28,16 +28,15 @@ import org.apache.catalina.tribes.Member
  */
 
 public class FileMessage extends ClusterMessageBase {
-    private static final long serialVersionUID = 1L;
+    private static final long serialVersionUID = 2L;
 
     private int messageNumber;
     private byte[] data;
     private int dataLength;
 
-    private long totalLength;
     private long totalNrOfMsgs;
-    private String fileName;
-    private String contextName;
+    private final String fileName;
+    private final String contextName;
 
     public FileMessage(Member source,
                        String fileName,
@@ -47,16 +46,6 @@ public class FileMessage extends Cluster
         this.contextName=contextName;
     }
 
-    /*
-    public void writeExternal(ObjectOutput out) throws IOException {
-
-    }
-
-    public void readExternal(ObjectInput in) throws IOException, 
ClassNotFoundException {
-
-    }
-    */
-
     public int getMessageNumber() {
         return messageNumber;
     }
@@ -79,15 +68,6 @@ public class FileMessage extends Cluster
     public int getDataLength() {
         return dataLength;
     }
-    public void setDataLength(int dataLength) {
-        this.dataLength = dataLength;
-    }
-    public long getTotalLength() {
-        return totalLength;
-    }
-    public void setTotalLength(long totalLength) {
-        this.totalLength = totalLength;
-    }
 
     @Override
     public String getUniqueId() {
@@ -103,11 +83,7 @@ public class FileMessage extends Cluster
     public String getFileName() {
         return fileName;
     }
-    public void setFileName(String fileName) {
-        this.fileName = fileName;
-    }
     public String getContextName() {
         return contextName;
     }
-
 }

Modified: 
tomcat/trunk/java/org/apache/catalina/ha/deploy/FileMessageFactory.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/ha/deploy/FileMessageFactory.java?rev=1361407&r1=1361406&r2=1361407&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/ha/deploy/FileMessageFactory.java 
(original)
+++ tomcat/trunk/java/org/apache/catalina/ha/deploy/FileMessageFactory.java Fri 
Jul 13 21:44:35 2012
@@ -59,13 +59,13 @@ public class FileMessageFactory {
     /**
      * The file that we are reading/writing
      */
-    protected File file = null;
+    protected final File file;
 
     /**
      * True means that we are writing with this factory. False means that we 
are
      * reading with this factory
      */
-    protected boolean openForWrite;
+    protected final boolean openForWrite;
 
     /**
      * Once the factory is used, it can not be reused.
@@ -107,8 +107,7 @@ public class FileMessageFactory {
      * everything is worked as expected, messages will spend very little time 
in
      * the buffer.
      */
-    protected Map<Long, FileMessage> msgBuffer =
-        new ConcurrentHashMap<Long, FileMessage>();
+    protected final Map<Long, FileMessage> msgBuffer = new 
ConcurrentHashMap<>();
 
     /**
      * The bytes that we hold the data in, not thread safe.
@@ -207,7 +206,6 @@ public class FileMessageFactory {
             return null;
         } else {
             f.setData(data, length);
-            f.setTotalLength(size);
             f.setTotalNrOfMsgs(totalNrOfMessages);
             f.setMessageNumber(++nrOfMessagesProcessed);
             return f;

Modified: 
tomcat/trunk/java/org/apache/catalina/ha/deploy/LocalStrings.properties
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/ha/deploy/LocalStrings.properties?rev=1361407&r1=1361406&r2=1361407&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/ha/deploy/LocalStrings.properties 
(original)
+++ tomcat/trunk/java/org/apache/catalina/ha/deploy/LocalStrings.properties Fri 
Jul 13 21:44:35 2012
@@ -27,7 +27,6 @@ farmWarDeployer.modInstallFail=Unable to
 farmWarDeployer.msgIoe=Unable to read farm deploy file message.
 farmWarDeployer.msgRxDeploy=Receive cluster deployment path [{0}], war [{1}]
 farmWarDeployer.msgRxUndeploy=Receive cluster undeployment from path [{0}]
-farmWarDeployer.notImplemented=Method [{0}] not yet implemented.
 farmWarDeployer.removeStart=Cluster wide remove of web app [{0}]
 farmWarDeployer.removeTxMsg=Send cluster wide undeployment from [{0}]
 farmWarDeployer.removeFailRemote=Local remove from [{0}] failed, other manager 
has app in service!

Modified: tomcat/trunk/java/org/apache/catalina/ha/deploy/UndeployMessage.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/ha/deploy/UndeployMessage.java?rev=1361407&r1=1361406&r2=1361407&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/ha/deploy/UndeployMessage.java 
(original)
+++ tomcat/trunk/java/org/apache/catalina/ha/deploy/UndeployMessage.java Fri 
Jul 13 21:44:35 2012
@@ -21,27 +21,20 @@ import org.apache.catalina.ha.ClusterMes
 import org.apache.catalina.tribes.Member;
 
 public class UndeployMessage implements ClusterMessage {
-    private static final long serialVersionUID = 1L;
+    private static final long serialVersionUID = 2L;
 
     private Member address;
     private long timestamp;
     private String uniqueId;
-    private String contextName;
-    private boolean undeploy;
-    private int resend = 0;
-    private int compress = 0;
+    private final String contextName;
 
-    public UndeployMessage() {} //for serialization
     public UndeployMessage(Member address,
                            long timestamp,
                            String uniqueId,
-                           String contextName,
-                           boolean undeploy) {
+                           String contextName) {
         this.address  = address;
         this.timestamp= timestamp;
-        this.undeploy = undeploy;
         this.uniqueId = uniqueId;
-        this.undeploy = undeploy;
         this.contextName = contextName;
     }
 
@@ -78,45 +71,4 @@ public class UndeployMessage implements 
     public String getContextName() {
         return contextName;
     }
-
-    public void setContextPath(String contextName) {
-        this.contextName = contextName;
-    }
-
-    public boolean getUndeploy() {
-        return undeploy;
-    }
-
-    public void setUndeploy(boolean undeploy) {
-        this.undeploy = undeploy;
-    }
-    /**
-     * @return Returns the compress.
-     * @since 5.5.10
-     */
-    public int getCompress() {
-        return compress;
-    }
-    /**
-     * @param compress The compress to set.
-     * @since 5.5.10
-     */
-    public void setCompress(int compress) {
-        this.compress = compress;
-    }
-    /**
-     * @return Returns the resend.
-     * @since 5.5.10
-     */
-    public int getResend() {
-        return resend;
-    }
-    /**
-     * @param resend The resend to set.
-     * @since 5.5.10
-     */
-    public void setResend(int resend) {
-        this.resend = resend;
-    }
-
 }

Modified: tomcat/trunk/java/org/apache/catalina/ha/deploy/WarWatcher.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/ha/deploy/WarWatcher.java?rev=1361407&r1=1361406&r2=1361407&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/ha/deploy/WarWatcher.java (original)
+++ tomcat/trunk/java/org/apache/catalina/ha/deploy/WarWatcher.java Fri Jul 13 
21:44:35 2012
@@ -46,24 +46,20 @@ public class WarWatcher {
     /**
      * Directory to watch for war files
      */
-    protected File watchDir = null;
+    protected final File watchDir;
 
     /**
      * Parent to be notified of changes
      */
-    protected FileChangeListener listener = null;
+    protected final FileChangeListener listener;
 
     /**
      * Currently deployed files
      */
-    protected Map<String, WarInfo> currentStatus =
-        new HashMap<String, WarInfo>();
+    protected final Map<String, WarInfo> currentStatus = new HashMap<>();
 
     /*--Constructor---------------------------------------------*/
 
-    public WarWatcher() {
-    }
-
     public WarWatcher(FileChangeListener listener, File watchDir) {
         this.listener = listener;
         this.watchDir = watchDir;
@@ -122,35 +118,6 @@ public class WarWatcher {
         currentStatus.clear();
     }
 
-    /**
-     * @return Returns the watchDir.
-     */
-    public File getWatchDir() {
-        return watchDir;
-    }
-
-    /**
-     * @param watchDir
-     *            The watchDir to set.
-     */
-    public void setWatchDir(File watchDir) {
-        this.watchDir = watchDir;
-    }
-
-    /**
-     * @return Returns the listener.
-     */
-    public FileChangeListener getListener() {
-        return listener;
-    }
-
-    /**
-     * @param listener
-     *            The listener to set.
-     */
-    public void setListener(FileChangeListener listener) {
-        this.listener = listener;
-    }
 
     /*--Inner classes-------------------------------------------*/
 
@@ -170,7 +137,7 @@ public class WarWatcher {
      * File information on existing WAR files
      */
     protected static class WarInfo {
-        protected File war = null;
+        protected final File war;
 
         protected long lastChecked = 0;
 



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

Reply via email to