incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1099114 - in /sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs: DefaultJobManager.java jcr/PersistenceHandler.java
Date Tue, 03 May 2011 16:23:13 GMT
Author: cziegeler
Date: Tue May  3 16:23:13 2011
New Revision: 1099114

URL: http://svn.apache.org/viewvc?rev=1099114&view=rev
Log:
SLING-2071 : Job is not locked and can be removed if locking manager is configured with "none"

Modified:
    sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/DefaultJobManager.java
    sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/jcr/PersistenceHandler.java

Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/DefaultJobManager.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/DefaultJobManager.java?rev=1099114&r1=1099113&r2=1099114&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/DefaultJobManager.java
(original)
+++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/DefaultJobManager.java
Tue May  3 16:23:13 2011
@@ -459,6 +459,19 @@ public class DefaultJobManager
     }
 
     /**
+     * Job started
+     */
+    public void notifyRescheduleJob(final String key) {
+        final JobEvent job;
+        synchronized ( this.allEvents ) {
+            job = this.allEvents.get(key);
+        }
+        if ( job != null ) {
+            job.started = -1;
+        }
+    }
+
+    /**
      * Check the requested job type
      */
     private boolean checkType(final QueryType type, final JobEvent event) {
@@ -651,7 +664,11 @@ public class DefaultJobManager
         }
         boolean result = true;
         if ( job != null ) {
-            result = job.remove();
+            if ( job.started != 1 ) {
+                result = job.remove();
+            } else {
+                result = false;
+            }
         }
         return result;
     }
@@ -763,6 +780,10 @@ public class DefaultJobManager
         final List<JobEvent> jobs;
         synchronized ( this.allEvents ) {
             jobs = new ArrayList<JobEvent>(this.allEvents.values());
+            this.allEvents.clear();
+        }
+        synchronized ( this.allEventsByTopic ) {
+            this.allEventsByTopic.clear();
         }
         for(final JobEvent job : jobs) {
             job.restart();

Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/jcr/PersistenceHandler.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/jcr/PersistenceHandler.java?rev=1099114&r1=1099113&r2=1099114&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/jcr/PersistenceHandler.java
(original)
+++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/jcr/PersistenceHandler.java
Tue May  3 16:23:13 2011
@@ -1210,6 +1210,7 @@ public class PersistenceHandler implemen
 
                     // and unlock
                     this.lockManager.unlock(this.backgroundSession, path);
+                    ((DefaultJobManager)this.jobManager).notifyRescheduleJob(info.uniqueId);
                     return true;
                 }
             } catch (RepositoryException re) {



Mime
View raw message