equal
deleted
inserted
replaced
153 |
153 |
154 /** |
154 /** |
155 * All known unremoved children of this node. (This "cache" is consulted |
155 * All known unremoved children of this node. (This "cache" is consulted |
156 * prior to calling childSpi() or getChild(). |
156 * prior to calling childSpi() or getChild(). |
157 */ |
157 */ |
158 private Map<String, AbstractPreferences> kidCache |
158 private Map<String, AbstractPreferences> kidCache = new HashMap<>(); |
159 = new HashMap<String, AbstractPreferences>(); |
|
160 |
159 |
161 /** |
160 /** |
162 * This field is used to keep track of whether or not this node has |
161 * This field is used to keep track of whether or not this node has |
163 * been removed. Once it's set to true, it will never be reset to false. |
162 * been removed. Once it's set to true, it will never be reset to false. |
164 */ |
163 */ |
711 public String[] childrenNames() throws BackingStoreException { |
710 public String[] childrenNames() throws BackingStoreException { |
712 synchronized(lock) { |
711 synchronized(lock) { |
713 if (removed) |
712 if (removed) |
714 throw new IllegalStateException("Node has been removed."); |
713 throw new IllegalStateException("Node has been removed."); |
715 |
714 |
716 Set<String> s = new TreeSet<String>(kidCache.keySet()); |
715 Set<String> s = new TreeSet<>(kidCache.keySet()); |
717 for (String kid : childrenNamesSpi()) |
716 for (String kid : childrenNamesSpi()) |
718 s.add(kid); |
717 s.add(kid); |
719 return s.toArray(EMPTY_STRING_ARRAY); |
718 return s.toArray(EMPTY_STRING_ARRAY); |
720 } |
719 } |
721 } |
720 } |
1440 * it is placed on this queue and the queue is notified. A background |
1439 * it is placed on this queue and the queue is notified. A background |
1441 * thread waits on this queue and delivers the events. This decouples |
1440 * thread waits on this queue and delivers the events. This decouples |
1442 * event delivery from preference activity, greatly simplifying |
1441 * event delivery from preference activity, greatly simplifying |
1443 * locking and reducing opportunity for deadlock. |
1442 * locking and reducing opportunity for deadlock. |
1444 */ |
1443 */ |
1445 private static final List<EventObject> eventQueue |
1444 private static final List<EventObject> eventQueue = new LinkedList<>(); |
1446 = new LinkedList<EventObject>(); |
|
1447 |
1445 |
1448 /** |
1446 /** |
1449 * These two classes are used to distinguish NodeChangeEvents on |
1447 * These two classes are used to distinguish NodeChangeEvents on |
1450 * eventQueue so the event dispatch thread knows whether to call |
1448 * eventQueue so the event dispatch thread knows whether to call |
1451 * childAdded or childRemoved. |
1449 * childAdded or childRemoved. |