/** Obtains a set of all listeners for given type. * @param type type of events to test * @return unmutable set of all listeners (Node) for a type */ public synchronized java.util.Set listenersFor (ConnectionCookie.Type type) { LinkedList list; if (type.isPersistent ()) { list = (LinkedList)entry.getFile ().getAttribute (EA_LISTENERS); } else { list = listeners; } if (list == null) return Collections.EMPTY_SET; Iterator it = list.iterator (); HashSet set = new HashSet (7); while (it.hasNext ()) { Pair pair = (Pair)it.next (); if (type.overlaps(pair.getType ())) { try { set.add (pair.getNode ()); } catch (IOException e) { // ignore the exception } } } return set; }
ConnectionCookie.Type type = ev.getType (); boolean persistent = type.isPersistent (); if (persistent) { list = (LinkedList)entry.getFile ().getAttribute (EA_LISTENERS);
boolean persistent = type.isPersistent (); LinkedList list;
boolean persistent = type.isPersistent (); LinkedList list;