sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1676969 - in /sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs: JobManagerImpl.java scheduling/JobSchedulerImpl.java scheduling/ScheduledJobHandler.java tasks/CleanUpTask.java
Date Thu, 30 Apr 2015 12:10:48 GMT
Author: cziegeler
Date: Thu Apr 30 12:10:48 2015
New Revision: 1676969

URL: http://svn.apache.org/r1676969
Log:
SLING-4680 : Decouple scheduled jobs from observation

Modified:
    sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/JobManagerImpl.java
    sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/scheduling/JobSchedulerImpl.java
    sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/scheduling/ScheduledJobHandler.java
    sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/tasks/CleanUpTask.java

Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/JobManagerImpl.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/JobManagerImpl.java?rev=1676969&r1=1676968&r2=1676969&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/JobManagerImpl.java
(original)
+++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/JobManagerImpl.java
Thu Apr 30 12:10:48 2015
@@ -120,7 +120,7 @@ public class JobManagerImpl
     @Reference
     private QueueManager qManager;
 
-    private CleanUpTask maintenanceTask;
+    private volatile CleanUpTask maintenanceTask;
 
     /** Job Scheduler. */
     private org.apache.sling.event.impl.jobs.scheduling.JobSchedulerImpl jobScheduler;
@@ -132,7 +132,7 @@ public class JobManagerImpl
     @Activate
     protected void activate(final Map<String, Object> props) throws LoginException
{
         this.jobScheduler = new org.apache.sling.event.impl.jobs.scheduling.JobSchedulerImpl(this.configuration,
this.scheduler, this);
-        this.maintenanceTask = new CleanUpTask(this.configuration);
+        this.maintenanceTask = new CleanUpTask(this.configuration, this.jobScheduler);
 
         logger.info("Apache Sling Job Manager started on instance {}", Environment.APPLICATION_ID);
     }

Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/scheduling/JobSchedulerImpl.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/scheduling/JobSchedulerImpl.java?rev=1676969&r1=1676968&r2=1676969&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/scheduling/JobSchedulerImpl.java
(original)
+++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/scheduling/JobSchedulerImpl.java
Thu Apr 30 12:10:48 2015
@@ -538,4 +538,8 @@ public class JobSchedulerImpl
         }
         return null;
     }
+
+    public void maintenance() {
+        this.scheduledJobHandler.maintenance();
+    }
 }

Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/scheduling/ScheduledJobHandler.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/scheduling/ScheduledJobHandler.java?rev=1676969&r1=1676968&r2=1676969&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/scheduling/ScheduledJobHandler.java
(original)
+++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/scheduling/ScheduledJobHandler.java
Thu Apr 30 12:10:48 2015
@@ -538,4 +538,8 @@ public class ScheduledJobHandler impleme
             this.logger.debug("Ignored exception " + e.getMessage(), e);
         }
     }
+
+    public void maintenance() {
+        this.addFullScan();
+    }
 }

Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/tasks/CleanUpTask.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/tasks/CleanUpTask.java?rev=1676969&r1=1676968&r2=1676969&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/tasks/CleanUpTask.java
(original)
+++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/tasks/CleanUpTask.java
Thu Apr 30 12:10:48 2015
@@ -31,6 +31,7 @@ import org.apache.sling.api.resource.Val
 import org.apache.sling.event.impl.jobs.Utility;
 import org.apache.sling.event.impl.jobs.config.JobManagerConfiguration;
 import org.apache.sling.event.impl.jobs.config.TopologyCapabilities;
+import org.apache.sling.event.impl.jobs.scheduling.JobSchedulerImpl;
 import org.apache.sling.event.impl.support.BatchResourceRemover;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -48,14 +49,18 @@ public class CleanUpTask {
     /** Job manager configuration. */
     private final JobManagerConfiguration configuration;
 
+    /** Job scheduler. */
+    private final JobSchedulerImpl jobScheduler;
+
     /** We count the scheduler runs. */
     private volatile long schedulerRuns;
 
     /**
      * Constructor
      */
-    public CleanUpTask(final JobManagerConfiguration config) {
+    public CleanUpTask(final JobManagerConfiguration config, final JobSchedulerImpl jobScheduler)
{
         this.configuration = config;
+        this.jobScheduler = jobScheduler;
     }
 
     /**
@@ -75,6 +80,10 @@ public class CleanUpTask {
                 cleanUpUnassignedPath = null;
             }
 
+            // job scheduler is handled every third run
+            if ( schedulerRuns % 3 == 1 ) {
+                this.jobScheduler.maintenance();
+            }
             if ( schedulerRuns % 60 == 0 ) { // full clean up is done every hour
                 this.fullEmptyFolderCleanup(topologyCapabilities, this.configuration.getLocalJobsPath());
                 if ( cleanUpUnassignedPath != null ) {



Mime
View raw message