sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1704222 - in /sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs: config/JobManagerConfiguration.java tasks/CheckTopologyTask.java
Date Mon, 21 Sep 2015 06:54:29 GMT
Author: cziegeler
Date: Mon Sep 21 06:54:23 2015
New Revision: 1704222

URL: http://svn.apache.org/viewvc?rev=1704222&view=rev
Log:
SLING-4634 : Directly check if view is still current

Modified:
    sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/config/JobManagerConfiguration.java
    sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/tasks/CheckTopologyTask.java

Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/config/JobManagerConfiguration.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/config/JobManagerConfiguration.java?rev=1704222&r1=1704221&r2=1704222&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/config/JobManagerConfiguration.java
(original)
+++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/config/JobManagerConfiguration.java
Mon Sep 21 06:54:23 2015
@@ -516,21 +516,21 @@ public class JobManagerConfiguration imp
             if ( local != null ) {
                 local.schedule(new Runnable() {
 
-                        @Override
-                        public void run() {
-                            if ( runMaintenanceTasks ) {
-                                if ( newCaps.isLeader() && newCaps.isActive() ) {
-                                    mt.assignUnassignedJobs();
-                                }
+                    @Override
+                    public void run() {
+                        if ( runMaintenanceTasks ) {
+                            if ( newCaps.isLeader() && newCaps.isActive() ) {
+                                mt.assignUnassignedJobs();
                             }
-                            // start listeners
-                            if ( newCaps.isActive() ) {
-                                synchronized ( listeners ) {
-                                    notifiyListeners();
-                                }
+                        }
+                        // start listeners
+                        if ( newCaps.isActive() ) {
+                            synchronized ( listeners ) {
+                                notifiyListeners();
                             }
                         }
-                    }, local.AT(new Date(System.currentTimeMillis() + this.backgroundLoadDelay
* 1000)));
+                    }
+                }, local.AT(new Date(System.currentTimeMillis() + this.backgroundLoadDelay
* 1000)));
             }
         }
         logger.debug("Job processing started");

Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/tasks/CheckTopologyTask.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/tasks/CheckTopologyTask.java?rev=1704222&r1=1704221&r2=1704222&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/tasks/CheckTopologyTask.java
(original)
+++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/tasks/CheckTopologyTask.java
Mon Sep 21 06:54:23 2015
@@ -209,7 +209,7 @@ public class CheckTopologyTask {
      * - capabilities
      */
     public void assignUnassignedJobs() {
-        if ( caps.isLeader() && caps.isActive() ) {
+        if ( caps != null && caps.isLeader() && caps.isActive() ) {
             logger.debug("Checking unassigned jobs...");
             final ResourceResolver resolver = this.configuration.createResourceResolver();
             if ( resolver != null ) {
@@ -338,14 +338,16 @@ public class CheckTopologyTask {
      */
     public void fullRun(final boolean topologyChanged,
                         final boolean configChanged) {
-        // if topology changed, reschedule assigned jobs for stopped instances
-        if ( topologyChanged ) {
-            this.reassignJobsFromStoppedInstances();
-        }
-        // check for all topics
-        this.reassignStaleJobs();
+        if ( this.caps != null ) {
+            // if topology changed, reschedule assigned jobs for stopped instances
+            if ( topologyChanged ) {
+                this.reassignJobsFromStoppedInstances();
+            }
+            // check for all topics
+            this.reassignStaleJobs();
 
-        // try to assign unassigned jobs
-        this.assignUnassignedJobs();
+            // try to assign unassigned jobs
+            this.assignUnassignedJobs();
+        }
     }
 }



Mime
View raw message