You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by al...@apache.org on 2018/01/18 09:02:53 UTC
[6/7] brooklyn-server git commit: Single mutex for installation
Single mutex for installation
A single mutex id is used for copying resources and installation tasks.
This may slow down an installation but prevents the issue where e.g. 2
entities are trying to write to the same location or use the same shared
file.
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/ec2e6b9e
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/ec2e6b9e
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/ec2e6b9e
Branch: refs/heads/master
Commit: ec2e6b9ea0f0f75f6f3edfbb5269f6c4781bbffe
Parents: 90c63b2
Author: Duncan Grant <du...@cloudsoftcorp.com>
Authored: Wed Jan 17 16:51:49 2018 +0000
Committer: Duncan Grant <du...@cloudsoftcorp.com>
Committed: Wed Jan 17 16:51:49 2018 +0000
----------------------------------------------------------------------
.../base/AbstractSoftwareProcessSshDriver.java | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/ec2e6b9e/software/base/src/main/java/org/apache/brooklyn/entity/software/base/AbstractSoftwareProcessSshDriver.java
----------------------------------------------------------------------
diff --git a/software/base/src/main/java/org/apache/brooklyn/entity/software/base/AbstractSoftwareProcessSshDriver.java b/software/base/src/main/java/org/apache/brooklyn/entity/software/base/AbstractSoftwareProcessSshDriver.java
index f6885c2..a6b0def 100644
--- a/software/base/src/main/java/org/apache/brooklyn/entity/software/base/AbstractSoftwareProcessSshDriver.java
+++ b/software/base/src/main/java/org/apache/brooklyn/entity/software/base/AbstractSoftwareProcessSshDriver.java
@@ -293,9 +293,24 @@ public abstract class AbstractSoftwareProcessSshDriver extends AbstractSoftwareP
}
@Override
+ public void copyPreInstallResources() {
+ final WithMutexes mutexSupport = getLocation().mutexes();
+ String mutexId = "installation lock at host";
+ mutexSupport.acquireMutex(mutexId, "pre-installation lock at host for files and templates");
+ try {
+ super.copyPreInstallResources();
+ } catch (Exception e) {
+ log.warn("Error copying pre-install resources", e);
+ throw Exceptions.propagate(e);
+ } finally {
+ mutexSupport.releaseMutex(mutexId);
+ }
+ }
+
+ @Override
public void copyInstallResources() {
final WithMutexes mutexSupport = getLocation().mutexes();
- final String mutexId = "installing " + elvis(entity, this);
+ String mutexId = "installation lock at host";
mutexSupport.acquireMutex(mutexId, "installation lock at host for files and templates");
try {
super.copyInstallResources();
@@ -310,7 +325,7 @@ public abstract class AbstractSoftwareProcessSshDriver extends AbstractSoftwareP
@Override
public void copyCustomizeResources() {
final WithMutexes mutexSupport = getLocation().mutexes();
- final String mutexId = "customizing " + elvis(entity, this);
+ String mutexId = "installation lock at host";
mutexSupport.acquireMutex(mutexId, "installation lock at host for files and templates");
try {
super.copyCustomizeResources();