// iterate over copy of the collection as there is a chance a caller would want to
// (un)register another listener during event processing
Iterator it = new ArrayList(invocations).iterator();
while (it.hasNext()) {
Invocation invocation = (Invocation) it.next();
// fire invocation, detect if anything went wrong (e.g. GC'ed invocation
// targets)
if (!dispatch.fire(invocation)) {
invocations.remove(invocation);