qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ritch...@apache.org
Subject svn commit: r691661 - in /incubator/qpid/trunk/qpid/java: broker/src/main/java/org/apache/qpid/server/queue/ broker/src/main/java/org/apache/qpid/server/virtualhost/ broker/src/test/java/org/apache/qpid/server/exchange/ broker/src/test/java/org/apache/...
Date Wed, 03 Sep 2008 16:26:41 GMT
Author: ritchiem
Date: Wed Sep  3 09:26:38 2008
New Revision: 691661

URL: http://svn.apache.org/viewvc?rev=691661&view=rev
Log:
QPID-1266 : Provided test for new stop() method. Updated RefCountExService to allow retrieval
of the referenceCount. Updated AMQQueue to only perform stop() actions once, such as releasing
the RefCountExService. Updated instances where new virtualhosts were not added to the VHostRegistry.
See supplemental JIRA for removing the need for this.

Modified:
    incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java
    incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHost.java
    incubator/qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/exchange/DestWildExchangeTest.java
    incubator/qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/store/MessageStoreTest.java
    incubator/qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/util/InternalBrokerBaseCase.java
    incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/pool/ReferenceCountingExecutorService.java

Modified: incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java?rev=691661&r1=691660&r2=691661&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java
(original)
+++ incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/queue/SimpleAMQQueue.java
Wed Sep  3 09:26:38 2008
@@ -117,6 +117,7 @@
     private final AtomicLong _stateChangeCount = new AtomicLong(Long.MIN_VALUE);
     private AtomicReference _asynchronousRunner = new AtomicReference(null);
     private AtomicInteger _deliveredMessages = new AtomicInteger();
+    private AtomicBoolean _stopped = new AtomicBoolean(false);
 
     protected SimpleAMQQueue(AMQShortString name, boolean durable, AMQShortString owner,
boolean autoDelete, VirtualHost virtualHost)
             throws AMQException
@@ -1110,7 +1111,17 @@
 
     public void stop()
     {
-        ReferenceCountingExecutorService.getInstance().releaseExecutorService();
+        if (!_stopped.getAndSet(true))
+        {
+            ReferenceCountingExecutorService.getInstance().releaseExecutorService();
+        }
+        else
+        {
+            if(_logger.isDebugEnabled())
+            {
+                _logger.debug("Queue " + getName() + " already stopped");
+            }
+        }
     }
 
     public void deliverAsync()

Modified: incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHost.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHost.java?rev=691661&r1=691660&r2=691661&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHost.java
(original)
+++ incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/virtualhost/VirtualHost.java
Wed Sep  3 09:26:38 2008
@@ -301,6 +301,10 @@
 
     public void close() throws Exception
     {
+
+        //Stop Connections
+        _connectionRegistry.close();
+
         //Stop the Queues processing
         if (_queueRegistry != null)
         {
@@ -316,9 +320,6 @@
             _houseKeepingTimer.cancel();
         }        
 
-        //Stop Connections
-        _connectionRegistry.close();
-
         //Close MessageStore
         if (_messageStore != null)
         {

Modified: incubator/qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/exchange/DestWildExchangeTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/exchange/DestWildExchangeTest.java?rev=691661&r1=691660&r2=691661&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/exchange/DestWildExchangeTest.java
(original)
+++ incubator/qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/exchange/DestWildExchangeTest.java
Wed Sep  3 09:26:38 2008
@@ -60,10 +60,15 @@
         _protocolSession = new InternalTestProtocolSession();
     }
 
+    public void tearDown()
+    {
+        ApplicationRegistry.remove(1); 
+    }
+
 
     public void testNoRoute() throws AMQException
     {
-        AMQQueue queue = AMQQueueFactory.createAMQQueueImpl(new AMQShortString("a*#b"), false,
null, false, _vhost, null);
+        AMQQueue queue = AMQQueueFactory.createAMQQueueImpl(new AMQShortString("a*#b"), false,
null, false, _vhost, null);        
         _exchange.registerQueue(new AMQShortString("a.*.#.b"), queue, null);
 
 

Modified: incubator/qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/store/MessageStoreTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/store/MessageStoreTest.java?rev=691661&r1=691660&r2=691661&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/store/MessageStoreTest.java
(original)
+++ incubator/qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/store/MessageStoreTest.java
Wed Sep  3 09:26:38 2008
@@ -102,6 +102,7 @@
         try
         {
             _virtualHost = new VirtualHost(virtualHostName, configuration, null);
+            ApplicationRegistry.getInstance().getVirtualHostRegistry().registerVirtualHost(_virtualHost);
         }
         catch (Exception e)
         {

Modified: incubator/qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/util/InternalBrokerBaseCase.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/util/InternalBrokerBaseCase.java?rev=691661&r1=691660&r2=691661&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/util/InternalBrokerBaseCase.java
(original)
+++ incubator/qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/util/InternalBrokerBaseCase.java
Wed Sep  3 09:26:38 2008
@@ -56,7 +56,8 @@
         super.setUp();
         _registry = new TestApplicationRegistry();
         ApplicationRegistry.initialise(_registry);
-        _virtualHost = _registry.getVirtualHostRegistry().getVirtualHost("test");
+        _virtualHost = _registry.getVirtualHostRegistry().getVirtualHost("test");       

+
         _messageStore = _virtualHost.getMessageStore();
 
         QUEUE_NAME = new AMQShortString("test");
@@ -80,7 +81,7 @@
 
     public void tearDown() throws Exception
     {
-        ApplicationRegistry.removeAll();
+        ApplicationRegistry.remove(1);
         super.tearDown();
     }
 

Modified: incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/pool/ReferenceCountingExecutorService.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/pool/ReferenceCountingExecutorService.java?rev=691661&r1=691660&r2=691661&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/pool/ReferenceCountingExecutorService.java
(original)
+++ incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/pool/ReferenceCountingExecutorService.java
Wed Sep  3 09:26:38 2008
@@ -160,4 +160,13 @@
     {
         return _pool;
     }
+
+    /**
+     * Return the ReferenceCount to this ExecutorService
+     * @return reference count
+     */
+    public int getReferenceCount()
+    {
+        return _refCount;
+    }
 }



Mime
View raw message