This commit is contained in:
Dejan Bosanac 2014-01-28 16:08:53 +01:00
parent 55da9bc821
commit 713250f5f0
2 changed files with 19 additions and 11 deletions

View File

@ -583,6 +583,8 @@ public abstract class AbstractRegion implements Region {
}
public void reapplyInterceptor() {
destinationsLock.writeLock().lock();
try {
DestinationInterceptor destinationInterceptor = broker.getDestinationInterceptor();
Map<ActiveMQDestination, Destination> map = getDestinationMap();
for (ActiveMQDestination key : map.keySet()) {
@ -590,9 +592,14 @@ public abstract class AbstractRegion implements Region {
if (destination instanceof CompositeDestinationFilter) {
destination = ((CompositeDestinationFilter) destination).next;
}
if (destinationInterceptor != null) {
destination = destinationInterceptor.intercept(destination);
}
getDestinationMap().put(key, destination);
destinations.put(key, destination);
}
} finally {
destinationsLock.writeLock().unlock();
}
}
}

View File

@ -552,6 +552,7 @@ public class RuntimeConfigurationBroker extends BrokerFilter {
public void run() {
boolean updatedExistingInterceptor = false;
RegionBroker regionBroker = (RegionBroker) getBrokerService().getRegionBroker();
for (DestinationInterceptor destinationInterceptor : getBrokerService().getDestinationInterceptors()) {
if (destinationInterceptor instanceof VirtualDestinationInterceptor) {
@ -577,11 +578,11 @@ public class RuntimeConfigurationBroker extends BrokerFilter {
DestinationInterceptor[] destinationInterceptors = interceptorsList.toArray(new DestinationInterceptor[]{});
getBrokerService().setDestinationInterceptors(destinationInterceptors);
RegionBroker regionBroker = (RegionBroker) getBrokerService().getRegionBroker();
((CompositeDestinationInterceptor) regionBroker.getDestinationInterceptor()).setInterceptors(destinationInterceptors);
info("applied new: " + interceptorsList);
regionBroker.reapplyInterceptor();
}
regionBroker.reapplyInterceptor();
}
});
} else if (o instanceof DtoPolicyEntry) {