syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject [2/3] syncope git commit: During PropagationTask execution, in case the task has to be saved, ensure that the resource instance is refreshed, as it might have been read from another thread
Date Wed, 13 Sep 2017 13:07:12 GMT
During PropagationTask execution, in case the task has to be saved, ensure that the resource
instance is refreshed, as it might have been read from another thread


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

Branch: refs/heads/master
Commit: f22c28db1e995f35fd0b6044609b2ee6dee3411c
Parents: 43518e5
Author: Francesco Chicchiriccò <ilgrosso@apache.org>
Authored: Wed Sep 13 15:01:44 2017 +0200
Committer: Francesco Chicchiriccò <ilgrosso@apache.org>
Committed: Wed Sep 13 15:01:55 2017 +0200

----------------------------------------------------------------------
 .../java/propagation/AbstractPropagationTaskExecutor.java     | 7 +++++++
 1 file changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/f22c28db/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/AbstractPropagationTaskExecutor.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/AbstractPropagationTaskExecutor.java
b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/AbstractPropagationTaskExecutor.java
index 9b1ab70..3bbed99 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/AbstractPropagationTaskExecutor.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/AbstractPropagationTaskExecutor.java
@@ -51,6 +51,7 @@ import org.apache.syncope.core.spring.ApplicationContextProvider;
 import org.apache.syncope.core.provisioning.java.utils.ConnObjectUtils;
 import org.apache.syncope.core.provisioning.api.utils.ExceptionUtils2;
 import org.apache.syncope.core.persistence.api.dao.AnyObjectDAO;
+import org.apache.syncope.core.persistence.api.dao.ExternalResourceDAO;
 import org.apache.syncope.core.persistence.api.dao.VirSchemaDAO;
 import org.apache.syncope.core.persistence.api.entity.resource.ExternalResource;
 import org.apache.syncope.core.persistence.api.entity.resource.MappingItem;
@@ -121,6 +122,9 @@ public abstract class AbstractPropagationTaskExecutor implements PropagationTask
     protected TaskDAO taskDAO;
 
     @Autowired
+    protected ExternalResourceDAO resourceDAO;
+
+    @Autowired
     protected VirSchemaDAO virSchemaDAO;
 
     /**
@@ -478,6 +482,9 @@ public abstract class AbstractPropagationTaskExecutor implements PropagationTask
                 execution.setTask(task);
                 task.add(execution);
 
+                // ensure that the resource instance is refreshed, as it might have been
read from another thread
+                task.setResource(resourceDAO.find(task.getResource().getKey()));
+
                 taskDAO.save(task);
                 // needed to generate a value for the execution key
                 taskDAO.flush();


Mime
View raw message