syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject [1/2] syncope git commit: [SYNCOPE-1244] Applying the elaborated patch
Date Tue, 05 Dec 2017 14:16:43 GMT
Repository: syncope
Updated Branches:
  refs/heads/2_0_X 84a928b58 -> 8c6e60592
  refs/heads/master 228e10e28 -> 597a57f1a


[SYNCOPE-1244] Applying the elaborated patch


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/8c6e6059
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/8c6e6059
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/8c6e6059

Branch: refs/heads/2_0_X
Commit: 8c6e6059260827836235459c4644696b28acbf0c
Parents: 84a928b
Author: Francesco Chicchiriccò <ilgrosso@apache.org>
Authored: Tue Dec 5 15:06:00 2017 +0100
Committer: Francesco Chicchiriccò <ilgrosso@apache.org>
Committed: Tue Dec 5 15:06:00 2017 +0100

----------------------------------------------------------------------
 .../provisioning/java/job/JobManagerImpl.java   | 33 +++++++++++++++-----
 1 file changed, 25 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/8c6e6059/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/JobManagerImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/JobManagerImpl.java
b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/JobManagerImpl.java
index b48f80c..6019335 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/JobManagerImpl.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/JobManagerImpl.java
@@ -25,6 +25,7 @@ import java.sql.SQLException;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
 import org.apache.commons.collections4.IterableUtils;
@@ -148,7 +149,7 @@ public class JobManagerImpl implements JobManager, SyncopeLoader {
             final Map<String, Object> jobMap)
             throws SchedulerException {
 
-        if (isRunningHere(new JobKey(jobName, Scheduler.DEFAULT_GROUP))) {
+        if (isRunning(new JobKey(jobName, Scheduler.DEFAULT_GROUP))) {
             LOG.debug("Job {} already running, cancel", jobName);
             return;
         }
@@ -304,6 +305,8 @@ public class JobManagerImpl implements JobManager, SyncopeLoader {
             } catch (SchedulerException e) {
                 LOG.error("Could not put Quartz instance {} in standby", instanceId, e);
             }
+
+            return;
         }
 
         final Pair<String, Long> conf = AuthContextUtils.execWithAuthContext(
@@ -335,20 +338,34 @@ public class JobManagerImpl implements JobManager, SyncopeLoader {
                     Set<SchedTask> tasks = new HashSet<>(taskDAO.<SchedTask>findAll(TaskType.SCHEDULED));
                     tasks.addAll(taskDAO.<PullTask>findAll(TaskType.PULL));
                     tasks.addAll(taskDAO.<PushTask>findAll(TaskType.PUSH));
-                    for (SchedTask task : tasks) {
+
+                    boolean loadException = false;
+                    for (Iterator<SchedTask> it = tasks.iterator(); it.hasNext() &&
!loadException;) {
+                        SchedTask task = it.next();
                         try {
                             register(task, task.getStartAt(), conf.getRight());
                         } catch (Exception e) {
                             LOG.error("While loading job instance for task " + task.getKey(),
e);
+                            loadException = true;
                         }
                     }
 
-                    // 2. jobs for Reports
-                    for (Report report : reportDAO.findAll()) {
-                        try {
-                            register(report, null, conf.getRight());
-                        } catch (Exception e) {
-                            LOG.error("While loading job instance for report " + report.getName(),
e);
+                    if (loadException) {
+                        LOG.debug("Errors while loading job instances for tasks, aborting");
+                    } else {
+                        // 2. jobs for Reports
+                        for (Iterator<Report> it = reportDAO.findAll().iterator();
it.hasNext() && !loadException;) {
+                            Report report = it.next();
+                            try {
+                                register(report, null, conf.getRight());
+                            } catch (Exception e) {
+                                LOG.error("While loading job instance for report " + report.getName(),
e);
+                                loadException = true;
+                            }
+                        }
+
+                        if (loadException) {
+                            LOG.debug("Errors while loading job instances for reports, aborting");
                         }
                     }
 


Mime
View raw message