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 2008/09/26 14:20:04 UTC

svn commit: r699296 - in /tomcat/trunk/java/org/apache/catalina/ha/deploy: FarmWarDeployer.java WarWatcher.java

Author: markt
Date: Fri Sep 26 05:20:03 2008
New Revision: 699296

URL: http://svn.apache.org/viewvc?rev=699296&view=rev
Log:
Code clean up in o.a.c.h.deploy
No functional change

Modified:
    tomcat/trunk/java/org/apache/catalina/ha/deploy/FarmWarDeployer.java
    tomcat/trunk/java/org/apache/catalina/ha/deploy/WarWatcher.java

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=699296&r1=699295&r2=699296&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/ha/deploy/FarmWarDeployer.java (original)
+++ tomcat/trunk/java/org/apache/catalina/ha/deploy/FarmWarDeployer.java Fri Sep 26 05:20:03 2008
@@ -70,7 +70,8 @@
 
     protected boolean started = false; //default 5 seconds
 
-    protected HashMap fileFactories = new HashMap();
+    protected HashMap<String, FileMessageFactory> fileFactories =
+        new HashMap<String, FileMessageFactory>();
 
     protected String deployDir;
 
@@ -212,7 +213,7 @@
      */
     public void messageReceived(ClusterMessage msg) {
         try {
-            if (msg instanceof FileMessage && msg != null) {
+            if (msg instanceof FileMessage) {
                 FileMessage fmsg = (FileMessage) msg;
                 if (log.isDebugEnabled())
                     log.debug("receive cluster deployment [ path: "
@@ -250,7 +251,7 @@
                         removeFactory(fmsg);
                     }
                 }
-            } else if (msg instanceof UndeployMessage && msg != null) {
+            } else if (msg instanceof UndeployMessage) {
                 try {
                     UndeployMessage umsg = (UndeployMessage) msg;
                     String path = umsg.getContextPath();
@@ -291,8 +292,7 @@
             throws java.io.FileNotFoundException, java.io.IOException {
         File tmpFile = new File(msg.getFileName());
         File writeToFile = new File(getTempDir(), tmpFile.getName());
-        FileMessageFactory factory = (FileMessageFactory) fileFactories.get(msg
-                .getFileName());
+        FileMessageFactory factory = fileFactories.get(msg.getFileName());
         if (factory == null) {
             factory = FileMessageFactory.getInstance(writeToFile, true);
             fileFactories.put(msg.getFileName(), factory);
@@ -450,7 +450,7 @@
             } catch (Exception x) {
                 log.error("No removal", x);
             }
-            install(contextName, deployWar.toURL());
+            install(contextName, deployWar.toURI().toURL());
         } catch (Exception x) {
             log.error("Unable to install WAR file", x);
         }

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=699296&r1=699295&r2=699296&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/ha/deploy/WarWatcher.java (original)
+++ tomcat/trunk/java/org/apache/catalina/ha/deploy/WarWatcher.java Fri Sep 26 05:20:03 2008
@@ -54,7 +54,8 @@
     /**
      * Currently deployed files
      */
-    protected Map currentStatus = new HashMap();
+    protected Map<String, WarInfo> currentStatus =
+        new HashMap<String, WarInfo>();
 
     /*--Constructor---------------------------------------------*/
 
@@ -83,9 +84,10 @@
         }
 
         //check all the status codes and update the FarmDeployer
-        for (Iterator i = currentStatus.entrySet().iterator(); i.hasNext();) {
-            Map.Entry entry = (Map.Entry) i.next();
-            WarInfo info = (WarInfo) entry.getValue();
+        for (Iterator<Map.Entry<String,WarInfo>> i =
+                currentStatus.entrySet().iterator(); i.hasNext();) {
+            Map.Entry<String,WarInfo> entry = i.next();
+            WarInfo info = entry.getValue();
             int check = info.check();
             if (check == 1) {
                 listener.fileModified(info.getWar());
@@ -103,7 +105,7 @@
      * @param warfile
      */
     protected void addWarInfo(File warfile) {
-        WarInfo info = (WarInfo) currentStatus.get(warfile.getAbsolutePath());
+        WarInfo info = currentStatus.get(warfile.getAbsolutePath());
         if (info == null) {
             info = new WarInfo(warfile);
             info.setLastState(-1); //assume file is non existent



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