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 2016/11/27 19:31:24 UTC

[2/3] brooklyn-server git commit: LocalEntityManager: make fields private

LocalEntityManager: make fields private

Making these fields non-private is asking for trouble - it makes it 
harder to reason about what the class does and whether it\u2019s safe, 
particularly around thread safety etc.

It is also exposing more implementation detail than is required, making
refactoring harder in the future.

If there is a compelling reason to provide access to the fields,
we can consider adding accessor(s).

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

Branch: refs/heads/master
Commit: 76909821d20944b40a689caac95aabe58e4dfbb8
Parents: 870986b
Author: Aled Sage <al...@gmail.com>
Authored: Tue Nov 22 20:18:19 2016 +0000
Committer: Aled Sage <al...@gmail.com>
Committed: Fri Nov 25 23:01:01 2016 +0000

----------------------------------------------------------------------
 .../core/mgmt/internal/LocalEntityManager.java        | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/76909821/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/LocalEntityManager.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/LocalEntityManager.java b/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/LocalEntityManager.java
index 3a9d756..e51fa40 100644
--- a/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/LocalEntityManager.java
+++ b/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/LocalEntityManager.java
@@ -91,25 +91,25 @@ public class LocalEntityManager implements EntityManagerInternal {
     private final InternalPolicyFactory policyFactory;
     
     /** Entities that have been created, but have not yet begun to be managed */
-    protected final Map<String,Entity> preRegisteredEntitiesById = Collections.synchronizedMap(new WeakHashMap<String, Entity>());
+    private final Map<String,Entity> preRegisteredEntitiesById = Collections.synchronizedMap(new WeakHashMap<String, Entity>());
 
     /** Entities that are in the process of being managed, but where management is not yet complete */
-    protected final Map<String,Entity> preManagedEntitiesById = Collections.synchronizedMap(new WeakHashMap<String, Entity>());
+    private final Map<String,Entity> preManagedEntitiesById = Collections.synchronizedMap(new WeakHashMap<String, Entity>());
     
     /** Proxies of the managed entities */
-    protected final ConcurrentMap<String,Entity> entityProxiesById = Maps.newConcurrentMap();
+    private final ConcurrentMap<String,Entity> entityProxiesById = Maps.newConcurrentMap();
     
     /** Real managed entities */
-    protected final Map<String,Entity> entitiesById = Maps.newLinkedHashMap();
+    private final Map<String,Entity> entitiesById = Maps.newLinkedHashMap();
     
     /** Management mode for each entity */
-    protected final Map<String,ManagementTransitionMode> entityModesById = Collections.synchronizedMap(Maps.<String,ManagementTransitionMode>newLinkedHashMap());
+    private final Map<String,ManagementTransitionMode> entityModesById = Collections.synchronizedMap(Maps.<String,ManagementTransitionMode>newLinkedHashMap());
 
     /** Proxies of the managed entities */
-    protected final ObservableList entities = new ObservableList();
+    private final ObservableList entities = new ObservableList();
     
     /** Proxies of the managed entities that are applications */
-    protected final Set<Application> applications = Sets.newConcurrentHashSet();
+    private final Set<Application> applications = Sets.newConcurrentHashSet();
 
     private final BrooklynStorage storage;
     private final Map<String,String> entityTypes;