[jboss-cvs] JBoss Messaging SVN: r7900 - in branches/Branch_1_4/src/main/org/jboss: messaging/core/impl/postoffice and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Nov 16 06:13:21 EST 2009
Author: gaohoward
Date: 2009-11-16 06:13:20 -0500 (Mon, 16 Nov 2009)
New Revision: 7900
Modified:
branches/Branch_1_4/src/main/org/jboss/jms/server/destination/TopicService.java
branches/Branch_1_4/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java
Log:
JBMESSAGING-1760
Modified: branches/Branch_1_4/src/main/org/jboss/jms/server/destination/TopicService.java
===================================================================
--- branches/Branch_1_4/src/main/org/jboss/jms/server/destination/TopicService.java 2009-11-11 04:03:41 UTC (rev 7899)
+++ branches/Branch_1_4/src/main/org/jboss/jms/server/destination/TopicService.java 2009-11-16 11:13:20 UTC (rev 7900)
@@ -94,50 +94,54 @@
//instead we should never create queues inside the postoffice - only do it at deploy time
//if the queue is redeployed as clustered from a non-clustered state, the queue is already activated.
- if (!queue.isActive())
+ synchronized (queue)
{
- queue.setPagingParams(destination.getFullSize(),
- destination.getPageSize(),
- destination.getDownCacheSize());
+ if (!queue.isActive())
+ {
- queue.load();
+ queue.setPagingParams(destination.getFullSize(),
+ destination.getPageSize(),
+ destination.getDownCacheSize());
- queue.activate();
+ queue.load();
- // Must be done after load
- queue.setMaxSize(destination.getMaxSize());
+ queue.activate();
- // Create a counter
- String counterName = SUBSCRIPTION_MESSAGECOUNTER_PREFIX + queue.getName();
+ // Must be done after load
+ queue.setMaxSize(destination.getMaxSize());
- String subName = MessageQueueNameHelper.createHelper(queue.getName()).getSubName();
+ // Create a counter
+ String counterName = SUBSCRIPTION_MESSAGECOUNTER_PREFIX + queue.getName();
- int dayLimitToUse = destination.getMessageCounterHistoryDayLimit();
- if (dayLimitToUse == -1)
- {
- // Use override on server peer
- dayLimitToUse = serverPeer.getDefaultMessageCounterHistoryDayLimit();
- }
+ String subName = MessageQueueNameHelper.createHelper(queue.getName()).getSubName();
- MessageCounter counter = new MessageCounter(counterName, subName, queue, true, true, dayLimitToUse);
+ int dayLimitToUse = destination.getMessageCounterHistoryDayLimit();
+ if (dayLimitToUse == -1)
+ {
+ // Use override on server peer
+ dayLimitToUse = serverPeer.getDefaultMessageCounterHistoryDayLimit();
+ }
- serverPeer.getMessageCounterManager().registerMessageCounter(counterName, counter);
+ MessageCounter counter = new MessageCounter(counterName, subName, queue, true, true, dayLimitToUse);
- // Now we need to trigger a delivery - this is because message suckers might have
- // been create *before* the queue was deployed - this is because message suckers can be
- // created when the clusterpullconnectionfactory deploy is detected which then causes
- // the clusterconnectionmanager to inspect the bindings for queues to create suckers
- // to - but these bindings will exist before the queue or topic is deployed and before
- // it has had its messages loaded
- // Therefore we need to trigger a delivery now so remote suckers get messages
- // See http://jira.jboss.org/jira/browse/JBMESSAGING-1136
- // For JBM we should remove the distinction between activation and deployment to
- // remove these annoyances and edge cases.
- // The post office should load(=deploy) all bindings on startup including loading their
- // state before adding the binding - there should be no separate deployment stage
- // If the queue can be undeployed there should be a separate flag for this on the
- // binding
- queue.deliver();
+ serverPeer.getMessageCounterManager().registerMessageCounter(counterName, counter);
+
+ // Now we need to trigger a delivery - this is because message suckers might have
+ // been create *before* the queue was deployed - this is because message suckers can be
+ // created when the clusterpullconnectionfactory deploy is detected which then causes
+ // the clusterconnectionmanager to inspect the bindings for queues to create suckers
+ // to - but these bindings will exist before the queue or topic is deployed and before
+ // it has had its messages loaded
+ // Therefore we need to trigger a delivery now so remote suckers get messages
+ // See http://jira.jboss.org/jira/browse/JBMESSAGING-1136
+ // For JBM we should remove the distinction between activation and deployment to
+ // remove these annoyances and edge cases.
+ // The post office should load(=deploy) all bindings on startup including loading their
+ // state before adding the binding - there should be no separate deployment stage
+ // If the queue can be undeployed there should be a separate flag for this on the
+ // binding
+ queue.deliver();
+ }
}
}
Modified: branches/Branch_1_4/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java
===================================================================
--- branches/Branch_1_4/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java 2009-11-11 04:03:41 UTC (rev 7899)
+++ branches/Branch_1_4/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java 2009-11-16 11:13:20 UTC (rev 7900)
@@ -408,7 +408,7 @@
}
public synchronized void stop() throws Exception
- {
+ {
if (!started)
{
log.warn(this + " is not started");
@@ -1154,7 +1154,6 @@
{
log.debug(this + " adding binding from node " + mapping.getNodeId() + ", queue " + mapping.getQueueName() +
" with condition " + mapping.getConditionText() + " all nodes " + allNodes);
-
//Sanity
if (!knowAboutNodeId(mapping.getNodeId()))
@@ -1196,16 +1195,23 @@
mapping.getRecoverDeliveriesTimeout());
//We must cast back asynchronously to avoid deadlock
- boolean added = internalAddBinding(new Binding(condition, queue2, true), false, false);
-
- if (added)
- {
- if (trace) { log.trace(this + " inserted in binding locally"); }
-
- queue2.load();
-
- queue2.activate();
- }
+ //we need put adding binding and queue's loading and activations into one sync block
+ //https://jira.jboss.org/jira/browse/JBMESSAGING-1760
+ synchronized (queue2)
+ {
+ boolean added = internalAddBinding(new Binding(condition, queue2, true), false, false);
+
+ if (added)
+ {
+ if (trace)
+ {
+ log.trace(this + " inserted in binding locally");
+ }
+ queue2.load();
+
+ queue2.activate();
+ }
+ }
}
synchronized (waitForBindUnbindLock)
More information about the jboss-cvs-commits
mailing list