syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmarte...@apache.org
Subject syncope git commit: [SYNCOPE-1385] makes PriorityPropagationTaskExecutor timeout closer to the maximum connector connection request timeout
Date Mon, 15 Oct 2018 14:22:10 GMT
Repository: syncope
Updated Branches:
  refs/heads/2_0_X 59b806731 -> 28812f7d1


[SYNCOPE-1385] makes PriorityPropagationTaskExecutor timeout closer to the maximum connector
connection request timeout


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

Branch: refs/heads/2_0_X
Commit: 28812f7d168b054eae78909092fa42840dd97ef2
Parents: 59b8067
Author: fmartelli <fabio.martelli@gmail.com>
Authored: Mon Oct 15 16:21:59 2018 +0200
Committer: fmartelli <fabio.martelli@gmail.com>
Committed: Mon Oct 15 16:21:59 2018 +0200

----------------------------------------------------------------------
 .../PriorityPropagationTaskExecutor.java        | 23 ++++++++++++--------
 1 file changed, 14 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/28812f7d/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/PriorityPropagationTaskExecutor.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/PriorityPropagationTaskExecutor.java
b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/PriorityPropagationTaskExecutor.java
index 4535802..9fc95ca 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/PriorityPropagationTaskExecutor.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/PriorityPropagationTaskExecutor.java
@@ -34,7 +34,6 @@ import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
 import javax.annotation.Resource;
 import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.collections4.Predicate;
 import org.apache.syncope.common.lib.to.PropagationTaskTO;
 import org.apache.syncope.common.lib.types.PropagationTaskExecStatus;
 import org.apache.syncope.core.persistence.api.entity.resource.ExternalResource;
@@ -85,17 +84,23 @@ public class PriorityPropagationTaskExecutor extends AbstractPropagationTaskExec
             final boolean nullPriorityAsync) {
 
         final Map<PropagationTaskTO, ExternalResource> taskToResource = new HashMap<>(tasks.size());
+        List<PropagationTaskTO> prioritizedTasks = new ArrayList<>();
+        int connRequestTimeout = 60;
         for (PropagationTaskTO task : tasks) {
-            taskToResource.put(task, resourceDAO.find(task.getResource()));
-        }
+            ExternalResource resource = resourceDAO.find(task.getResource());
+            taskToResource.put(task, resource);
 
-        List<PropagationTaskTO> prioritizedTasks = CollectionUtils.select(tasks, new
Predicate<PropagationTaskTO>() {
+            if (resource.getPropagationPriority() != null) {
+                prioritizedTasks.add(task);
 
-            @Override
-            public boolean evaluate(final PropagationTaskTO task) {
-                return taskToResource.get(task).getPropagationPriority() != null;
+                if (resource.getConnector().getConnRequestTimeout() != null
+                        && connRequestTimeout < resource.getConnector().getConnRequestTimeout())
{
+                    connRequestTimeout = resource.getConnector().getConnRequestTimeout();
+                    LOG.debug("Upgrade request connection timeout to {}", connRequestTimeout);
+                }
             }
-        }, new ArrayList<PropagationTaskTO>());
+        }
+
         Collections.sort(prioritizedTasks, new PriorityComparator(taskToResource));
         LOG.debug("Propagation tasks sorted by priority, for serial execution: {}", prioritizedTasks);
 
@@ -152,7 +157,7 @@ public class PriorityPropagationTaskExecutor extends AbstractPropagationTaskExec
                                 }
                             }
                         }
-                    }).get(60, TimeUnit.SECONDS);
+                    }).get(connRequestTimeout, TimeUnit.SECONDS);
                 } catch (Exception e) {
                     LOG.error("Unexpected exception", e);
                 } finally {


Mime
View raw message