geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwo...@apache.org
Subject svn commit: r1095634 - /geronimo/server/trunk/plugins/hotdeploy/geronimo-hot-deploy/src/main/java/org/apache/geronimo/deployment/hot/DirectoryMonitor.java
Date Thu, 21 Apr 2011 09:18:24 GMT
Author: rwonly
Date: Thu Apr 21 09:18:24 2011
New Revision: 1095634

URL: http://svn.apache.org/viewvc?rev=1095634&view=rev
Log:
GERONIMO-5832 Error message repeatedly show on server console when deployed web application
twice 

Modified:
    geronimo/server/trunk/plugins/hotdeploy/geronimo-hot-deploy/src/main/java/org/apache/geronimo/deployment/hot/DirectoryMonitor.java

Modified: geronimo/server/trunk/plugins/hotdeploy/geronimo-hot-deploy/src/main/java/org/apache/geronimo/deployment/hot/DirectoryMonitor.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/hotdeploy/geronimo-hot-deploy/src/main/java/org/apache/geronimo/deployment/hot/DirectoryMonitor.java?rev=1095634&r1=1095633&r2=1095634&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/hotdeploy/geronimo-hot-deploy/src/main/java/org/apache/geronimo/deployment/hot/DirectoryMonitor.java
(original)
+++ geronimo/server/trunk/plugins/hotdeploy/geronimo-hot-deploy/src/main/java/org/apache/geronimo/deployment/hot/DirectoryMonitor.java
Thu Apr 21 09:18:24 2011
@@ -31,6 +31,7 @@ import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.concurrent.CopyOnWriteArrayList;
 
 import org.apache.geronimo.deployment.cli.DeployUtils;
 import org.apache.geronimo.kernel.repository.Artifact;
@@ -122,7 +123,7 @@ public class DirectoryMonitor implements
     private boolean done = false;
     private Listener listener; // a little cheesy, but do we really need multiple listeners?
     private final Map<String, FileInfo> files;
-    private final List<Artifact> toRemove = new ArrayList<Artifact>();
+    private final CopyOnWriteArrayList <Artifact> toRemove = new CopyOnWriteArrayList
<Artifact>();
     private File monitorFile;
 
     public DirectoryMonitor(File directory, Listener listener, int pollIntervalMillis) {
@@ -180,28 +181,25 @@ public class DirectoryMonitor implements
 
     public void removeModuleId(Artifact id) {
         log.info("Hot deployer notified that an artifact was removed: "+id);
-        synchronized (toRemove) {
-            toRemove.add(id);
-        }
+        toRemove.add(id);
     }
 
     private void doRemoves() {
-        synchronized (toRemove) {
-            synchronized(files) {
-                for (Artifact id: toRemove) {
-                    for (Iterator<String> it = files.keySet().iterator(); it.hasNext();)
{
-                        String path = it.next();
-                        FileInfo info = files.get(path);
-                        Artifact target = Artifact.create(info.getConfigId());
-                        if(id.matches(target)) { // need to remove record & delete file
-                            File file = new File(path);
-                            if(file.exists()) { // if not, probably it's deletion kicked
off this whole process
-                                log.info("Hot deployer deleting "+id);
-                                if(!FileUtils.recursiveDelete(file)) {
-                                    log.error("Hot deployer unable to delete "+path);
-                                }
-                                it.remove();
+        synchronized (files) {
+            for (Artifact id : toRemove) {
+                for (Iterator<String> filesItr = files.keySet().iterator(); filesItr.hasNext();)
{
+                    String path = filesItr.next();
+                    FileInfo info = files.get(path);
+                    Artifact target = Artifact.create(info.getConfigId());
+                    if (id.matches(target)) { // need to remove record & delete file
+                        File file = new File(path);
+                        if (file.exists()) { // if not, probably it's deletion kicked off
this whole process
+                            log.info("Hot deployer deleting " + id);
+                            if (!FileUtils.recursiveDelete(file)) {
+                                log.error("Hot deployer unable to delete " + path);
                             }
+                            filesItr.remove();
+                            toRemove.remove(id);
                         }
                     }
                 }



Mime
View raw message