for (String key : keys)
{
// Peer.column names are the fields
if (validFields != null && validFields.containsKey(key))
{
FastArrayList listeners = listenersMap.get(key);
if (listeners == null)
{
listeners = createSubsetList(key);
}
boolean isListenerNew = true;
Iterator<?> j = listeners.iterator();
while (j.hasNext())
{
Object listener2 =
((WeakReference<?>) j.next()).get();
// if (listener2 == null)
// {
// // do a little cleanup while checking for dupes
// // not thread-safe, not likely to be many nulls
// // but should revisit
// //j.remove();
// }
// else
if (listener2 == listener)
{
isListenerNew = false;
break;
}
}
if (isListenerNew)
{
listeners.add(new WeakReference<CacheListener<? extends Persistent>>(listener));
}
}
}
}