brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henev...@apache.org
Subject [3/9] git commit: set entity RO status much earlier when known
Date Thu, 06 Nov 2014 10:36:52 GMT
set entity RO status much earlier when known

mainly to enable suppression of log messages that are hugely noisy in read-only mode


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

Branch: refs/heads/master
Commit: 283d17067f1b5eb5954708a2f9a106dec6ef0bfc
Parents: 7cfeacc
Author: Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
Authored: Wed Nov 5 22:39:37 2014 +0000
Committer: Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
Committed: Thu Nov 6 02:02:34 2014 +0000

----------------------------------------------------------------------
 .../main/java/brooklyn/entity/rebind/RebindManagerImpl.java  | 4 ++--
 .../brooklyn/management/internal/LocalEntityManager.java     | 8 +++++++-
 2 files changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/283d1706/core/src/main/java/brooklyn/entity/rebind/RebindManagerImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/brooklyn/entity/rebind/RebindManagerImpl.java b/core/src/main/java/brooklyn/entity/rebind/RebindManagerImpl.java
index 24076f9..09101f6 100644
--- a/core/src/main/java/brooklyn/entity/rebind/RebindManagerImpl.java
+++ b/core/src/main/java/brooklyn/entity/rebind/RebindManagerImpl.java
@@ -646,7 +646,9 @@ public class RebindManagerImpl implements RebindManager {
                 
                 try {
                     Entity entity = newEntity(entityId, entityManifest.getType(), getLoadingContextFromCatalogItemId(catalogItemId,
classLoader, rebindContext));
+                    ((EntityInternal)entity).getManagementSupport().setReadOnly( rebindContext.isReadOnly(entity)
);
                     rebindContext.registerEntity(entityId, entity);
+                    
                 } catch (Exception e) {
                     exceptionHandler.onCreateFailed(BrooklynObjectType.ENTITY, entityId,
entityManifest.getType(), e);
                 }
@@ -880,8 +882,6 @@ public class RebindManagerImpl implements RebindManager {
             EntityManagerInternal entityManager = (EntityManagerInternal)managementContext.getEntityManager();
             Set<String> oldEntities = Sets.newLinkedHashSet(entityManager.getEntityIds());
             for (Entity entity: rebindContext.getEntities()) {
-                ((EntityInternal)entity).getManagementSupport().setReadOnly( rebindContext.isReadOnly(entity)
);
-                
                 ManagementTransitionMode oldMode = entityManager.getLastManagementTransitionMode(entity.getId());
                 entityManager.setManagementTransitionMode(entity, computeMode(entity, oldMode,
rebindContext.isReadOnly(entity)) );
                 if (oldMode!=null)

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/283d1706/core/src/main/java/brooklyn/management/internal/LocalEntityManager.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/brooklyn/management/internal/LocalEntityManager.java b/core/src/main/java/brooklyn/management/internal/LocalEntityManager.java
index c6a5bcf..8a10727 100644
--- a/core/src/main/java/brooklyn/management/internal/LocalEntityManager.java
+++ b/core/src/main/java/brooklyn/management/internal/LocalEntityManager.java
@@ -290,12 +290,18 @@ public class LocalEntityManager implements EntityManagerInternal {
             if (mode==null) {
                 setManagementTransitionMode(it, mode = initialMode);
             }
-            if (it.getManagementSupport().isReadOnlyRaw()==null) {
+            
+            Boolean isReadOnlyFromEntity = it.getManagementSupport().isReadOnlyRaw();
+            if (isReadOnlyFromEntity==null) {
                 if (mode.isReadOnly()) {
                     // should have been marked by rebinder
                     log.warn("Read-only entity "+it+" not marked as such on call to manage;
marking and continuing");
                 }
                 it.getManagementSupport().setReadOnly(mode.isReadOnly());
+            } else {
+                if (!isReadOnlyFromEntity.equals(mode.isReadOnly())) {
+                    log.warn("Read-only status at entity "+it+" ("+isReadOnlyFromEntity+")
not consistent with management mode "+mode);
+                }
             }
             
             if (it.getManagementSupport().isDeployed()) {


Mime
View raw message