Return-Path: Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: (qmail 57443 invoked from network); 17 Oct 2008 13:01:47 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 17 Oct 2008 13:01:47 -0000 Received: (qmail 91584 invoked by uid 500); 17 Oct 2008 13:01:49 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 91528 invoked by uid 500); 17 Oct 2008 13:01:48 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 91519 invoked by uid 99); 17 Oct 2008 13:01:48 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Oct 2008 06:01:48 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Oct 2008 13:00:48 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 5FCBC238889E; Fri, 17 Oct 2008 06:00:56 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r705592 - in /activemq/trunk/activemq-core/src: main/java/org/apache/activemq/broker/ft/ test/java/org/apache/activemq/advisory/ Date: Fri, 17 Oct 2008 13:00:55 -0000 To: commits@activemq.apache.org From: gtully@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20081017130056.5FCBC238889E@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: gtully Date: Fri Oct 17 06:00:54 2008 New Revision: 705592 URL: http://svn.apache.org/viewvc?rev=705592&view=rev Log: resolve AMQ-1979, slave connection did not know about temp destinations so it would not delete on close, only on an explicit delete command Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/ft/MasterBroker.java activemq/trunk/activemq-core/src/test/java/org/apache/activemq/advisory/MasterSlaveTempQueueMemoryTest.java activemq/trunk/activemq-core/src/test/java/org/apache/activemq/advisory/TempQueueMemoryTest.java Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/ft/MasterBroker.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/ft/MasterBroker.java?rev=705592&r1=705591&r2=705592&view=diff ============================================================================== --- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/ft/MasterBroker.java (original) +++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/ft/MasterBroker.java Fri Oct 17 06:00:54 2008 @@ -17,6 +17,7 @@ package org.apache.activemq.broker.ft; import java.util.concurrent.atomic.AtomicBoolean; + import org.apache.activemq.broker.Connection; import org.apache.activemq.broker.ConnectionContext; import org.apache.activemq.broker.ConsumerBrokerExchange; @@ -211,14 +212,24 @@ super.removeSubscription(context, info); sendAsyncToSlave(info); } + + @Override + public void addDestinationInfo(ConnectionContext context, + DestinationInfo info) throws Exception { + super.addDestinationInfo(context, info); + if (info.getDestination().isTemporary()) { + sendAsyncToSlave(info); + } + } + @Override public void removeDestinationInfo(ConnectionContext context, DestinationInfo info) throws Exception { super.removeDestinationInfo(context, info); if (info.getDestination().isTemporary()) { sendAsyncToSlave(info); } - } + /** * begin a transaction * Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/advisory/MasterSlaveTempQueueMemoryTest.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/advisory/MasterSlaveTempQueueMemoryTest.java?rev=705592&r1=705591&r2=705592&view=diff ============================================================================== --- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/advisory/MasterSlaveTempQueueMemoryTest.java (original) +++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/advisory/MasterSlaveTempQueueMemoryTest.java Fri Oct 17 06:00:54 2008 @@ -75,6 +75,10 @@ AdvisoryBroker ab = (AdvisoryBroker) slave.getBroker().getAdaptor( AdvisoryBroker.class); + if (!deleteTempQueue) { + // give temp destination removes a chance to perculate on connection.close + Thread.sleep(2000); + } assertEquals("the temp queues should not be visible as they are removed", 1, ab.getAdvisoryDestinations().size()); RegionBroker rb = (RegionBroker) slave.getBroker().getAdaptor( @@ -101,7 +105,7 @@ // master does not always reach expected total, should be assertEquals.., why? assertTrue("dispatched to slave is as good as master, master=" + masterRb.getDestinationStatistics().getDispatched().getCount(), - rb.getDestinationStatistics().getDispatched().getCount() + 2*COUNT >= + rb.getDestinationStatistics().getDispatched().getCount() + 2*messagesToSend >= masterRb.getDestinationStatistics().getDispatched().getCount()); } @@ -121,7 +125,6 @@ try { latch.await(30L, TimeUnit.SECONDS); } catch (Exception e) { - // TODO Auto-generated catch block e.printStackTrace(); } } @@ -147,4 +150,11 @@ assertEquals("inflight match expected", 0, masterRb.getDestinationStatistics().getInflight().getCount()); assertEquals("inflight match on slave and master", slaveRb.getDestinationStatistics().getInflight().getCount(), masterRb.getDestinationStatistics().getInflight().getCount()); } + + public void testLoadRequestReplyWithNoTempQueueDelete() throws Exception { + deleteTempQueue = false; + messagesToSend = 10; + testLoadRequestReply(); + } + } Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/advisory/TempQueueMemoryTest.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/advisory/TempQueueMemoryTest.java?rev=705592&r1=705591&r2=705592&view=diff ============================================================================== --- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/advisory/TempQueueMemoryTest.java (original) +++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/advisory/TempQueueMemoryTest.java Fri Oct 17 06:00:54 2008 @@ -37,7 +37,8 @@ protected Connection clientConnection; protected Session clientSession; protected Destination serverDestination; - protected static final int COUNT = 2000; + protected int messagesToSend = 2000; + protected boolean deleteTempQueue = true; public void testLoadRequestReply() throws Exception { MessageConsumer serverConsumer = serverSession.createConsumer(serverDestination); @@ -56,7 +57,7 @@ }); MessageProducer producer = clientSession.createProducer(serverDestination); - for (int i =0; i< COUNT; i++) { + for (int i =0; i< messagesToSend; i++) { TemporaryQueue replyTo = clientSession.createTemporaryQueue(); MessageConsumer consumer = clientSession.createConsumer(replyTo); Message msg = clientSession.createMessage(); @@ -64,7 +65,11 @@ producer.send(msg); Message reply = consumer.receive(); consumer.close(); - replyTo.delete(); + if (deleteTempQueue) { + replyTo.delete(); + } else { + // temp queue will be cleaned up on clientConnection.close + } } clientSession.close();