Author: rgodfrey
Date: Sun Apr 12 15:09:38 2015
New Revision: 1673017

URL: http://svn.apache.org/r1673017
Log:
QPID-5818 : [Java Broker] creating children from within the configuration 
thread leads to deadlock as the configuration thread blocks waiting for a task 
which cannot be executed because it needs the config thread.  Instead use 
asynchronous child creation.

Modified:
    
qpid/trunk/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhost/berkeleydb/BDBHAReplicaVirtualHostImpl.java
    
qpid/trunk/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNodeImpl.java
    
qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/AbstractConfiguredObject.java
    
qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/RedirectingVirtualHostImpl.java

Modified: 
qpid/trunk/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhost/berkeleydb/BDBHAReplicaVirtualHostImpl.java
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhost/berkeleydb/BDBHAReplicaVirtualHostImpl.java?rev=1673017&r1=1673016&r2=1673017&view=diff
==============================================================================
--- 
qpid/trunk/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhost/berkeleydb/BDBHAReplicaVirtualHostImpl.java
 (original)
+++ 
qpid/trunk/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhost/berkeleydb/BDBHAReplicaVirtualHostImpl.java
 Sun Apr 12 15:09:38 2015
@@ -27,6 +27,8 @@ import java.util.Set;
 import java.util.UUID;
 import java.util.concurrent.ScheduledFuture;
 
+import com.google.common.util.concurrent.ListenableFuture;
+
 import org.apache.qpid.server.connection.IConnectionRegistry;
 import org.apache.qpid.server.exchange.ExchangeImpl;
 import org.apache.qpid.server.logging.EventLogger;
@@ -121,9 +123,9 @@ public class BDBHAReplicaVirtualHostImpl
     }
 
     @Override
-    protected <C extends ConfiguredObject> C addChild(final Class<C> 
childClass,
-                                                      final Map<String, 
Object> attributes,
-                                                      final 
ConfiguredObject... otherParents)
+    protected <C extends ConfiguredObject> ListenableFuture<C> 
addChildAsync(final Class<C> childClass,
+                                                                             
final Map<String, Object> attributes,
+                                                                             
final ConfiguredObject... otherParents)
     {
         throwUnsupportedForReplica();
         return null;

Modified: 
qpid/trunk/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNodeImpl.java
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNodeImpl.java?rev=1673017&r1=1673016&r2=1673017&view=diff
==============================================================================
--- 
qpid/trunk/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNodeImpl.java
 (original)
+++ 
qpid/trunk/qpid/java/bdbstore/src/main/java/org/apache/qpid/server/virtualhostnode/berkeleydb/BDBHAVirtualHostNodeImpl.java
 Sun Apr 12 15:09:38 2015
@@ -276,14 +276,14 @@ public class BDBHAVirtualHostNodeImpl ex
 
     @SuppressWarnings({ "rawtypes", "unchecked" })
     @Override
-    protected <C extends ConfiguredObject> C addChild(Class<C> childClass, 
Map<String, Object> attributes,
+    protected <C extends ConfiguredObject> ListenableFuture<C> 
addChildAsync(Class<C> childClass, Map<String, Object> attributes,
             ConfiguredObject... otherParents)
     {
         if(childClass == VirtualHost.class)
         {
-            return (C) getObjectFactory().create(VirtualHost.class, 
attributes, this);
+            return getObjectFactory().createAsync(childClass, attributes, 
this);
         }
-        return super.addChild(childClass, attributes, otherParents);
+        return super.addChildAsync(childClass, attributes, otherParents);
     }
 
     @Override

Modified: 
qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/AbstractConfiguredObject.java
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/AbstractConfiguredObject.java?rev=1673017&r1=1673016&r2=1673017&view=diff
==============================================================================
--- 
qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/AbstractConfiguredObject.java
 (original)
+++ 
qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/AbstractConfiguredObject.java
 Sun Apr 12 15:09:38 2015
@@ -1696,11 +1696,6 @@ public abstract class AbstractConfigured
     }
 
 
-    protected <C extends ConfiguredObject> C addChild(Class<C> childClass, 
Map<String, Object> attributes, ConfiguredObject... otherParents)
-    {
-        throw new UnsupportedOperationException();
-    }
-
     protected <C extends ConfiguredObject> ListenableFuture<C> 
addChildAsync(Class<C> childClass, Map<String, Object> attributes, 
ConfiguredObject... otherParents)
     {
         throw new UnsupportedOperationException();

Modified: 
qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/RedirectingVirtualHostImpl.java
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/RedirectingVirtualHostImpl.java?rev=1673017&r1=1673016&r2=1673017&view=diff
==============================================================================
--- 
qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/RedirectingVirtualHostImpl.java
 (original)
+++ 
qpid/trunk/qpid/java/broker-core/src/main/java/org/apache/qpid/server/virtualhostnode/RedirectingVirtualHostImpl.java
 Sun Apr 12 15:09:38 2015
@@ -28,6 +28,8 @@ import java.util.Set;
 import java.util.UUID;
 import java.util.concurrent.ScheduledFuture;
 
+import com.google.common.util.concurrent.ListenableFuture;
+
 import org.apache.qpid.server.connection.IConnectionRegistry;
 import org.apache.qpid.server.exchange.ExchangeImpl;
 import org.apache.qpid.server.logging.EventLogger;
@@ -121,9 +123,9 @@ class RedirectingVirtualHostImpl
     }
 
     @Override
-    protected <C extends ConfiguredObject> C addChild(final Class<C> 
childClass,
-                                                      final Map<String, 
Object> attributes,
-                                                      final 
ConfiguredObject... otherParents)
+    protected <C extends ConfiguredObject> ListenableFuture<C> 
addChildAsync(final Class<C> childClass,
+                                                                             
final Map<String, Object> attributes,
+                                                                             
final ConfiguredObject... otherParents)
     {
         throwUnsupportedForRedirector();
         return null;



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to