Author: rajdavies
Date: Tue Dec 2 15:59:11 2008
New Revision: 722683
URL: http://svn.apache.org/viewvc?rev=722683&view=rev
Log:
Fix for https://issues.apache.org/activemq/browse/AMQ-2015
Modified:
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/AbstractRegion.java
Modified:
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/AbstractRegion.java
URL:
http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/AbstractRegion.java?rev=722683&r1=722682&r2=722683&view=diff
==============================================================================
---
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/AbstractRegion.java
(original)
+++
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/AbstractRegion.java
Tue Dec 2 15:59:11 2008
@@ -382,30 +382,32 @@
}
protected Destination lookup(ConnectionContext context,
ActiveMQDestination destination) throws Exception {
+ Destination dest = null;
synchronized (destinationsMutex) {
- Destination dest = destinations.get(destination);
- if (dest == null) {
- if (autoCreateDestinations) {
- // Try to auto create the destination... re-invoke broker
- // from the
- // top so that the proper security checks are performed.
- try {
-
- context.getBroker().addDestination(context,
destination);
- dest = addDestination(context, destination);
- } catch (DestinationAlreadyExistsException e) {
- // if the destination already exists then lets ignore
- // this error
- }
- // We should now have the dest created.
- dest = destinations.get(destination);
+ dest = destinations.get(destination);
+ }
+ if (dest == null) {
+ if (autoCreateDestinations) {
+ // Try to auto create the destination... re-invoke broker
+ // from the
+ // top so that the proper security checks are performed.
+ try {
+ context.getBroker().addDestination(context, destination);
+ dest = addDestination(context, destination);
+ } catch (DestinationAlreadyExistsException e) {
+ // if the destination already exists then lets ignore
+ // this error
}
- if (dest == null) {
- throw new JMSException("The destination " + destination +
" does not exist.");
+ // We should now have the dest created.
+ synchronized (destinationsMutex) {
+ dest = destinations.get(destination);
}
}
- return dest;
+ if (dest == null) {
+ throw new JMSException("The destination " + destination + "
does not exist.");
+ }
}
+ return dest;
}
public void processDispatchNotification(MessageDispatchNotification
messageDispatchNotification) throws Exception {