sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1633599 - in /sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/queues: AbstractJobQueue.java QueueJobCache.java
Date Wed, 22 Oct 2014 11:32:24 GMT
Author: cziegeler
Date: Wed Oct 22 11:32:24 2014
New Revision: 1633599

URL: http://svn.apache.org/r1633599
Log:
SLING-4048 : Avoid keeping jobs in memory. Readd full cache update

Modified:
    sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/queues/AbstractJobQueue.java
    sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/queues/QueueJobCache.java

Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/queues/AbstractJobQueue.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/queues/AbstractJobQueue.java?rev=1633599&r1=1633598&r2=1633599&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/queues/AbstractJobQueue.java
(original)
+++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/queues/AbstractJobQueue.java
Wed Oct 22 11:32:24 2014
@@ -339,10 +339,12 @@ public abstract class AbstractJobQueue
         logger.debug("Taking new job for {}", queueName);
         JobImpl result = null;
 
+        boolean doFull = false;
+
         while ( result == null && !this.isOutdated() && this.running ) {
             this.isWaitingForNextJob = true;
 
-            result = this.cache.getNextJob();
+            result = this.cache.getNextJob(doFull);
             if ( result == null && !this.isOutdated() && this.running ) {
                 // block
                 synchronized ( nextJobLock ) {
@@ -350,6 +352,7 @@ public abstract class AbstractJobQueue
                         try {
                             nextJobLock.wait(20000);
                             isWaitingForNextJob = false;
+                            doFull = true;
                         } catch ( final InterruptedException ignore ) {
                             Thread.currentThread().interrupt();
                         }

Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/queues/QueueJobCache.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/queues/QueueJobCache.java?rev=1633599&r1=1633598&r2=1633599&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/queues/QueueJobCache.java
(original)
+++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/queues/QueueJobCache.java
Wed Oct 22 11:32:24 2014
@@ -112,7 +112,7 @@ public class QueueJobCache {
      * {@link #reschedule(JobImpl)} and {@link #handleNewTopics(String)}
      * can be called concurrently.
      */
-    public JobImpl getNextJob() {
+    public JobImpl getNextJob(final boolean doFull) {
         JobImpl result = null;
 
         synchronized ( this.cache ) {
@@ -122,6 +122,9 @@ public class QueueJobCache {
                     checkingTopics.addAll(this.topicsWithNewJobs);
                     this.topicsWithNewJobs.clear();
                 }
+                if ( doFull ) {
+                    checkingTopics.addAll(this.topics);
+                }
                 if ( !checkingTopics.isEmpty() ) {
                     this.loadJobs(checkingTopics);
                 }



Mime
View raw message