[jboss-cvs] JBoss Messaging SVN: r5438 - in branches/Branch_1_4: tests/src/org/jboss/test/messaging/jms and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Nov 27 00:29:02 EST 2008
Author: gaohoward
Date: 2008-11-27 00:29:02 -0500 (Thu, 27 Nov 2008)
New Revision: 5438
Modified:
branches/Branch_1_4/src/main/org/jboss/messaging/core/impl/ChannelSupport.java
branches/Branch_1_4/src/main/org/jboss/messaging/core/impl/PagingChannelSupport.java
branches/Branch_1_4/tests/src/org/jboss/test/messaging/jms/ScheduledDeliveryTest.java
Log:
JBMESSAGING-1460
Modified: branches/Branch_1_4/src/main/org/jboss/messaging/core/impl/ChannelSupport.java
===================================================================
--- branches/Branch_1_4/src/main/org/jboss/messaging/core/impl/ChannelSupport.java 2008-11-26 14:12:48 UTC (rev 5437)
+++ branches/Branch_1_4/src/main/org/jboss/messaging/core/impl/ChannelSupport.java 2008-11-27 05:29:02 UTC (rev 5438)
@@ -43,6 +43,7 @@
import org.jboss.messaging.util.prioritylinkedlist.BasicPriorityLinkedList;
import org.jboss.messaging.util.prioritylinkedlist.PriorityLinkedList;
import org.jboss.util.timeout.Timeout;
+import org.jboss.util.timeout.TimeoutExt;
import org.jboss.util.timeout.TimeoutTarget;
import EDU.oswego.cs.dl.util.concurrent.SynchronizedInt;
@@ -373,7 +374,7 @@
distributor = null;
}
- clearAllScheduledDeliveries();
+ clearAllScheduledDeliveries(false);
}
}
@@ -422,7 +423,7 @@
log.trace(this + " done removing all references, there are " + this.messageRefs.size());
}
- clearAllScheduledDeliveries();
+ clearAllScheduledDeliveries(true);
}
public List undelivered(Filter filter)
@@ -541,7 +542,7 @@
// Protected ------------------------------------------------------------------------------------
- protected void clearAllScheduledDeliveries()
+ protected void clearAllScheduledDeliveries(boolean needRemove)
{
synchronized (scheduledDeliveries)
{
@@ -554,6 +555,26 @@
Timeout timeout = (Timeout)iter.next();
timeout.cancel();
+
+ if (needRemove) {
+ if (timeout instanceof TimeoutExt) {
+ TimeoutExt te = (TimeoutExt)timeout;
+ DeliverRefTimeoutTarget target = (DeliverRefTimeoutTarget)te.getTimeoutTarget();
+
+ log.trace("clearing scheduled ref " + target.ref);
+
+ SimpleDelivery del = new SimpleDelivery(this, target.ref);
+
+ try
+ {
+ del.acknowledge(null);
+ }
+ catch (Throwable e)
+ {
+ log.warn("exception when acknowledging", e);
+ }
+ }
+ }
}
scheduledDeliveries.clear();
Modified: branches/Branch_1_4/src/main/org/jboss/messaging/core/impl/PagingChannelSupport.java
===================================================================
--- branches/Branch_1_4/src/main/org/jboss/messaging/core/impl/PagingChannelSupport.java 2008-11-26 14:12:48 UTC (rev 5437)
+++ branches/Branch_1_4/src/main/org/jboss/messaging/core/impl/PagingChannelSupport.java 2008-11-27 05:29:02 UTC (rev 5438)
@@ -234,7 +234,7 @@
firstPagingOrder = nextPagingOrder = 0;
- clearAllScheduledDeliveries();
+ clearAllScheduledDeliveries(false);
}
}
Modified: branches/Branch_1_4/tests/src/org/jboss/test/messaging/jms/ScheduledDeliveryTest.java
===================================================================
--- branches/Branch_1_4/tests/src/org/jboss/test/messaging/jms/ScheduledDeliveryTest.java 2008-11-26 14:12:48 UTC (rev 5437)
+++ branches/Branch_1_4/tests/src/org/jboss/test/messaging/jms/ScheduledDeliveryTest.java 2008-11-27 05:29:02 UTC (rev 5438)
@@ -267,6 +267,48 @@
}
}
+ //https://jira.jboss.org/jira/browse/JBMESSAGING-1460
+ public void testRemoveAllReferences() throws Exception
+ {
+ Connection conn = null;
+
+ try
+ {
+ conn = cf.createConnection();
+
+ Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ MessageProducer prod = sess.createProducer(queue1);
+
+ // Send one scheduled
+
+ long now = System.currentTimeMillis();
+
+ TextMessage tm1 = sess.createTextMessage("testScheduled1");
+ tm1.setLongProperty(JBossMessage.JMS_JBOSS_SCHEDULED_DELIVERY_PROP_NAME, now + 5000);
+ prod.send(tm1);
+
+ assertRemainingMessages(1);
+
+ removeAllMessages(queue1.getQueueName(), true, 0);
+
+ //stop the queue
+ String on = "jboss.messaging.destination:service=Queue" + ",name=" + queue1.getQueueName();
+ ServerManagement.getServer(0).invoke(new ObjectName(on), "stop", null, null);
+
+ //start the queue again
+ ServerManagement.getServer(0).invoke(new ObjectName(on), "start", null, null);
+
+ assertRemainingMessages(-1);
+ }
+ finally
+ {
+ if (conn != null)
+ {
+ conn.close();
+ }
+ }
+ }
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
More information about the jboss-cvs-commits
mailing list