You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2016/04/01 16:28:13 UTC

[1/5] brooklyn-server git commit: Localhost machine: don’t persist mutexSupport

Repository: brooklyn-server
Updated Branches:
  refs/heads/0.9.0 1ccdef868 -> d031cea08


Localhost machine: don’t persist mutexSupport

By passing mutexSupport in the machine’s config, it is persisted. But
this tries to pull in persisting threads etc!

It is not necessary to pass it: the Localhost machine overrides the
getMutexSupport().

Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/426ced9e
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/426ced9e
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/426ced9e

Branch: refs/heads/0.9.0
Commit: 426ced9ecd5b024c2475e9ab6a72f4e9292f54fe
Parents: 1ccdef8
Author: Aled Sage <al...@gmail.com>
Authored: Thu Mar 31 20:50:59 2016 +0100
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Fri Apr 1 15:27:29 2016 +0100

----------------------------------------------------------------------
 .../location/localhost/LocalhostMachineProvisioningLocation.java    | 1 -
 1 file changed, 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/426ced9e/core/src/main/java/org/apache/brooklyn/location/localhost/LocalhostMachineProvisioningLocation.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/location/localhost/LocalhostMachineProvisioningLocation.java b/core/src/main/java/org/apache/brooklyn/location/localhost/LocalhostMachineProvisioningLocation.java
index ab7ad01..fbdb769 100644
--- a/core/src/main/java/org/apache/brooklyn/location/localhost/LocalhostMachineProvisioningLocation.java
+++ b/core/src/main/java/org/apache/brooklyn/location/localhost/LocalhostMachineProvisioningLocation.java
@@ -176,7 +176,6 @@ public class LocalhostMachineProvisioningLocation extends FixedListMachineProvis
             Map<Object,Object> flags2 = MutableMap.<Object,Object>builder()
                     .putAll(flags)
                     .put("address", elvis(address, Networking.getLocalHost()))
-                    .put("mutexSupport", LocalhostMachine.mutexSupport)
                     .build();
             
             // copy inherited keys for ssh; 


[5/5] brooklyn-server git commit: small tweak to optimise subscription tracker access

Posted by he...@apache.org.
small tweak to optimise subscription tracker access


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

Branch: refs/heads/0.9.0
Commit: d031cea080613645219ba982c93264943798d4fc
Parents: ea762bb
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Fri Apr 1 15:21:30 2016 +0100
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Fri Apr 1 15:28:04 2016 +0100

----------------------------------------------------------------------
 .../java/org/apache/brooklyn/core/entity/AbstractEntity.java    | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d031cea0/core/src/main/java/org/apache/brooklyn/core/entity/AbstractEntity.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/entity/AbstractEntity.java b/core/src/main/java/org/apache/brooklyn/core/entity/AbstractEntity.java
index 58767e4..738ce86 100644
--- a/core/src/main/java/org/apache/brooklyn/core/entity/AbstractEntity.java
+++ b/core/src/main/java/org/apache/brooklyn/core/entity/AbstractEntity.java
@@ -264,7 +264,7 @@ public abstract class AbstractEntity extends AbstractBrooklynObject implements E
     @Deprecated
     protected final Map<String,Object> tempWorkings = Maps.newLinkedHashMap();
 
-    protected transient SubscriptionTracker _subscriptionTracker;
+    protected transient volatile SubscriptionTracker _subscriptionTracker;
     
     public AbstractEntity() {
         this(Maps.newLinkedHashMap(), null);
@@ -1492,6 +1492,9 @@ public abstract class AbstractEntity extends AbstractBrooklynObject implements E
         }
 
         protected SubscriptionTracker getSubscriptionTracker() {
+            if (_subscriptionTracker != null) {
+                return _subscriptionTracker;
+            }
             // TODO Would be nice to simplify concurrent model, and not synchronize on
             // AbstractEntity.this; perhaps could get rid of lazy-initialisation, but then
             // would need to first ensure `managementSupport` is definitely initialised.


[2/5] brooklyn-server git commit: Task serializer: avoid NPE if task result is null

Posted by he...@apache.org.
Task serializer: avoid NPE if task result is null

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

Branch: refs/heads/0.9.0
Commit: b39c7a03c3caad1ef35c1b6b9f61bb566bf14446
Parents: 426ced9
Author: Aled Sage <al...@gmail.com>
Authored: Thu Mar 31 20:51:26 2016 +0100
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Fri Apr 1 15:27:37 2016 +0100

----------------------------------------------------------------------
 .../apache/brooklyn/core/mgmt/persist/XmlMementoSerializer.java | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/b39c7a03/core/src/main/java/org/apache/brooklyn/core/mgmt/persist/XmlMementoSerializer.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/mgmt/persist/XmlMementoSerializer.java b/core/src/main/java/org/apache/brooklyn/core/mgmt/persist/XmlMementoSerializer.java
index 00693d9..e9085dc 100644
--- a/core/src/main/java/org/apache/brooklyn/core/mgmt/persist/XmlMementoSerializer.java
+++ b/core/src/main/java/org/apache/brooklyn/core/mgmt/persist/XmlMementoSerializer.java
@@ -315,7 +315,10 @@ public class XmlMementoSerializer<T> extends XmlSerializer<T> implements Memento
             if (source == null) return;
             if (((Task<?>)source).isDone() && !((Task<?>)source).isError()) {
                 try {
-                    context.convertAnother(((Task<?>)source).get());
+                    Object nextItem = ((Task<?>)source).get();
+                    if (nextItem != null) {
+                        context.convertAnother(nextItem);
+                    }
                 } catch (InterruptedException e) {
                     throw Exceptions.propagate(e);
                 } catch (ExecutionException e) {


[4/5] brooklyn-server git commit: Entity.getSubscriptionTracker synchronization

Posted by he...@apache.org.
Entity.getSubscriptionTracker synchronization

Avoid calling getSubscriptionContext() while holding lock on 
AbstractEntity.this. See discussion in https://github.com/apache/brooklyn-server/pull/96


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

Branch: refs/heads/0.9.0
Commit: ea762bb15d7c9652c5cf13f6efd13bb00ae28487
Parents: c2c1484
Author: Aled Sage <al...@gmail.com>
Authored: Fri Apr 1 12:32:39 2016 +0100
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Fri Apr 1 15:27:52 2016 +0100

----------------------------------------------------------------------
 .../java/org/apache/brooklyn/core/entity/AbstractEntity.java   | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/ea762bb1/core/src/main/java/org/apache/brooklyn/core/entity/AbstractEntity.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/entity/AbstractEntity.java b/core/src/main/java/org/apache/brooklyn/core/entity/AbstractEntity.java
index 09834af..58767e4 100644
--- a/core/src/main/java/org/apache/brooklyn/core/entity/AbstractEntity.java
+++ b/core/src/main/java/org/apache/brooklyn/core/entity/AbstractEntity.java
@@ -1492,9 +1492,13 @@ public abstract class AbstractEntity extends AbstractBrooklynObject implements E
         }
 
         protected SubscriptionTracker getSubscriptionTracker() {
+            // TODO Would be nice to simplify concurrent model, and not synchronize on
+            // AbstractEntity.this; perhaps could get rid of lazy-initialisation, but then
+            // would need to first ensure `managementSupport` is definitely initialised.
+            SubscriptionContext subscriptionContext = getSubscriptionContext();
             synchronized (AbstractEntity.this) {
                 if (_subscriptionTracker == null) {
-                    _subscriptionTracker = new SubscriptionTracker(getSubscriptionContext());
+                    _subscriptionTracker = new SubscriptionTracker(subscriptionContext);
                 }
                 return _subscriptionTracker;
             }


[3/5] brooklyn-server git commit: BROOKLYN-245: improve synchronization in entity

Posted by he...@apache.org.
BROOKLYN-245: improve synchronization in entity

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

Branch: refs/heads/0.9.0
Commit: c2c1484b1f5a1236b1bbc820faca42c426b2456f
Parents: b39c7a0
Author: Aled Sage <al...@gmail.com>
Authored: Thu Mar 31 20:46:58 2016 +0100
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Fri Apr 1 15:27:45 2016 +0100

----------------------------------------------------------------------
 .../org/apache/brooklyn/core/entity/AbstractEntity.java   | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/c2c1484b/core/src/main/java/org/apache/brooklyn/core/entity/AbstractEntity.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/entity/AbstractEntity.java b/core/src/main/java/org/apache/brooklyn/core/entity/AbstractEntity.java
index 1406855..09834af 100644
--- a/core/src/main/java/org/apache/brooklyn/core/entity/AbstractEntity.java
+++ b/core/src/main/java/org/apache/brooklyn/core/entity/AbstractEntity.java
@@ -1484,9 +1484,11 @@ public abstract class AbstractEntity extends AbstractBrooklynObject implements E
         }
         
         protected SubscriptionContext getSubscriptionContext() {
-            synchronized (AbstractEntity.this) {
-                return getManagementSupport().getSubscriptionContext();
-            }
+            // Rely on synchronization in EntityManagementSupport; synchronizing on AbstractEntity.this
+            // is dangerous because user's entity code might synchronize on that and call getAttribute.
+            // Given that getSubscriptionContext is called by AttributeMap.update (via emitInternal),
+            // that risks deadlock!
+            return getManagementSupport().getSubscriptionContext();
         }
 
         protected SubscriptionTracker getSubscriptionTracker() {
@@ -1548,7 +1550,7 @@ public abstract class AbstractEntity extends AbstractBrooklynObject implements E
      * @deprecated since 0.9.0; for internal use only
      */
     @Deprecated
-    protected synchronized SubscriptionTracker getSubscriptionTracker() {
+    protected SubscriptionTracker getSubscriptionTracker() {
         return subscriptions().getSubscriptionTracker();
     }