Map<ConfigChangeListener, List<String>> registryClone = null;
synchronized(registry) {
registryClone = new HashMap<ConfigChangeListener, List<String>>(registry);
}
ConfigRuntimeException troubles = null;
for (Map.Entry<ConfigChangeListener, List<String>> entry : registryClone.entrySet()) {
for (String pattern : entry.getValue()) {
if (match(pattern, event)) {
if (log.isLoggable(Level.FINE)) {
log.log(Level.FINE, "processEvent match :) for " +
event.getClass().getName() + " with " + pattern +
" and " + event.getNode());
}
try {
if (event instanceof ConfigAddEvent) {
entry.getKey().handleConfigEvent((ConfigAddEvent) event);
}
if (event instanceof ConfigUpdateEvent) {
entry.getKey().handleConfigEvent((ConfigUpdateEvent) event);
}
if (event instanceof ConfigRemoveEvent) {
entry.getKey().handleConfigEvent((ConfigRemoveEvent) event);
}
} catch(Exception e) {
//This catch may be to wide!
//Each listener gets the opertunaty to handle the event.
//It lokalizes the effect of troublesome listeners.
if (troubles==null) {
troubles = new ConfigRuntimeException("Muticasting event ["+
event.getNode()+"] failed for atleast one listener");
}
troubles.addCause(e);
}
} else {
if (log.isLoggable(Level.FINEST)) {
log.log(Level.FINEST, "processEvent no match :( for " +
event.getClass().getName() + " with " + pattern +