brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject [1/2] brooklyn-server git commit: ensures locations are made available to location registry when catalog is reset
Date Thu, 25 Aug 2016 15:06:03 GMT
Repository: brooklyn-server
Updated Branches:
  refs/heads/master c57fb6004 -> 1855c07c8


ensures locations are made available to location registry when catalog is reset

(longer term the location registry should be removed in favour of pure catalog,
but this is a tactical fix)

also minor fix w dep config seeing null values


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

Branch: refs/heads/master
Commit: c4465153b5ae6f66a843c949814e88d9f6c4d7b9
Parents: c57fb60
Author: Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
Authored: Thu Aug 25 14:03:08 2016 +0100
Committer: Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
Committed: Thu Aug 25 14:03:08 2016 +0100

----------------------------------------------------------------------
 .../core/catalog/internal/BasicBrooklynCatalog.java     | 12 +++++++++---
 .../core/catalog/internal/CatalogInitialization.java    |  8 ++++----
 .../brooklyn/core/sensor/DependentConfiguration.java    |  4 ++--
 3 files changed, 15 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/c4465153/core/src/main/java/org/apache/brooklyn/core/catalog/internal/BasicBrooklynCatalog.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/catalog/internal/BasicBrooklynCatalog.java
b/core/src/main/java/org/apache/brooklyn/core/catalog/internal/BasicBrooklynCatalog.java
index c4a2a50..2c05005 100644
--- a/core/src/main/java/org/apache/brooklyn/core/catalog/internal/BasicBrooklynCatalog.java
+++ b/core/src/main/java/org/apache/brooklyn/core/catalog/internal/BasicBrooklynCatalog.java
@@ -154,6 +154,7 @@ public class BasicBrooklynCatalog implements BrooklynCatalog {
                         cdto.setManagementContext((ManagementContextInternal) mgmt);
                     }
                     setManagementContext = true;
+                    onAdditionUpdateOtherRegistries(cdto);
                 }
             }
             if (!setManagementContext) {
@@ -163,6 +164,7 @@ public class BasicBrooklynCatalog implements BrooklynCatalog {
             if (log.isTraceEnabled()) {
                 log.trace("Scheduling item for persistence addition: {}", entry.getId());
             }
+            
             mgmt.getRebindManager().getChangeListener().onManaged(entry);
         }
 
@@ -951,14 +953,18 @@ public class BasicBrooklynCatalog implements BrooklynCatalog {
         if (log.isTraceEnabled()) {
             log.trace("Scheduling item for persistence addition: {}", itemDto.getId());
         }
+        onAdditionUpdateOtherRegistries(itemDto);
+        mgmt.getRebindManager().getChangeListener().onManaged(itemDto);
+
+        return itemDto;
+    }
+
+    private void onAdditionUpdateOtherRegistries(CatalogItemDtoAbstract<?, ?> itemDto)
{
         if (itemDto.getCatalogItemType() == CatalogItemType.LOCATION) {
             @SuppressWarnings("unchecked")
             CatalogItem<Location,LocationSpec<?>> locationItem = (CatalogItem<Location,
LocationSpec<?>>) itemDto;
             ((BasicLocationRegistry)mgmt.getLocationRegistry()).updateDefinedLocation(locationItem);
         }
-        mgmt.getRebindManager().getChangeListener().onManaged(itemDto);
-
-        return itemDto;
     }
 
     /** returns item DTO if item is an allowed duplicate, or null if it should be added (there
is no duplicate), 

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/c4465153/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogInitialization.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogInitialization.java
b/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogInitialization.java
index b8fdb9f..8083921 100644
--- a/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogInitialization.java
+++ b/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogInitialization.java
@@ -159,13 +159,13 @@ public class CatalogInitialization implements ManagementContextInjectable
{
      *   after a master -> standby -> master cycle)
      * @param needsInitialItemsLoaded whether the catalog needs the initial items loaded
      * @param needsAdditionalItemsLoaded whether the catalog needs the additions loaded
-     * @param optionalExcplicitItemsForResettingCatalog
+     * @param optionalExplicitItemsForResettingCatalog
      *   if supplied, the catalog is reset to contain only these items, before calling any
other initialization
      *   for use primarily when rebinding
      */
-    public void populateCatalog(ManagementNodeState nodeState, boolean needsInitialItemsLoaded,
boolean needsAdditionsLoaded, Collection<CatalogItem<?, ?>> optionalExcplicitItemsForResettingCatalog)
{
+    public void populateCatalog(ManagementNodeState nodeState, boolean needsInitialItemsLoaded,
boolean needsAdditionsLoaded, Collection<CatalogItem<?, ?>> optionalExplicitItemsForResettingCatalog)
{
         if (log.isDebugEnabled()) {
-            String message = "Populating catalog for "+nodeState+", needsInitial="+needsInitialItemsLoaded+",
needsAdditional="+needsAdditionsLoaded+", explicitItems="+(optionalExcplicitItemsForResettingCatalog==null
? "null" : optionalExcplicitItemsForResettingCatalog.size())+"; from "+JavaClassNames.callerNiceClassAndMethod(1);
+            String message = "Populating catalog for "+nodeState+", needsInitial="+needsInitialItemsLoaded+",
needsAdditional="+needsAdditionsLoaded+", explicitItems="+(optionalExplicitItemsForResettingCatalog==null
? "null" : optionalExplicitItemsForResettingCatalog.size())+"; from "+JavaClassNames.callerNiceClassAndMethod(1);
             if (!ManagementNodeState.isHotProxy(nodeState)) {
                 log.debug(message);
             } else {
@@ -196,7 +196,7 @@ public class CatalogInitialization implements ManagementContextInjectable
{
                     }
                 }
 
-                populateCatalogImpl(catalog, needsInitialItemsLoaded, needsAdditionsLoaded,
optionalExcplicitItemsForResettingCatalog);
+                populateCatalogImpl(catalog, needsInitialItemsLoaded, needsAdditionsLoaded,
optionalExplicitItemsForResettingCatalog);
                 if (nodeState == ManagementNodeState.MASTER) {
                     // TODO ideally this would remain false until it has *persisted* the
changed catalog;
                     // if there is a subsequent startup failure the forced additions will
not be persisted,

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/c4465153/core/src/main/java/org/apache/brooklyn/core/sensor/DependentConfiguration.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/sensor/DependentConfiguration.java
b/core/src/main/java/org/apache/brooklyn/core/sensor/DependentConfiguration.java
index 0c622c3..b4709d9 100644
--- a/core/src/main/java/org/apache/brooklyn/core/sensor/DependentConfiguration.java
+++ b/core/src/main/java/org/apache/brooklyn/core/sensor/DependentConfiguration.java
@@ -674,9 +674,9 @@ public class DependentConfiguration {
         protected List<AttributeAndSensorCondition<?>> abortSensorConditions
= Lists.newArrayList();
         protected String blockingDetails;
         protected Duration timeout;
-        protected Maybe<V> onTimeout;
+        protected Maybe<V> onTimeout = Maybe.absent();
         protected  boolean ignoreUnmanaged = WaitInTaskForAttributeReady.DEFAULT_IGNORE_UNMANAGED;
-        protected Maybe<V> onUnmanaged;
+        protected Maybe<V> onUnmanaged = Maybe.absent();
 
         protected Builder(Entity source, AttributeSensor<T> sensor) {
             this.source = source;


Mime
View raw message