List of usage examples for org.apache.commons.collections.map MultiValueMap totalSize
public int totalSize()
From source file:com.nextep.datadesigner.impl.Observable.java
/** * Dumps the listeners registration difference between the specified snapshot and the current * snaphsot./* w ww. ja v a2 s. co m*/ * * @param snapshot old snapshot */ @SuppressWarnings("unchecked") public static void dumpSnapshotDelta(Object snapshot) { MultiValueMap initial = (MultiValueMap) snapshot; MultiValueMap current = (MultiValueMap) getSnapshot(); log.debug(">>>> DUMPING OBSERVABLE SNAPSHOT DIFFERENCE <<<<"); log.debug("Initial listeners: " + initial.totalSize()); log.debug("Current listeners: " + current.totalSize()); boolean showWarning = (initial.totalSize() != current.totalSize()); // Removing all identical listener registrations for (Object o : initial.keySet()) { Collection<IEventListener> listeners = (Collection<IEventListener>) initial.get(o); for (IEventListener l : listeners) { current.remove(o, l); } } // Our current map now only contains differences, we dump it log.debug("Residual listeners: " + current.totalSize()); for (Object o : current.keySet()) { String name = NameHelper.getQualifiedName(o); log.debug("- Observable <" + name + "> has:"); Collection<IEventListener> listeners = (Collection<IEventListener>) current.get(o); for (IEventListener l : listeners) { log.debug(" * Listener <" + l.toString() + "> of class [" + l.getClass().getName() + "]"); } } if (showWarning) { log.warn("Some listeners have not been released"); } log.debug(">>>> DUMPING ENDS <<<<"); }