mirror of https://github.com/apache/activemq.git
not a problem to try and create a destination more than once
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@515466 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
05de2b1f47
commit
d00ce72595
|
@ -97,33 +97,25 @@ abstract public class AbstractRegion implements Region {
|
||||||
destinations.clear();
|
destinations.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Destination addDestination(ConnectionContext context, ActiveMQDestination destination) throws Exception {
|
public Destination addDestination(ConnectionContext context,ActiveMQDestination destination) throws Exception{
|
||||||
log.debug("Adding destination: "+destination);
|
log.debug("Adding destination: "+destination);
|
||||||
|
synchronized(destinationsMutex){
|
||||||
synchronized (destinationsMutex) {
|
Destination dest=(Destination)destinations.get(destination);
|
||||||
Destination dest = (Destination) destinations.get(destination);
|
if(dest==null){
|
||||||
if (dest != null) {
|
dest=createDestination(context,destination);
|
||||||
log.warn("Attempt to add destination which is already created: " + destination);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
dest = createDestination(context, destination);
|
|
||||||
|
|
||||||
// intercept if there is a valid interceptor defined
|
// intercept if there is a valid interceptor defined
|
||||||
DestinationInterceptor destinationInterceptor = broker.getDestinationInterceptor();
|
DestinationInterceptor destinationInterceptor=broker.getDestinationInterceptor();
|
||||||
if (destinationInterceptor != null) {
|
if(destinationInterceptor!=null){
|
||||||
dest = destinationInterceptor.intercept(dest);
|
dest=destinationInterceptor.intercept(dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
dest.start();
|
dest.start();
|
||||||
|
destinations.put(destination,dest);
|
||||||
destinations.put(destination, dest);
|
destinationMap.put(destination,dest);
|
||||||
destinationMap.put(destination, dest);
|
|
||||||
|
|
||||||
// Add all consumers that are interested in the destination.
|
// Add all consumers that are interested in the destination.
|
||||||
for (Iterator iter = subscriptions.values().iterator(); iter.hasNext();) {
|
for(Iterator iter=subscriptions.values().iterator();iter.hasNext();){
|
||||||
Subscription sub = (Subscription) iter.next();
|
Subscription sub=(Subscription)iter.next();
|
||||||
if (sub.matches(destination)) {
|
if(sub.matches(destination)){
|
||||||
dest.addSubscription(context, sub);
|
dest.addSubscription(context,sub);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue