summaryrefslogtreecommitdiff
path: root/java/broker-core/src
diff options
context:
space:
mode:
authorRobert Godfrey <rgodfrey@apache.org>2014-07-16 20:35:11 +0000
committerRobert Godfrey <rgodfrey@apache.org>2014-07-16 20:35:11 +0000
commit76e41b31771a8c412da3408803ee9919a5f127e3 (patch)
tree14d347b9e6372b8cc335f715722060413084584c /java/broker-core/src
parent7e2d9473970945b9b747a1bc3f6836629fdab4ba (diff)
downloadqpid-python-76e41b31771a8c412da3408803ee9919a5f127e3.tar.gz
QPID-5787 : [Java Broker] Management can observe a child object before its constructor has completed
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1611181 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/broker-core/src')
-rw-r--r--java/broker-core/src/main/java/org/apache/qpid/server/model/AbstractConfiguredObject.java20
-rw-r--r--java/broker-core/src/main/java/org/apache/qpid/server/model/AbstractConfiguredObjectTypeFactory.java4
-rw-r--r--java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/ConnectionAdapter.java2
-rw-r--r--java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/FileBasedGroupProviderImpl.java2
-rw-r--r--java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/SessionAdapter.java1
-rw-r--r--java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManager.java1
-rw-r--r--java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java3
7 files changed, 21 insertions, 12 deletions
diff --git a/java/broker-core/src/main/java/org/apache/qpid/server/model/AbstractConfiguredObject.java b/java/broker-core/src/main/java/org/apache/qpid/server/model/AbstractConfiguredObject.java
index e084ea0f1d..baf20da486 100644
--- a/java/broker-core/src/main/java/org/apache/qpid/server/model/AbstractConfiguredObject.java
+++ b/java/broker-core/src/main/java/org/apache/qpid/server/model/AbstractConfiguredObject.java
@@ -237,14 +237,6 @@ public abstract class AbstractConfiguredObject<X extends ConfiguredObject<X>> im
_childrenByName.put(childClass, new ConcurrentHashMap<String, ConfiguredObject<?>>());
}
- for(ConfiguredObject<?> parent : parents.values())
- {
- if(parent instanceof AbstractConfiguredObject<?>)
- {
- ((AbstractConfiguredObject<?>)parent).registerChild(this);
- }
- }
-
for(Map.Entry<Class<? extends ConfiguredObject>, ConfiguredObject<?>> entry : parents.entrySet())
{
addParent((Class<ConfiguredObject<?>>) entry.getKey(), entry.getValue());
@@ -405,6 +397,17 @@ public abstract class AbstractConfiguredObject<X extends ConfiguredObject<X>> im
}
}
+ public void registerWithParents()
+ {
+ for(ConfiguredObject<?> parent : _parents.values())
+ {
+ if(parent instanceof AbstractConfiguredObject<?>)
+ {
+ ((AbstractConfiguredObject<?>)parent).registerChild(this);
+ }
+ }
+ }
+
protected void closeChildren()
{
applyToChildren(new Action<ConfiguredObject<?>>()
@@ -453,6 +456,7 @@ public abstract class AbstractConfiguredObject<X extends ConfiguredObject<X>> im
{
if(_dynamicState.compareAndSet(DynamicState.UNINIT, DynamicState.OPENED))
{
+ registerWithParents();
final AuthenticatedPrincipal currentUser = SecurityManager.getCurrentUser();
if(currentUser != null)
{
diff --git a/java/broker-core/src/main/java/org/apache/qpid/server/model/AbstractConfiguredObjectTypeFactory.java b/java/broker-core/src/main/java/org/apache/qpid/server/model/AbstractConfiguredObjectTypeFactory.java
index d0bc1c3436..5bf5e337ad 100644
--- a/java/broker-core/src/main/java/org/apache/qpid/server/model/AbstractConfiguredObjectTypeFactory.java
+++ b/java/broker-core/src/main/java/org/apache/qpid/server/model/AbstractConfiguredObjectTypeFactory.java
@@ -109,7 +109,9 @@ abstract public class AbstractConfiguredObjectTypeFactory<X extends AbstractConf
{
Map<String,Object> attributesWithId = new HashMap<String, Object>(getRecord().getAttributes());
attributesWithId.put(ConfiguredObject.ID, getRecord().getId());
- return createInstance(attributesWithId, getParents());
+ X instance = createInstance(attributesWithId, getParents());
+ instance.registerWithParents();
+ return instance;
}
}
}
diff --git a/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/ConnectionAdapter.java b/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/ConnectionAdapter.java
index c6a2d46267..2355041f67 100644
--- a/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/ConnectionAdapter.java
+++ b/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/ConnectionAdapter.java
@@ -61,7 +61,6 @@ public final class ConnectionAdapter extends AbstractConfiguredObject<Connection
deleted();
}
});
- open();
conn.addSessionListener(this);
}
@@ -215,6 +214,7 @@ public final class ConnectionAdapter extends AbstractConfiguredObject<Connection
public void sessionAdded(final AMQSessionModel<?, ?> session)
{
SessionAdapter adapter = new SessionAdapter(this, session);
+ adapter.create();
childAdded(adapter);
}
diff --git a/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/FileBasedGroupProviderImpl.java b/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/FileBasedGroupProviderImpl.java
index c576fa4e25..b273cf7dce 100644
--- a/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/FileBasedGroupProviderImpl.java
+++ b/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/FileBasedGroupProviderImpl.java
@@ -146,6 +146,7 @@ public class FileBasedGroupProviderImpl
attrMap.put(Group.NAME, group.getName());
GroupAdapter groupAdapter = new GroupAdapter(attrMap);
principals.add(groupAdapter);
+ groupAdapter.registerWithParents();
groupAdapter.open();
}
@@ -407,6 +408,7 @@ public class FileBasedGroupProviderImpl
attrMap.put(GroupMember.ID,id);
attrMap.put(GroupMember.NAME, principal.getName());
GroupMemberAdapter groupMemberAdapter = new GroupMemberAdapter(attrMap);
+ groupMemberAdapter.registerWithParents();
groupMemberAdapter.open();
members.add(groupMemberAdapter);
}
diff --git a/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/SessionAdapter.java b/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/SessionAdapter.java
index 689166e951..c2ce50764a 100644
--- a/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/SessionAdapter.java
+++ b/java/broker-core/src/main/java/org/apache/qpid/server/model/adapter/SessionAdapter.java
@@ -78,7 +78,6 @@ final class SessionAdapter extends AbstractConfiguredObject<SessionAdapter> impl
}
});
- open();
}
private static Map<String, Object> createAttributes(final AMQSessionModel session)
diff --git a/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManager.java b/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManager.java
index da3eb2293a..bbee5e2210 100644
--- a/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManager.java
+++ b/java/broker-core/src/main/java/org/apache/qpid/server/security/auth/manager/PrincipalDatabaseAuthenticationManager.java
@@ -110,6 +110,7 @@ public abstract class PrincipalDatabaseAuthenticationManager<T extends Principal
for (Principal user : users)
{
PrincipalAdapter principalAdapter = new PrincipalAdapter(user);
+ principalAdapter.registerWithParents();
principalAdapter.open();
_userMap.put(user, principalAdapter);
}
diff --git a/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java b/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java
index fa6da37d45..1765aebcca 100644
--- a/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java
+++ b/java/broker-core/src/main/java/org/apache/qpid/server/virtualhost/AbstractVirtualHost.java
@@ -768,7 +768,8 @@ public abstract class AbstractVirtualHost<X extends AbstractVirtualHost<X>> exte
connection.block();
}
- Connection c = new ConnectionAdapter(connection);
+ ConnectionAdapter c = new ConnectionAdapter(connection);
+ c.create();
childAdded(c);
}