|
1 |
| |
|
2 |
| |
|
3 |
| |
|
4 |
| |
|
5 |
| |
|
6 |
| |
|
7 |
| |
|
8 |
| |
|
9 |
| |
|
10 |
| |
|
11 |
| |
|
12 |
| |
|
13 |
| |
|
14 |
| |
|
15 |
| |
|
16 |
| |
|
17 |
| |
|
18 |
| |
|
19 |
| |
|
20 |
| |
|
21 |
| |
|
22 |
| |
|
23 |
| |
|
24 |
| |
|
25 |
| |
|
26 |
| |
|
27 |
| |
|
28 |
| |
|
29 |
| |
|
30 |
| |
|
31 |
| |
|
32 |
| |
|
33 |
| |
|
34 |
| |
|
35 |
| package com.opensymphony.oscache.base.algorithm; |
|
36 |
| |
|
37 |
| |
|
38 |
| |
|
39 |
| import com.opensymphony.oscache.base.CacheEntry; |
|
40 |
| import com.opensymphony.oscache.base.persistence.CachePersistenceException; |
|
41 |
| import com.opensymphony.oscache.base.persistence.PersistenceListener; |
|
42 |
| |
|
43 |
| import org.apache.commons.logging.Log; |
|
44 |
| import org.apache.commons.logging.LogFactory; |
|
45 |
| |
|
46 |
| import java.io.IOException; |
|
47 |
| import java.io.Serializable; |
|
48 |
| |
|
49 |
| import java.util.*; |
|
50 |
| |
|
51 |
| |
|
52 |
| |
|
53 |
| |
|
54 |
| |
|
55 |
| |
|
56 |
| |
|
57 |
| |
|
58 |
| |
|
59 |
| |
|
60 |
| |
|
61 |
| |
|
62 |
| |
|
63 |
| |
|
64 |
| |
|
65 |
| |
|
66 |
| |
|
67 |
| |
|
68 |
| |
|
69 |
| |
|
70 |
| |
|
71 |
| |
|
72 |
| |
|
73 |
| |
|
74 |
| |
|
75 |
| |
|
76 |
| |
|
77 |
| |
|
78 |
| |
|
79 |
| |
|
80 |
| |
|
81 |
| |
|
82 |
| |
|
83 |
| |
|
84 |
| |
|
85 |
| |
|
86 |
| |
|
87 |
| |
|
88 |
| |
|
89 |
| |
|
90 |
| |
|
91 |
| |
|
92 |
| |
|
93 |
| |
|
94 |
| |
|
95 |
| |
|
96 |
| |
|
97 |
| |
|
98 |
| |
|
99 |
| |
|
100 |
| |
|
101 |
| |
|
102 |
| |
|
103 |
| |
|
104 |
| |
|
105 |
| |
|
106 |
| |
|
107 |
| |
|
108 |
| |
|
109 |
| |
|
110 |
| |
|
111 |
| |
|
112 |
| |
|
113 |
| |
|
114 |
| |
|
115 |
| |
|
116 |
| |
|
117 |
| |
|
118 |
| |
|
119 |
| |
|
120 |
| |
|
121 |
| |
|
122 |
| |
|
123 |
| |
|
124 |
| |
|
125 |
| |
|
126 |
| |
|
127 |
| |
|
128 |
| |
|
129 |
| |
|
130 |
| |
|
131 |
| |
|
132 |
| |
|
133 |
| |
|
134 |
| |
|
135 |
| |
|
136 |
| |
|
137 |
| |
|
138 |
| |
|
139 |
| |
|
140 |
| |
|
141 |
| |
|
142 |
| |
|
143 |
| |
|
144 |
| |
|
145 |
| |
|
146 |
| |
|
147 |
| |
|
148 |
| |
|
149 |
| |
|
150 |
| |
|
151 |
| |
|
152 |
| |
|
153 |
| public abstract class AbstractConcurrentReadCache extends AbstractMap implements Map, Cloneable, Serializable { |
|
154 |
| |
|
155 |
| |
|
156 |
| |
|
157 |
| |
|
158 |
| public static int DEFAULT_INITIAL_CAPACITY = 32; |
|
159 |
| |
|
160 |
| |
|
161 |
| |
|
162 |
| |
|
163 |
| |
|
164 |
| |
|
165 |
| |
|
166 |
| private static final int MINIMUM_CAPACITY = 4; |
|
167 |
| |
|
168 |
| |
|
169 |
| |
|
170 |
| |
|
171 |
| |
|
172 |
| |
|
173 |
| |
|
174 |
| private static final int MAXIMUM_CAPACITY = 1 << 30; |
|
175 |
| |
|
176 |
| |
|
177 |
| |
|
178 |
| |
|
179 |
| |
|
180 |
| public static final float DEFAULT_LOAD_FACTOR = 0.75f; |
|
181 |
| |
|
182 |
| |
|
183 |
| protected static final String NULL = "_nul!~"; |
|
184 |
| protected static Log log = LogFactory.getLog(AbstractConcurrentReadCache.class); |
|
185 |
| |
|
186 |
| |
|
187 |
| |
|
188 |
| |
|
189 |
| |
|
190 |
| |
|
191 |
| |
|
192 |
| |
|
193 |
| |
|
194 |
| |
|
195 |
| |
|
196 |
| |
|
197 |
| |
|
198 |
| |
|
199 |
| |
|
200 |
| |
|
201 |
| |
|
202 |
| |
|
203 |
| |
|
204 |
| |
|
205 |
| |
|
206 |
| |
|
207 |
| |
|
208 |
| |
|
209 |
| |
|
210 |
| |
|
211 |
| |
|
212 |
| |
|
213 |
| |
|
214 |
| |
|
215 |
| protected final Boolean barrierLock = new Boolean(true); |
|
216 |
| |
|
217 |
| |
|
218 |
| |
|
219 |
| |
|
220 |
| protected transient Object lastWrite; |
|
221 |
| |
|
222 |
| |
|
223 |
| |
|
224 |
| |
|
225 |
| protected transient Entry[] table; |
|
226 |
| |
|
227 |
| |
|
228 |
| |
|
229 |
| |
|
230 |
| protected transient int count; |
|
231 |
| |
|
232 |
| |
|
233 |
| |
|
234 |
| |
|
235 |
| protected PersistenceListener persistenceListener = null; |
|
236 |
| |
|
237 |
| |
|
238 |
| |
|
239 |
| |
|
240 |
| protected boolean memoryCaching = true; |
|
241 |
| |
|
242 |
| |
|
243 |
| |
|
244 |
| |
|
245 |
| protected boolean unlimitedDiskCache = false; |
|
246 |
| |
|
247 |
| |
|
248 |
| |
|
249 |
| |
|
250 |
| |
|
251 |
| |
|
252 |
| protected float loadFactor; |
|
253 |
| |
|
254 |
| |
|
255 |
| |
|
256 |
| |
|
257 |
| protected final int DEFAULT_MAX_ENTRIES = 100; |
|
258 |
| |
|
259 |
| |
|
260 |
| |
|
261 |
| |
|
262 |
| protected final int UNLIMITED = 2147483646; |
|
263 |
| protected transient Collection values = null; |
|
264 |
| |
|
265 |
| |
|
266 |
| |
|
267 |
| |
|
268 |
| |
|
269 |
| |
|
270 |
| |
|
271 |
| protected HashMap groups = new HashMap(); |
|
272 |
| protected transient Set entrySet = null; |
|
273 |
| |
|
274 |
| |
|
275 |
| protected transient Set keySet = null; |
|
276 |
| |
|
277 |
| |
|
278 |
| |
|
279 |
| |
|
280 |
| protected int maxEntries = DEFAULT_MAX_ENTRIES; |
|
281 |
| |
|
282 |
| |
|
283 |
| |
|
284 |
| |
|
285 |
| |
|
286 |
| |
|
287 |
| |
|
288 |
| protected int threshold; |
|
289 |
| |
|
290 |
| |
|
291 |
| |
|
292 |
| |
|
293 |
| private boolean overflowPersistence = false; |
|
294 |
| |
|
295 |
| |
|
296 |
| |
|
297 |
| |
|
298 |
| |
|
299 |
| |
|
300 |
| |
|
301 |
| |
|
302 |
| |
|
303 |
| |
|
304 |
| |
|
305 |
132
| public AbstractConcurrentReadCache(int initialCapacity, float loadFactor) {
|
|
306 |
132
| if (loadFactor <= 0) {
|
|
307 |
0
| throw new IllegalArgumentException("Illegal Load factor: " + loadFactor);
|
|
308 |
| } |
|
309 |
| |
|
310 |
132
| this.loadFactor = loadFactor;
|
|
311 |
| |
|
312 |
132
| int cap = p2capacity(initialCapacity);
|
|
313 |
132
| table = new Entry[cap];
|
|
314 |
132
| threshold = (int) (cap * loadFactor);
|
|
315 |
| } |
|
316 |
| |
|
317 |
| |
|
318 |
| |
|
319 |
| |
|
320 |
| |
|
321 |
| |
|
322 |
| |
|
323 |
| |
|
324 |
| |
|
325 |
| |
|
326 |
0
| public AbstractConcurrentReadCache(int initialCapacity) {
|
|
327 |
0
| this(initialCapacity, DEFAULT_LOAD_FACTOR);
|
|
328 |
| } |
|
329 |
| |
|
330 |
| |
|
331 |
| |
|
332 |
| |
|
333 |
132
| public AbstractConcurrentReadCache() {
|
|
334 |
132
| this(DEFAULT_INITIAL_CAPACITY, DEFAULT_LOAD_FACTOR);
|
|
335 |
| } |
|
336 |
| |
|
337 |
| |
|
338 |
| |
|
339 |
| |
|
340 |
| |
|
341 |
| |
|
342 |
0
| public AbstractConcurrentReadCache(Map t) {
|
|
343 |
0
| this(Math.max(2 * t.size(), 11), DEFAULT_LOAD_FACTOR);
|
|
344 |
0
| putAll(t);
|
|
345 |
| } |
|
346 |
| |
|
347 |
| |
|
348 |
| |
|
349 |
| |
|
350 |
| |
|
351 |
| |
|
352 |
0
| public synchronized boolean isEmpty() {
|
|
353 |
0
| return count == 0;
|
|
354 |
| } |
|
355 |
| |
|
356 |
| |
|
357 |
| |
|
358 |
| |
|
359 |
| |
|
360 |
| |
|
361 |
| |
|
362 |
| |
|
363 |
| |
|
364 |
36
| public Set getGroup(String groupName) {
|
|
365 |
36
| if (log.isDebugEnabled()) {
|
|
366 |
0
| log.debug("getGroup called (group=" + groupName + ")");
|
|
367 |
| } |
|
368 |
| |
|
369 |
36
| Set groupEntries = null;
|
|
370 |
| |
|
371 |
36
| if (memoryCaching && (groups != null)) {
|
|
372 |
27
| groupEntries = (Set) getGroupForReading(groupName);
|
|
373 |
| } |
|
374 |
| |
|
375 |
36
| if (groupEntries == null) {
|
|
376 |
| |
|
377 |
12
| groupEntries = persistRetrieveGroup(groupName);
|
|
378 |
| } |
|
379 |
| |
|
380 |
36
| return groupEntries;
|
|
381 |
| } |
|
382 |
| |
|
383 |
| |
|
384 |
| |
|
385 |
| |
|
386 |
80
| public void setMaxEntries(int newLimit) {
|
|
387 |
80
| if (newLimit > 0) {
|
|
388 |
64
| maxEntries = newLimit;
|
|
389 |
| |
|
390 |
64
| synchronized (this) {
|
|
391 |
| |
|
392 |
64
| while (size() > maxEntries) {
|
|
393 |
16
| remove(removeItem(), false);
|
|
394 |
| } |
|
395 |
| } |
|
396 |
| } else { |
|
397 |
| |
|
398 |
16
| throw new IllegalArgumentException("Cache maximum number of entries must be at least 1");
|
|
399 |
| } |
|
400 |
| } |
|
401 |
| |
|
402 |
| |
|
403 |
| |
|
404 |
| |
|
405 |
32
| public int getMaxEntries() {
|
|
406 |
32
| return maxEntries;
|
|
407 |
| } |
|
408 |
| |
|
409 |
| |
|
410 |
| |
|
411 |
| |
|
412 |
132
| public void setMemoryCaching(boolean memoryCaching) {
|
|
413 |
132
| this.memoryCaching = memoryCaching;
|
|
414 |
| } |
|
415 |
| |
|
416 |
| |
|
417 |
| |
|
418 |
| |
|
419 |
24
| public boolean isMemoryCaching() {
|
|
420 |
24
| return memoryCaching;
|
|
421 |
| } |
|
422 |
| |
|
423 |
| |
|
424 |
| |
|
425 |
| |
|
426 |
102
| public void setPersistenceListener(PersistenceListener listener) {
|
|
427 |
102
| this.persistenceListener = listener;
|
|
428 |
| } |
|
429 |
| |
|
430 |
| |
|
431 |
| |
|
432 |
| |
|
433 |
64
| public PersistenceListener getPersistenceListener() {
|
|
434 |
64
| return persistenceListener;
|
|
435 |
| } |
|
436 |
| |
|
437 |
| |
|
438 |
| |
|
439 |
| |
|
440 |
108
| public void setUnlimitedDiskCache(boolean unlimitedDiskCache) {
|
|
441 |
108
| this.unlimitedDiskCache = unlimitedDiskCache;
|
|
442 |
| } |
|
443 |
| |
|
444 |
| |
|
445 |
| |
|
446 |
| |
|
447 |
0
| public boolean isUnlimitedDiskCache() {
|
|
448 |
0
| return unlimitedDiskCache;
|
|
449 |
| } |
|
450 |
| |
|
451 |
| |
|
452 |
| |
|
453 |
| |
|
454 |
| |
|
455 |
| |
|
456 |
16
| public boolean isOverflowPersistence() {
|
|
457 |
16
| return this.overflowPersistence;
|
|
458 |
| } |
|
459 |
| |
|
460 |
| |
|
461 |
| |
|
462 |
| |
|
463 |
| |
|
464 |
| |
|
465 |
132
| public void setOverflowPersistence(boolean overflowPersistence) {
|
|
466 |
132
| this.overflowPersistence = overflowPersistence;
|
|
467 |
| } |
|
468 |
| |
|
469 |
| |
|
470 |
| |
|
471 |
| |
|
472 |
0
| public synchronized int capacity() {
|
|
473 |
0
| return table.length;
|
|
474 |
| } |
|
475 |
| |
|
476 |
| |
|
477 |
| |
|
478 |
| |
|
479 |
204
| public synchronized void clear() {
|
|
480 |
204
| Entry[] tab = table;
|
|
481 |
| |
|
482 |
204
| for (int i = 0; i < tab.length; ++i) {
|
|
483 |
| |
|
484 |
6528
| for (Entry e = tab[i]; e != null; e = e.next) {
|
|
485 |
204
| e.value = null;
|
|
486 |
| |
|
487 |
| |
|
488 |
204
| itemRemoved(e.key);
|
|
489 |
| |
|
490 |
| |
|
491 |
| } |
|
492 |
| |
|
493 |
6528
| tab[i] = null;
|
|
494 |
| } |
|
495 |
| |
|
496 |
| |
|
497 |
204
| persistClear();
|
|
498 |
| |
|
499 |
204
| count = 0;
|
|
500 |
204
| recordModification(tab);
|
|
501 |
| } |
|
502 |
| |
|
503 |
| |
|
504 |
| |
|
505 |
| |
|
506 |
| |
|
507 |
| |
|
508 |
| |
|
509 |
| |
|
510 |
0
| public synchronized Object clone() {
|
|
511 |
0
| try {
|
|
512 |
0
| AbstractConcurrentReadCache t = (AbstractConcurrentReadCache) super.clone();
|
|
513 |
0
| t.keySet = null;
|
|
514 |
0
| t.entrySet = null;
|
|
515 |
0
| t.values = null;
|
|
516 |
| |
|
517 |
0
| Entry[] tab = table;
|
|
518 |
0
| t.table = new Entry[tab.length];
|
|
519 |
| |
|
520 |
0
| Entry[] ttab = t.table;
|
|
521 |
| |
|
522 |
0
| for (int i = 0; i < tab.length; ++i) {
|
|
523 |
0
| Entry first = tab[i];
|
|
524 |
| |
|
525 |
0
| if (first != null) {
|
|
526 |
0
| ttab[i] = (Entry) (first.clone());
|
|
527 |
| } |
|
528 |
| } |
|
529 |
| |
|
530 |
0
| return t;
|
|
531 |
| } catch (CloneNotSupportedException e) { |
|
532 |
| |
|
533 |
0
| throw new InternalError();
|
|
534 |
| } |
|
535 |
| } |
|
536 |
| |
|
537 |
| |
|
538 |
| |
|
539 |
| |
|
540 |
| |
|
541 |
| |
|
542 |
| |
|
543 |
| |
|
544 |
| |
|
545 |
| |
|
546 |
| |
|
547 |
| |
|
548 |
| |
|
549 |
| |
|
550 |
| |
|
551 |
| |
|
552 |
| |
|
553 |
| |
|
554 |
| |
|
555 |
0
| public boolean contains(Object value) {
|
|
556 |
0
| return containsValue(value);
|
|
557 |
| } |
|
558 |
| |
|
559 |
| |
|
560 |
| |
|
561 |
| |
|
562 |
| |
|
563 |
| |
|
564 |
| |
|
565 |
| |
|
566 |
| |
|
567 |
| |
|
568 |
| |
|
569 |
| |
|
570 |
24
| public boolean containsKey(Object key) {
|
|
571 |
24
| return get(key) != null;
|
|
572 |
| |
|
573 |
| |
|
574 |
| |
|
575 |
| |
|
576 |
| |
|
577 |
| |
|
578 |
| } |
|
579 |
| |
|
580 |
| |
|
581 |
| |
|
582 |
| |
|
583 |
| |
|
584 |
| |
|
585 |
| |
|
586 |
| |
|
587 |
| |
|
588 |
| |
|
589 |
| |
|
590 |
| |
|
591 |
0
| public boolean containsValue(Object value) {
|
|
592 |
0
| if (value == null) {
|
|
593 |
0
| throw new NullPointerException();
|
|
594 |
| } |
|
595 |
| |
|
596 |
0
| Entry[] tab = getTableForReading();
|
|
597 |
| |
|
598 |
0
| for (int i = 0; i < tab.length; ++i) {
|
|
599 |
0
| for (Entry e = tab[i]; e != null; e = e.next) {
|
|
600 |
0
| Object v = e.value;
|
|
601 |
| |
|
602 |
0
| if ((v != null) && value.equals(v)) {
|
|
603 |
0
| return true;
|
|
604 |
| } |
|
605 |
| } |
|
606 |
| } |
|
607 |
| |
|
608 |
0
| return false;
|
|
609 |
| } |
|
610 |
| |
|
611 |
| |
|
612 |
| |
|
613 |
| |
|
614 |
| |
|
615 |
| |
|
616 |
| |
|
617 |
| |
|
618 |
| |
|
619 |
| |
|
620 |
| |
|
621 |
| |
|
622 |
0
| public Enumeration elements() {
|
|
623 |
0
| return new ValueIterator();
|
|
624 |
| } |
|
625 |
| |
|
626 |
| |
|
627 |
| |
|
628 |
| |
|
629 |
| |
|
630 |
| |
|
631 |
| |
|
632 |
| |
|
633 |
| |
|
634 |
| |
|
635 |
| |
|
636 |
| |
|
637 |
| |
|
638 |
24
| public Set entrySet() {
|
|
639 |
24
| Set es = entrySet;
|
|
640 |
| |
|
641 |
24
| if (es != null) {
|
|
642 |
0
| return es;
|
|
643 |
| } else { |
|
644 |
24
| return entrySet = new AbstractSet() {
|
|
645 |
24
| public Iterator iterator() {
|
|
646 |
24
| return new HashIterator();
|
|
647 |
| } |
|
648 |
| |
|
649 |
0
| public boolean contains(Object o) {
|
|
650 |
0
| if (!(o instanceof Map.Entry)) {
|
|
651 |
0
| return false;
|
|
652 |
| } |
|
653 |
| |
|
654 |
0
| Map.Entry entry = (Map.Entry) o;
|
|
655 |
0
| Object key = entry.getKey();
|
|
656 |
0
| Object v = AbstractConcurrentReadCache.this.get(key);
|
|
657 |
| |
|
658 |
0
| return (v != null) && v.equals(entry.getValue());
|
|
659 |
| } |
|
660 |
| |
|
661 |
0
| public boolean remove(Object o) {
|
|
662 |
0
| if (!(o instanceof Map.Entry)) {
|
|
663 |
0
| return false;
|
|
664 |
| } |
|
665 |
| |
|
666 |
0
| return AbstractConcurrentReadCache.this.findAndRemoveEntry((Map.Entry) o);
|
|
667 |
| } |
|
668 |
| |
|
669 |
0
| public int size() {
|
|
670 |
0
| return AbstractConcurrentReadCache.this.size();
|
|
671 |
| } |
|
672 |
| |
|
673 |
0
| public void clear() {
|
|
674 |
0
| AbstractConcurrentReadCache.this.clear();
|
|
675 |
| } |
|
676 |
| }; |
|
677 |
| } |
|
678 |
| } |
|
679 |
| |
|
680 |
| |
|
681 |
| |
|
682 |
| |
|
683 |
| |
|
684 |
| |
|
685 |
| |
|
686 |
| |
|
687 |
| |
|
688 |
| |
|
689 |
| |
|
690 |
| |
|
691 |
2024875
| public Object get(Object key) {
|
|
692 |
2024875
| if (log.isDebugEnabled()) {
|
|
693 |
0
| log.debug("get called (key=" + key + ")");
|
|
694 |
| } |
|
695 |
| |
|
696 |
| |
|
697 |
2024875
| int hash = hash(key);
|
|
698 |
| |
|
699 |
| |
|
700 |
| |
|
701 |
| |
|
702 |
| |
|
703 |
| |
|
704 |
| |
|
705 |
| |
|
706 |
| |
|
707 |
2024332
| Entry[] tab = table;
|
|
708 |
2024851
| int index = hash & (tab.length - 1);
|
|
709 |
2024851
| Entry first = tab[index];
|
|
710 |
2024851
| Entry e = first;
|
|
711 |
| |
|
712 |
2024851
| for (;;) {
|
|
713 |
2028209
| if (e == null) {
|
|
714 |
| |
|
715 |
| |
|
716 |
16309
| tab = getTableForReading();
|
|
717 |
| |
|
718 |
16309
| if (first == tab[index]) {
|
|
719 |
| |
|
720 |
| |
|
721 |
| |
|
722 |
| |
|
723 |
| |
|
724 |
| |
|
725 |
16309
| Object value = persistRetrieve(key);
|
|
726 |
| |
|
727 |
16309
| if (value != null) {
|
|
728 |
| |
|
729 |
24
| put(key, value, false);
|
|
730 |
| } |
|
731 |
| |
|
732 |
16309
| return value;
|
|
733 |
| |
|
734 |
| |
|
735 |
| } else { |
|
736 |
| |
|
737 |
0
| e = first = tab[index = hash & (tab.length - 1)];
|
|
738 |
| } |
|
739 |
| } |
|
740 |
| |
|
741 |
2011900
| else if ((key == e.key) || ((e.hash == hash) && key.equals(e.key))) {
|
|
742 |
2008542
| Object value = e.value;
|
|
743 |
| |
|
744 |
2008542
| if (value != null) {
|
|
745 |
| |
|
746 |
| |
|
747 |
| |
|
748 |
| |
|
749 |
2008542
| if (NULL.equals(value)) {
|
|
750 |
| |
|
751 |
120
| value = persistRetrieve(e.key);
|
|
752 |
| |
|
753 |
120
| if (value != null) {
|
|
754 |
120
| itemRetrieved(key);
|
|
755 |
| } |
|
756 |
| |
|
757 |
120
| return value;
|
|
758 |
| } else { |
|
759 |
2008422
| itemRetrieved(key);
|
|
760 |
| |
|
761 |
2008422
| return value;
|
|
762 |
| } |
|
763 |
| |
|
764 |
| |
|
765 |
| } |
|
766 |
| |
|
767 |
| |
|
768 |
| |
|
769 |
| |
|
770 |
| |
|
771 |
0
| synchronized (this) {
|
|
772 |
0
| tab = table;
|
|
773 |
| } |
|
774 |
| |
|
775 |
0
| e = first = tab[index = hash & (tab.length - 1)];
|
|
776 |
| } else { |
|
777 |
3358
| e = e.next;
|
|
778 |
| } |
|
779 |
| } |
|
780 |
| } |
|
781 |
| |
|
782 |
| |
|
783 |
| |
|
784 |
| |
|
785 |
| |
|
786 |
| |
|
787 |
| |
|
788 |
| |
|
789 |
| |
|
790 |
| |
|
791 |
| |
|
792 |
| |
|
793 |
24
| public Set keySet() {
|
|
794 |
24
| Set ks = keySet;
|
|
795 |
| |
|
796 |
24
| if (ks != null) {
|
|
797 |
8
| return ks;
|
|
798 |
| } else { |
|
799 |
16
| return keySet = new AbstractSet() {
|
|
800 |
24
| public Iterator iterator() {
|
|
801 |
24
| return new KeyIterator();
|
|
802 |
| } |
|
803 |
| |
|
804 |
0
| public int size() {
|
|
805 |
0
| return AbstractConcurrentReadCache.this.size();
|
|
806 |
| } |
|
807 |
| |
|
808 |
0
| public boolean contains(Object o) {
|
|
809 |
0
| return AbstractConcurrentReadCache.this.containsKey(o);
|
|
810 |
| } |
|
811 |
| |
|
812 |
0
| public boolean remove(Object o) {
|
|
813 |
0
| return AbstractConcurrentReadCache.this.remove(o) != null;
|
|
814 |
| } |
|
815 |
| |
|
816 |
0
| public void clear() {
|
|
817 |
0
| AbstractConcurrentReadCache.this.clear();
|
|
818 |
| } |
|
819 |
| }; |
|
820 |
| } |
|
821 |
| } |
|
822 |
| |
|
823 |
| |
|
824 |
| |
|
825 |
| |
|
826 |
| |
|
827 |
| |
|
828 |
| |
|
829 |
| |
|
830 |
| |
|
831 |
| |
|
832 |
0
| public Enumeration keys() {
|
|
833 |
0
| return new KeyIterator();
|
|
834 |
| } |
|
835 |
| |
|
836 |
| |
|
837 |
| |
|
838 |
| |
|
839 |
0
| public float loadFactor() {
|
|
840 |
0
| return loadFactor;
|
|
841 |
| } |
|
842 |
| |
|
843 |
| |
|
844 |
| |
|
845 |
| |
|
846 |
| |
|
847 |
| |
|
848 |
| |
|
849 |
| |
|
850 |
| |
|
851 |
| |
|
852 |
| |
|
853 |
| |
|
854 |
| |
|
855 |
| |
|
856 |
| |
|
857 |
| |
|
858 |
| |
|
859 |
| |
|
860 |
| |
|
861 |
12622
| public Object put(Object key, Object value) {
|
|
862 |
| |
|
863 |
12622
| return put(key, value, true);
|
|
864 |
| } |
|
865 |
| |
|
866 |
| |
|
867 |
| |
|
868 |
| |
|
869 |
| |
|
870 |
| |
|
871 |
| |
|
872 |
| |
|
873 |
| |
|
874 |
0
| public synchronized void putAll(Map t) {
|
|
875 |
0
| for (Iterator it = t.entrySet().iterator(); it.hasNext();) {
|
|
876 |
0
| Map.Entry entry = (Map.Entry) it.next();
|
|
877 |
0
| Object key = entry.getKey();
|
|
878 |
0
| Object value = entry.getValue();
|
|
879 |
0
| put(key, value);
|
|
880 |
| } |
|
881 |
| } |
|
882 |
| |
|
883 |
| |
|
884 |
| |
|
885 |
| |
|
886 |
| |
|
887 |
| |
|
888 |
| |
|
889 |
| |
|
890 |
| |
|
891 |
| |
|
892 |
| |
|
893 |
| |
|
894 |
24
| public Object remove(Object key) {
|
|
895 |
24
| return remove(key, true);
|
|
896 |
| } |
|
897 |
| |
|
898 |
| |
|
899 |
| |
|
900 |
| |
|
901 |
| |
|
902 |
| |
|
903 |
8724
| public synchronized int size() {
|
|
904 |
8724
| return count;
|
|
905 |
| } |
|
906 |
| |
|
907 |
| |
|
908 |
| |
|
909 |
| |
|
910 |
| |
|
911 |
| |
|
912 |
| |
|
913 |
| |
|
914 |
| |
|
915 |
| |
|
916 |
| |
|
917 |
| |
|
918 |
0
| public Collection values() {
|
|
919 |
0
| Collection vs = values;
|
|
920 |
| |
|
921 |
0
| if (vs != null) {
|
|
922 |
0
| return vs;
|
|
923 |
| } else { |
|
924 |
0
| return values = new AbstractCollection() {
|
|
925 |
0
| public Iterator iterator() {
|
|
926 |
0
| return new ValueIterator();
|
|
927 |
| } |
|
928 |
| |
|
929 |
0
| public int size() {
|
|
930 |
0
| return AbstractConcurrentReadCache.this.size();
|
|
931 |
| } |
|
932 |
| |
|
933 |
0
| public boolean contains(Object o) {
|
|
934 |
0
| return AbstractConcurrentReadCache.this.containsValue(o);
|
|
935 |
| } |
|
936 |
| |
|
937 |
0
| public void clear() {
|
|
938 |
0
| AbstractConcurrentReadCache.this.clear();
|
|
939 |
| } |
|
940 |
| }; |
|
941 |
| } |
|
942 |
| } |
|
943 |
| |
|
944 |
| |
|
945 |
| |
|
946 |
| |
|
947 |
| |
|
948 |
| |
|
949 |
| |
|
950 |
| |
|
951 |
| |
|
952 |
27
| protected synchronized final Set getGroupForReading(String groupName) {
|
|
953 |
27
| Set group = (Set) getGroupsForReading().get(groupName);
|
|
954 |
3
| if (group == null) return null;
|
|
955 |
24
| return new HashSet(group);
|
|
956 |
| } |
|
957 |
| |
|
958 |
| |
|
959 |
| |
|
960 |
| |
|
961 |
| |
|
962 |
| |
|
963 |
| |
|
964 |
27
| protected final Map getGroupsForReading() {
|
|
965 |
27
| synchronized (barrierLock) {
|
|
966 |
27
| return groups;
|
|
967 |
| } |
|
968 |
| } |
|
969 |
| |
|
970 |
| |
|
971 |
| |
|
972 |
| |
|
973 |
| |
|
974 |
| |
|
975 |
16357
| protected final Entry[] getTableForReading() {
|
|
976 |
16357
| synchronized (barrierLock) {
|
|
977 |
16357
| return table;
|
|
978 |
| } |
|
979 |
| } |
|
980 |
| |
|
981 |
| |
|
982 |
| |
|
983 |
| |
|
984 |
| |
|
985 |
| |
|
986 |
15984
| protected final void recordModification(Object x) {
|
|
987 |
15984
| synchronized (barrierLock) {
|
|
988 |
15984
| lastWrite = x;
|
|
989 |
| } |
|
990 |
| } |
|
991 |
| |
|
992 |
| |
|
993 |
| |
|
994 |
| |
|
995 |
0
| protected synchronized boolean findAndRemoveEntry(Map.Entry entry) {
|
|
996 |
0
| Object key = entry.getKey();
|
|
997 |
0
| Object v = get(key);
|
|
998 |
| |
|
999 |
0
| if ((v != null) && v.equals(entry.getValue())) {
|
|
1000 |
0
| remove(key);
|
|
1001 |
| |
|
1002 |
0
| return true;
|
|
1003 |
| } else { |
|
1004 |
0
| return false;
|
|
1005 |
| } |
|
1006 |
| } |
|
1007 |
| |
|
1008 |
| |
|
1009 |
| |
|
1010 |
| |
|
1011 |
| |
|
1012 |
7245
| protected void persistRemove(Object key) {
|
|
1013 |
7245
| if (log.isDebugEnabled()) {
|
|
1014 |
0
| log.debug("PersistRemove called (key=" + key + ")");
|
|
1015 |
| } |
|
1016 |
| |
|
1017 |
7245
| if (persistenceListener != null) {
|
|
1018 |
21
| try {
|
|
1019 |
21
| persistenceListener.remove((String) key);
|
|
1020 |
| } catch (CachePersistenceException e) { |
|
1021 |
0
| log.error("[oscache] Exception removing cache entry with key '" + key + "' from persistence", e);
|
|
1022 |
| } |
|
1023 |
| } |
|
1024 |
| } |
|
1025 |
| |
|
1026 |
| |
|
1027 |
| |
|
1028 |
| |
|
1029 |
| |
|
1030 |
0
| protected void persistRemoveGroup(String groupName) {
|
|
1031 |
0
| if (log.isDebugEnabled()) {
|
|
1032 |
0
| log.debug("persistRemoveGroup called (groupName=" + groupName + ")");
|
|
1033 |
| } |
|
1034 |
| |
|
1035 |
0
| if (persistenceListener != null) {
|
|
1036 |
0
| try {
|
|
1037 |
0
| persistenceListener.removeGroup(groupName);
|
|
1038 |
| } catch (CachePersistenceException e) { |
|
1039 |
0
| log.error("[oscache] Exception removing group " + groupName, e);
|
|
1040 |
| } |
|
1041 |
| } |
|
1042 |
| } |
|
1043 |
| |
|
1044 |
| |
|
1045 |
| |
|
1046 |
| |
|
1047 |
| |
|
1048 |
16460
| protected Object persistRetrieve(Object key) {
|
|
1049 |
16460
| if (log.isDebugEnabled()) {
|
|
1050 |
0
| log.debug("persistRetrieve called (key=" + key + ")");
|
|
1051 |
| } |
|
1052 |
| |
|
1053 |
16460
| Object entry = null;
|
|
1054 |
| |
|
1055 |
16460
| if (persistenceListener != null) {
|
|
1056 |
380
| try {
|
|
1057 |
380
| entry = persistenceListener.retrieve((String) key);
|
|
1058 |
| } catch (CachePersistenceException e) { |
|
1059 |
| |
|
1060 |
| |
|
1061 |
| |
|
1062 |
| |
|
1063 |
| |
|
1064 |
| } |
|
1065 |
| } |
|
1066 |
| |
|
1067 |
16460
| return entry;
|
|
1068 |
| } |
|
1069 |
| |
|
1070 |
| |
|
1071 |
| |
|
1072 |
| |
|
1073 |
| |
|
1074 |
148
| protected Set persistRetrieveGroup(String groupName) {
|
|
1075 |
148
| if (log.isDebugEnabled()) {
|
|
1076 |
0
| log.debug("persistRetrieveGroup called (groupName=" + groupName + ")");
|
|
1077 |
| } |
|
1078 |
| |
|
1079 |
148
| if (persistenceListener != null) {
|
|
1080 |
109
| try {
|
|
1081 |
109
| return persistenceListener.retrieveGroup(groupName);
|
|
1082 |
| } catch (CachePersistenceException e) { |
|
1083 |
0
| log.error("[oscache] Exception retrieving group " + groupName, e);
|
|
1084 |
| } |
|
1085 |
| } |
|
1086 |
| |
|
1087 |
39
| return null;
|
|
1088 |
| } |
|
1089 |
| |
|
1090 |
| |
|
1091 |
| |
|
1092 |
| |
|
1093 |
| |
|
1094 |
| |
|
1095 |
12444
| protected void persistStore(Object key, Object obj) {
|
|
1096 |
12444
| if (log.isDebugEnabled()) {
|
|
1097 |
0
| log.debug("persistStore called (key=" + key + ")");
|
|
1098 |
| } |
|
1099 |
| |
|
1100 |
12444
| if (persistenceListener != null) {
|
|
1101 |
182
| try {
|
|
1102 |
182
| persistenceListener.store((String) key, obj);
|
|
1103 |
| } catch (CachePersistenceException e) { |
|
1104 |
0
| log.error("[oscache] Exception persisting " + key, e);
|
|
1105 |
| } |
|
1106 |
| } |
|
1107 |
| } |
|
1108 |
| |
|
1109 |
| |
|
1110 |
| |
|
1111 |
| |
|
1112 |
| |
|
1113 |
| |
|
1114 |
130
| protected void persistStoreGroup(String groupName, Set group) {
|
|
1115 |
130
| if (log.isDebugEnabled()) {
|
|
1116 |
0
| log.debug("persistStoreGroup called (groupName=" + groupName + ")");
|
|
1117 |
| } |
|
1118 |
| |
|
1119 |
130
| if (persistenceListener != null) {
|
|
1120 |
98
| try {
|
|
1121 |
98
| if ((group == null) || group.isEmpty()) {
|
|
1122 |
0
| persistenceListener.removeGroup(groupName);
|
|
1123 |
| } else { |
|
1124 |
98
| persistenceListener.storeGroup(groupName, group);
|
|
1125 |
| } |
|
1126 |
| } catch (CachePersistenceException e) { |
|
1127 |
0
| log.error("[oscache] Exception persisting group " + groupName, e);
|
|
1128 |
| } |
|
1129 |
| } |
|
1130 |
| } |
|
1131 |
| |
|
1132 |
| |
|
1133 |
| |
|
1134 |
| |
|
1135 |
204
| protected void persistClear() {
|
|
1136 |
204
| if (log.isDebugEnabled()) {
|
|
1137 |
0
| log.debug("persistClear called");
|
|
1138 |
| ; |
|
1139 |
| } |
|
1140 |
| |
|
1141 |
204
| if (persistenceListener != null) {
|
|
1142 |
85
| try {
|
|
1143 |
85
| persistenceListener.clear();
|
|
1144 |
| } catch (CachePersistenceException e) { |
|
1145 |
0
| log.error("[oscache] Exception clearing persistent cache", e);
|
|
1146 |
| } |
|
1147 |
| } |
|
1148 |
| } |
|
1149 |
| |
|
1150 |
| |
|
1151 |
| |
|
1152 |
| |
|
1153 |
| |
|
1154 |
| |
|
1155 |
| protected abstract void itemPut(Object key); |
|
1156 |
| |
|
1157 |
| |
|
1158 |
| |
|
1159 |
| |
|
1160 |
| |
|
1161 |
| |
|
1162 |
| protected abstract void itemRetrieved(Object key); |
|
1163 |
| |
|
1164 |
| |
|
1165 |
| |
|
1166 |
| |
|
1167 |
| |
|
1168 |
| |
|
1169 |
| protected abstract void itemRemoved(Object key); |
|
1170 |
| |
|
1171 |
| |
|
1172 |
| |
|
1173 |
| |
|
1174 |
| |
|
1175 |
| |
|
1176 |
| |
|
1177 |
| protected abstract Object removeItem(); |
|
1178 |
| |
|
1179 |
| |
|
1180 |
| |
|
1181 |
| |
|
1182 |
| |
|
1183 |
| |
|
1184 |
0
| private synchronized void readObject(java.io.ObjectInputStream s) throws IOException, ClassNotFoundException {
|
|
1185 |
| |
|
1186 |
0
| s.defaultReadObject();
|
|
1187 |
| |
|
1188 |
| |
|
1189 |
0
| int numBuckets = s.readInt();
|
|
1190 |
0
| table = new Entry[numBuckets];
|
|
1191 |
| |
|
1192 |
| |
|
1193 |
0
| int size = s.readInt();
|
|
1194 |
| |
|
1195 |
| |
|
1196 |
0
| for (int i = 0; i < size; i++) {
|
|
1197 |
0
| Object key = s.readObject();
|
|
1198 |
0
| Object value = s.readObject();
|
|
1199 |
0
| put(key, value);
|
|
1200 |
| } |
|
1201 |
| } |
|
1202 |
| |
|
1203 |
| |
|
1204 |
| |
|
1205 |
| |
|
1206 |
| |
|
1207 |
| |
|
1208 |
28
| protected void rehash() {
|
|
1209 |
28
| Entry[] oldMap = table;
|
|
1210 |
28
| int oldCapacity = oldMap.length;
|
|
1211 |
| |
|
1212 |
28
| if (oldCapacity >= MAXIMUM_CAPACITY) {
|
|
1213 |
0
| return;
|
|
1214 |
| } |
|
1215 |
| |
|
1216 |
28
| int newCapacity = oldCapacity << 1;
|
|
1217 |
28
| Entry[] newMap = new Entry[newCapacity];
|
|
1218 |
28
| threshold = (int) (newCapacity * loadFactor);
|
|
1219 |
| |
|
1220 |
| |
|
1221 |
| |
|
1222 |
| |
|
1223 |
| |
|
1224 |
| |
|
1225 |
| |
|
1226 |
| |
|
1227 |
| |
|
1228 |
| |
|
1229 |
| |
|
1230 |
| |
|
1231 |
28
| for (int i = 0; i < oldCapacity; ++i) {
|
|
1232 |
1920
| Entry l = null;
|
|
1233 |
1920
| Entry h = null;
|
|
1234 |
1920
| Entry e = oldMap[i];
|
|
1235 |
| |
|
1236 |
1920
| while (e != null) {
|
|
1237 |
1257
| int hash = e.hash;
|
|
1238 |
1257
| Entry next = e.next;
|
|
1239 |
| |
|
1240 |
1257
| if ((hash & oldCapacity) == 0) {
|
|
1241 |
| |
|
1242 |
583
| if (l == null) {
|
|
1243 |
| |
|
1244 |
569
| if ((next == null) || ((next.next == null) && ((next.hash & oldCapacity) == 0))) {
|
|
1245 |
290
| l = e;
|
|
1246 |
| |
|
1247 |
290
| break;
|
|
1248 |
| } |
|
1249 |
| } |
|
1250 |
| |
|
1251 |
293
| l = new Entry(hash, e.key, e.value, l);
|
|
1252 |
| } else { |
|
1253 |
| |
|
1254 |
674
| if (h == null) {
|
|
1255 |
674
| if ((next == null) || ((next.next == null) && ((next.hash & oldCapacity) != 0))) {
|
|
1256 |
549
| h = e;
|
|
1257 |
| |
|
1258 |
549
| break;
|
|
1259 |
| } |
|
1260 |
| } |
|
1261 |
| |
|
1262 |
125
| h = new Entry(hash, e.key, e.value, h);
|
|
1263 |
| } |
|
1264 |
| |
|
1265 |
418
| e = next;
|
|
1266 |
| } |
|
1267 |
| |
|
1268 |
1920
| newMap[i] = l;
|
|
1269 |
1920
| newMap[oldCapacity + i] = h;
|
|
1270 |
| } |
|
1271 |
| |
|
1272 |
28
| table = newMap;
|
|
1273 |
28
| recordModification(newMap);
|
|
1274 |
| } |
|
1275 |
| |
|
1276 |
| |
|
1277 |
| |
|
1278 |
| |
|
1279 |
| |
|
1280 |
| |
|
1281 |
| |
|
1282 |
| |
|
1283 |
| |
|
1284 |
10
| protected Object sput(Object key, Object value, int hash, boolean persist) {
|
|
1285 |
| |
|
1286 |
10
| Entry[] tab = table;
|
|
1287 |
10
| int index = hash & (tab.length - 1);
|
|
1288 |
10
| Entry first = tab[index];
|
|
1289 |
10
| Entry e = first;
|
|
1290 |
| |
|
1291 |
10
| for (;;) {
|
|
1292 |
21
| if (e == null) {
|
|
1293 |
| |
|
1294 |
| |
|
1295 |
| |
|
1296 |
| |
|
1297 |
10
| Entry newEntry;
|
|
1298 |
| |
|
1299 |
10
| if (memoryCaching) {
|
|
1300 |
6
| newEntry = new Entry(hash, key, value, first);
|
|
1301 |
| } else { |
|
1302 |
4
| newEntry = new Entry(hash, key, NULL, first);
|
|
1303 |
| } |
|
1304 |
| |
|
1305 |
10
| itemPut(key);
|
|
1306 |
| |
|
1307 |
| |
|
1308 |
10
| if (persist && !overflowPersistence) {
|
|
1309 |
10
| persistStore(key, value);
|
|
1310 |
| } |
|
1311 |
| |
|
1312 |
| |
|
1313 |
10
| if (value instanceof CacheEntry) {
|
|
1314 |
10
| updateGroups(null, (CacheEntry) value, persist);
|
|
1315 |
| } |
|
1316 |
| |
|
1317 |
| |
|
1318 |
10
| tab[index] = newEntry;
|
|
1319 |
| |
|
1320 |
10
| if (++count >= threshold) {
|
|
1321 |
0
| rehash();
|
|
1322 |
| } else { |
|
1323 |
10
| recordModification(newEntry);
|
|
1324 |
| } |
|
1325 |
| |
|
1326 |
10
| return null;
|
|
1327 |
11
| } else if ((key == e.key) || ((e.hash == hash) && key.equals(e.key))) {
|
|
1328 |
0
| Object oldValue = e.value;
|
|
1329 |
| |
|
1330 |
| |
|
1331 |
| |
|
1332 |
| |
|
1333 |
| |
|
1334 |
0
| if (memoryCaching) {
|
|
1335 |
0
| e.value = value;
|
|
1336 |
| } |
|
1337 |
| |
|
1338 |
| |
|
1339 |
0
| if (persist && overflowPersistence) {
|
|
1340 |
0
| persistRemove(key);
|
|
1341 |
0
| } else if (persist) {
|
|
1342 |
0
| persistStore(key, value);
|
|
1343 |
| } |
|
1344 |
| |
|
1345 |
0
| updateGroups(oldValue, value, persist);
|
|
1346 |
| |
|
1347 |
0
| itemPut(key);
|
|
1348 |
| |
|
1349 |
| |
|
1350 |
0
| return oldValue;
|
|
1351 |
| } else { |
|
1352 |
11
| e = e.next;
|
|
1353 |
| } |
|
1354 |
| } |
|
1355 |
| } |
|
1356 |
| |
|
1357 |
| |
|
1358 |
| |
|
1359 |
| |
|
1360 |
| |
|
1361 |
| |
|
1362 |
| |
|
1363 |
| |
|
1364 |
| |
|
1365 |
0
| protected Object sremove(Object key, int hash, boolean invokeAlgorithm) {
|
|
1366 |
| |
|
1367 |
0
| Entry[] tab = table;
|
|
1368 |
0
| int index = hash & (tab.length - 1);
|
|
1369 |
0
| Entry first = tab[index];
|
|
1370 |
0
| Entry e = first;
|
|
1371 |
| |
|
1372 |
0
| for (;;) {
|
|
1373 |
0
| if (e == null) {
|
|
1374 |
0
| return null;
|
|
1375 |
0
| } else if ((key == e.key) || ((e.hash == hash) && key.equals(e.key))) {
|
|
1376 |
0
| Object oldValue = e.value;
|
|
1377 |
0
| e.value = null;
|
|
1378 |
0
| count--;
|
|
1379 |
| |
|
1380 |
| |
|
1381 |
0
| if (!unlimitedDiskCache && !overflowPersistence) {
|
|
1382 |
0
| persistRemove(e.key);
|
|
1383 |
| } |
|
1384 |
| |
|
1385 |
0
| if (overflowPersistence && ((size() + 1) >= maxEntries)) {
|
|
1386 |
0
| persistStore(key, oldValue);
|
|
1387 |
| } |
|
1388 |
| |
|
1389 |
0
| if (invokeAlgorithm) {
|
|
1390 |
0
| itemRemoved(key);
|
|
1391 |
| } |
|
1392 |
| |
|
1393 |
| |
|
1394 |
0
| Entry head = e.next;
|
|
1395 |
| |
|
1396 |
0
| for (Entry p = first; p != e; p = p.next) {
|
|
1397 |
0
| head = new Entry(p.hash, p.key, p.value, head);
|
|
1398 |
| } |
|
1399 |
| |
|
1400 |
0
| tab[index] = head;
|
|
1401 |
0
| recordModification(head);
|
|
1402 |
| |
|
1403 |
0
| return oldValue;
|
|
1404 |
| } else { |
|
1405 |
0
| e = e.next;
|
|
1406 |
| } |
|
1407 |
| } |
|
1408 |
| } |
|
1409 |
| |
|
1410 |
| |
|
1411 |
| |
|
1412 |
| |
|
1413 |
| |
|
1414 |
| |
|
1415 |
| |
|
1416 |
| |
|
1417 |
| |
|
1418 |
| |
|
1419 |
| |
|
1420 |
| |
|
1421 |
| |
|
1422 |
0
| private synchronized void writeObject(java.io.ObjectOutputStream s) throws IOException {
|
|
1423 |
| |
|
1424 |
0
| s.defaultWriteObject();
|
|
1425 |
| |
|
1426 |
| |
|
1427 |
0
| s.writeInt(table.length);
|
|
1428 |
| |
|
1429 |
| |
|
1430 |
0
| s.writeInt(count);
|
|
1431 |
| |
|
1432 |
| |
|
1433 |
0
| for (int index = table.length - 1; index >= 0; index--) {
|
|
1434 |
0
| Entry entry = table[index];
|
|
1435 |
| |
|
1436 |
0
| while (entry != null) {
|
|
1437 |
0
| s.writeObject(entry.key);
|
|
1438 |
0
| s.writeObject(entry.value);
|
|
1439 |
0
| entry = entry.next;
|
|
1440 |
| } |
|
1441 |
| } |
|
1442 |
| } |
|
1443 |
| |
|
1444 |
| |
|
1445 |
| |
|
1446 |
| |
|
1447 |
| |
|
1448 |
| |
|
1449 |
| |
|
1450 |
2044761
| private static int hash(Object x) {
|
|
1451 |
2043822
| int h = x.hashCode();
|
|
1452 |
| |
|
1453 |
| |
|
1454 |
| |
|
1455 |
| |
|
1456 |
2044690
| return ((h << 7) - h + (h >>> 9) + (h >>> 17));
|
|
1457 |
| } |
|
1458 |
| |
|
1459 |
| |
|
1460 |
| |
|
1461 |
| |
|
1462 |
| |
|
1463 |
| |
|
1464 |
| |
|
1465 |
| |
|
1466 |
| |
|
1467 |
| |
|
1468 |
| |
|
1469 |
| |
|
1470 |
| |
|
1471 |
152
| private void addGroupMappings(String key, Set newGroups, boolean persist) {
|
|
1472 |
| |
|
1473 |
152
| for (Iterator it = newGroups.iterator(); it.hasNext();) {
|
|
1474 |
142
| String groupName = (String) it.next();
|
|
1475 |
| |
|
1476 |
| |
|
1477 |
142
| if (memoryCaching) {
|
|
1478 |
102
| if (groups == null) {
|
|
1479 |
0
| groups = new HashMap();
|
|
1480 |
| } |
|
1481 |
| |
|
1482 |
102
| Set memoryGroup = (Set) groups.get(groupName);
|
|
1483 |
| |
|
1484 |
102
| if (memoryGroup == null) {
|
|
1485 |
33
| memoryGroup = new HashSet();
|
|
1486 |
33
| groups.put(groupName, memoryGroup);
|
|
1487 |
| } |
|
1488 |
| |
|
1489 |
102
| memoryGroup.add(key);
|
|
1490 |
| } |
|
1491 |
| |
|
1492 |
| |
|
1493 |
142
| if (persist) {
|
|
1494 |
112
| Set persistentGroup = persistRetrieveGroup(groupName);
|
|
1495 |
| |
|
1496 |
112
| if (persistentGroup == null) {
|
|
1497 |
47
| persistentGroup = new HashSet();
|
|
1498 |
| } |
|
1499 |
| |
|
1500 |
112
| persistentGroup.add(key);
|
|
1501 |
112
| persistStoreGroup(groupName, persistentGroup);
|
|
1502 |
| } |
|
1503 |
| } |
|
1504 |
| } |
|
1505 |
| |
|
1506 |
| |
|
1507 |
| |
|
1508 |
| |
|
1509 |
| |
|
1510 |
| |
|
1511 |
132
| private int p2capacity(int initialCapacity) {
|
|
1512 |
132
| int cap = initialCapacity;
|
|
1513 |
| |
|
1514 |
| |
|
1515 |
132
| int result;
|
|
1516 |
| |
|
1517 |
132
| if ((cap > MAXIMUM_CAPACITY) || (cap < 0)) {
|
|
1518 |
0
| result = MAXIMUM_CAPACITY;
|
|
1519 |
| } else { |
|
1520 |
132
| result = MINIMUM_CAPACITY;
|
|
1521 |
| |
|
1522 |
132
| while (result < cap) {
|
|
1523 |
396
| result <<= 1;
|
|
1524 |
| } |
|
1525 |
| } |
|
1526 |
| |
|
1527 |
132
| return result;
|
|
1528 |
| } |
|
1529 |
| |
|
1530 |
| |
|
1531 |
| |
|
1532 |
12646
| private Object put(Object key, Object value, boolean persist) {
|
|
1533 |
| |
|
1534 |
12646
| if (value == null) {
|
|
1535 |
24
| throw new NullPointerException();
|
|
1536 |
| } |
|
1537 |
| |
|
1538 |
12622
| int hash = hash(key);
|
|
1539 |
12622
| Entry[] tab = table;
|
|
1540 |
12622
| int index = hash & (tab.length - 1);
|
|
1541 |
12622
| Entry first = tab[index];
|
|
1542 |
12622
| Entry e = first;
|
|
1543 |
| |
|
1544 |
12622
| for (;;) {
|
|
1545 |
15941
| if (e == null) {
|
|
1546 |
8516
| synchronized (this) {
|
|
1547 |
8516
| tab = table;
|
|
1548 |
| |
|
1549 |
| |
|
1550 |
| |
|
1551 |
| |
|
1552 |
| |
|
1553 |
| |
|
1554 |
| |
|
1555 |
| |
|
1556 |
| |
|
1557 |
| |
|
1558 |
| |
|
1559 |
| |
|
1560 |
| |
|
1561 |
| |
|
1562 |
8516
| if (size() >= maxEntries) {
|
|
1563 |
7224
| remove(removeItem(), false);
|
|
1564 |
| } |
|
1565 |
| |
|
1566 |
8516
| if (first == tab[index]) {
|
|
1567 |
| |
|
1568 |
8506
| Entry newEntry = null;
|
|
1569 |
| |
|
1570 |
8506
| if (memoryCaching) {
|
|
1571 |
8444
| newEntry = new Entry(hash, key, value, first);
|
|
1572 |
| } else { |
|
1573 |
62
| newEntry = new Entry(hash, key, NULL, first);
|
|
1574 |
| } |
|
1575 |
| |
|
1576 |
8506
| tab[index] = newEntry;
|
|
1577 |
8506
| itemPut(key);
|
|
1578 |
| |
|
1579 |
| |
|
1580 |
8506
| if (persist && !overflowPersistence) {
|
|
1581 |
8333
| persistStore(key, value);
|
|
1582 |
| } |
|
1583 |
| |
|
1584 |
| |
|
1585 |
8506
| if (value instanceof CacheEntry) {
|
|
1586 |
8250
| updateGroups(null, (CacheEntry) value, persist);
|
|
1587 |
| } |
|
1588 |
| |
|
1589 |
8506
| if (++count >= threshold) {
|
|
1590 |
28
| rehash();
|
|
1591 |
| } else { |
|
1592 |
8478
| recordModification(newEntry);
|
|
1593 |
| } |
|
1594 |
| |
|
1595 |
8506
| return newEntry;
|
|
1596 |
| |
|
1597 |
| |
|
1598 |
| } else { |
|
1599 |
| |
|
1600 |
| |
|
1601 |
| |
|
1602 |
| |
|
1603 |
| |
|
1604 |
| |
|
1605 |
10
| return sput(key, value, hash, persist);
|
|
1606 |
| |
|
1607 |
| |
|
1608 |
| } |
|
1609 |
| } |
|
1610 |
7425
| } else if ((key == e.key) || ((e.hash == hash) && key.equals(e.key))) {
|
|
1611 |
| |
|
1612 |
| |
|
1613 |
4106
| synchronized (this) {
|
|
1614 |
4106
| tab = table;
|
|
1615 |
| |
|
1616 |
4106
| Object oldValue = e.value;
|
|
1617 |
| |
|
1618 |
| |
|
1619 |
4106
| if (persist && (oldValue == NULL)) {
|
|
1620 |
31
| oldValue = persistRetrieve(key);
|
|
1621 |
| } |
|
1622 |
| |
|
1623 |
4106
| if ((first == tab[index]) && (oldValue != null)) {
|
|
1624 |
| |
|
1625 |
| |
|
1626 |
| |
|
1627 |
| |
|
1628 |
| |
|
1629 |
4106
| if (memoryCaching) {
|
|
1630 |
4075
| e.value = value;
|
|
1631 |
| } |
|
1632 |
| |
|
1633 |
| |
|
1634 |
4106
| if (persist && overflowPersistence) {
|
|
1635 |
21
| persistRemove(key);
|
|
1636 |
4085
| } else if (persist) {
|
|
1637 |
4085
| persistStore(key, value);
|
|
1638 |
| } |
|
1639 |
| |
|
1640 |
4106
| updateGroups(oldValue, value, persist);
|
|
1641 |
4106
| itemPut(key);
|
|
1642 |
| |
|
1643 |
4106
| return oldValue;
|
|
1644 |
| |
|
1645 |
| |
|
1646 |
| } else { |
|
1647 |
| |
|
1648 |
| |
|
1649 |
| |
|
1650 |
| |
|
1651 |
| |
|
1652 |
| |
|
1653 |
0
| return sput(key, value, hash, persist);
|
|
1654 |
| |
|
1655 |
| |
|
1656 |
| } |
|
1657 |
| } |
|
1658 |
| } else { |
|
1659 |
3319
| e = e.next;
|
|
1660 |
| } |
|
1661 |
| } |
|
1662 |
| } |
|
1663 |
| |
|
1664 |
7264
| private synchronized Object remove(Object key, boolean invokeAlgorithm)
|
|
1665 |
| |
|
1666 |
| |
|
1667 |
| |
|
1668 |
| { |
|
1669 |
| |
|
1670 |
| |
|
1671 |
| |
|
1672 |
| |
|
1673 |
| |
|
1674 |
| |
|
1675 |
| |
|
1676 |
| |
|
1677 |
| |
|
1678 |
| |
|
1679 |
| |
|
1680 |
| |
|
1681 |
| |
|
1682 |
7264
| if (key == null) {
|
|
1683 |
0
| return null;
|
|
1684 |
| } |
|
1685 |
| |
|
1686 |
| |
|
1687 |
7264
| int hash = hash(key);
|
|
1688 |
7264
| Entry[] tab = table;
|
|
1689 |
7264
| int index = hash & (tab.length - 1);
|
|
1690 |
7264
| Entry first = tab[index];
|
|
1691 |
7264
| Entry e = first;
|
|
1692 |
| |
|
1693 |
7264
| for (;;) {
|
|
1694 |
9816
| if (e == null) {
|
|
1695 |
0
| tab = getTableForReading();
|
|
1696 |
| |
|
1697 |
0
| if (first == tab[index]) {
|
|
1698 |
0
| return null;
|
|
1699 |
| } else { |
|
1700 |
| |
|
1701 |
| |
|
1702 |
| |
|
1703 |
| |
|
1704 |
| |
|
1705 |
| |
|
1706 |
0
| return sremove(key, hash, invokeAlgorithm);
|
|
1707 |
| |
|
1708 |
| |
|
1709 |
| } |
|
1710 |
9816
| } else if ((key == e.key) || ((e.hash == hash) && key.equals(e.key))) {
|
|
1711 |
7264
| synchronized (this) {
|
|
1712 |
7264
| tab = table;
|
|
1713 |
| |
|
1714 |
7264
| Object oldValue = e.value;
|
|
1715 |
| |
|
1716 |
| |
|
1717 |
7264
| if ((first != tab[index]) || (oldValue == null)) {
|
|
1718 |
| |
|
1719 |
| |
|
1720 |
| |
|
1721 |
| |
|
1722 |
0
| return sremove(key, hash, invokeAlgorithm);
|
|
1723 |
| } |
|
1724 |
| |
|
1725 |
| |
|
1726 |
7264
| e.value = null;
|
|
1727 |
7264
| count--;
|
|
1728 |
| |
|
1729 |
| |
|
1730 |
7264
| if (!unlimitedDiskCache && !overflowPersistence) {
|
|
1731 |
7224
| persistRemove(e.key);
|
|
1732 |
| } |
|
1733 |
| |
|
1734 |
7264
| if (overflowPersistence && ((size() + 1) >= maxEntries)) {
|
|
1735 |
16
| persistStore(key, oldValue);
|
|
1736 |
| } |
|
1737 |
| |
|
1738 |
7264
| if (invokeAlgorithm) {
|
|
1739 |
24
| itemRemoved(key);
|
|
1740 |
| } |
|
1741 |
| |
|
1742 |
| |
|
1743 |
7264
| Entry head = e.next;
|
|
1744 |
| |
|
1745 |
7264
| for (Entry p = first; p != e; p = p.next) {
|
|
1746 |
2552
| head = new Entry(p.hash, p.key, p.value, head);
|
|
1747 |
| } |
|
1748 |
| |
|
1749 |
7264
| tab[index] = head;
|
|
1750 |
7264
| recordModification(head);
|
|
1751 |
| |
|
1752 |
7264
| return oldValue;
|
|
1753 |
| } |
|
1754 |
| } else { |
|
1755 |
2552
| e = e.next;
|
|
1756 |
| } |
|
1757 |
| } |
|
1758 |
| } |
|
1759 |
| |
|
1760 |
| |
|
1761 |
| |
|
1762 |
| |
|
1763 |
| |
|
1764 |
| |
|
1765 |
| |
|
1766 |
| |
|
1767 |
| |
|
1768 |
| |
|
1769 |
| |
|
1770 |
| |
|
1771 |
| |
|
1772 |
| |
|
1773 |
80
| private void removeGroupMappings(String key, Set oldGroups, boolean persist) {
|
|
1774 |
80
| for (Iterator it = oldGroups.iterator(); it.hasNext();) {
|
|
1775 |
24
| String groupName = (String) it.next();
|
|
1776 |
| |
|
1777 |
| |
|
1778 |
24
| if (memoryCaching && (this.groups != null)) {
|
|
1779 |
18
| Set memoryGroup = (Set) groups.get(groupName);
|
|
1780 |
| |
|
1781 |
18
| if (memoryGroup != null) {
|
|
1782 |
18
| memoryGroup.remove(key);
|
|
1783 |
| |
|
1784 |
18
| if (memoryGroup.isEmpty()) {
|
|
1785 |
0
| groups.remove(groupName);
|
|
1786 |
| } |
|
1787 |
| } |
|
1788 |
| } |
|
1789 |
| |
|
1790 |
| |
|
1791 |
24
| if (persist) {
|
|
1792 |
24
| Set persistentGroup = persistRetrieveGroup(groupName);
|
|
1793 |
| |
|
1794 |
24
| if (persistentGroup != null) {
|
|
1795 |
18
| persistentGroup.remove(key);
|
|
1796 |
| |
|
1797 |
18
| if (persistentGroup.isEmpty()) {
|
|
1798 |
0
| persistRemoveGroup(groupName);
|
|
1799 |
| } else { |
|
1800 |
18
| persistStoreGroup(groupName, persistentGroup);
|
|
1801 |
| } |
|
1802 |
| } |
|
1803 |
| } |
|
1804 |
| } |
|
1805 |
| } |
|
1806 |
| |
|
1807 |
| |
|
1808 |
| |
|
1809 |
| |
|
1810 |
| |
|
1811 |
| |
|
1812 |
| |
|
1813 |
| |
|
1814 |
| |
|
1815 |
| |
|
1816 |
4106
| private void updateGroups(Object oldValue, Object newValue, boolean persist) {
|
|
1817 |
| |
|
1818 |
4106
| boolean oldIsCE = oldValue instanceof CacheEntry;
|
|
1819 |
4106
| boolean newIsCE = newValue instanceof CacheEntry;
|
|
1820 |
| |
|
1821 |
4106
| if (newIsCE && oldIsCE) {
|
|
1822 |
4106
| updateGroups((CacheEntry) oldValue, (CacheEntry) newValue, persist);
|
|
1823 |
0
| } else if (newIsCE) {
|
|
1824 |
0
| updateGroups(null, (CacheEntry) newValue, persist);
|
|
1825 |
0
| } else if (oldIsCE) {
|
|
1826 |
0
| updateGroups((CacheEntry) oldValue, null, persist);
|
|
1827 |
| } |
|
1828 |
| } |
|
1829 |
| |
|
1830 |
| |
|
1831 |
| |
|
1832 |
| |
|
1833 |
| |
|
1834 |
| |
|
1835 |
| |
|
1836 |
| |
|
1837 |
| |
|
1838 |
| |
|
1839 |
12366
| private void updateGroups(CacheEntry oldValue, CacheEntry newValue, boolean persist) {
|
|
1840 |
12366
| Set oldGroups = null;
|
|
1841 |
12366
| Set newGroups = null;
|
|
1842 |
| |
|
1843 |
12366
| if (oldValue != null) {
|
|
1844 |
4106
| oldGroups = oldValue.getGroups();
|
|
1845 |
| } |
|
1846 |
| |
|
1847 |
12366
| if (newValue != null) {
|
|
1848 |
12366
| newGroups = newValue.getGroups();
|
|
1849 |
| } |
|
1850 |
| |
|
1851 |
| |
|
1852 |
12366
| if (oldGroups != null) {
|
|
1853 |
80
| Set removeFromGroups = new HashSet();
|
|
1854 |
| |
|
1855 |
80
| for (Iterator it = oldGroups.iterator(); it.hasNext();) {
|
|
1856 |
134
| String groupName = (String) it.next();
|
|
1857 |
| |
|
1858 |
134
| if ((newGroups == null) || !newGroups.contains(groupName)) {
|
|
1859 |
| |
|
1860 |
24
| removeFromGroups.add(groupName);
|
|
1861 |
| } |
|
1862 |
| } |
|
1863 |
| |
|
1864 |
80
| removeGroupMappings(oldValue.getKey(), removeFromGroups, persist);
|
|
1865 |
| } |
|
1866 |
| |
|
1867 |
| |
|
1868 |
12366
| if (newGroups != null) {
|
|
1869 |
152
| Set addToGroups = new HashSet();
|
|
1870 |
| |
|
1871 |
152
| for (Iterator it = newGroups.iterator(); it.hasNext();) {
|
|
1872 |
252
| String groupName = (String) it.next();
|
|
1873 |
| |
|
1874 |
252
| if ((oldGroups == null) || !oldGroups.contains(groupName)) {
|
|
1875 |
| |
|
1876 |
142
| addToGroups.add(groupName);
|
|
1877 |
| } |
|
1878 |
| } |
|
1879 |
| |
|
1880 |
152
| addGroupMappings(newValue.getKey(), addToGroups, persist);
|
|
1881 |
| } |
|
1882 |
| } |
|
1883 |
| |
|
1884 |
| |
|
1885 |
| |
|
1886 |
| |
|
1887 |
| protected static class Entry implements Map.Entry { |
|
1888 |
| protected final Entry next; |
|
1889 |
| protected final Object key; |
|
1890 |
| |
|
1891 |
| |
|
1892 |
| |
|
1893 |
| |
|
1894 |
| |
|
1895 |
| |
|
1896 |
| |
|
1897 |
| protected final int hash; |
|
1898 |
| protected volatile Object value; |
|
1899 |
| |
|
1900 |
11486
| Entry(int hash, Object key, Object value, Entry next) {
|
|
1901 |
11486
| this.hash = hash;
|
|
1902 |
11486
| this.key = key;
|
|
1903 |
11486
| this.next = next;
|
|
1904 |
11486
| this.value = value;
|
|
1905 |
| } |
|
1906 |
| |
|
1907 |
| |
|
1908 |
0
| public Object getKey() {
|
|
1909 |
0
| return key;
|
|
1910 |
| } |
|
1911 |
| |
|
1912 |
| |
|
1913 |
| |
|
1914 |
| |
|
1915 |
| |
|
1916 |
| |
|
1917 |
| |
|
1918 |
| |
|
1919 |
| |
|
1920 |
| |
|
1921 |
| |
|
1922 |
| |
|
1923 |
| |
|
1924 |
| |
|
1925 |
| |
|
1926 |
| |
|
1927 |
| |
|
1928 |
| |
|
1929 |
| |
|
1930 |
| |
|
1931 |
| |
|
1932 |
| |
|
1933 |
0
| public Object setValue(Object value) {
|
|
1934 |
0
| if (value == null) {
|
|
1935 |
0
| throw new NullPointerException();
|
|
1936 |
| } |
|
1937 |
| |
|
1938 |
0
| Object oldValue = this.value;
|
|
1939 |
0
| this.value = value;
|
|
1940 |
| |
|
1941 |
0
| return oldValue;
|
|
1942 |
| } |
|
1943 |
| |
|
1944 |
| |
|
1945 |
| |
|
1946 |
| |
|
1947 |
| |
|
1948 |
| |
|
1949 |
| |
|
1950 |
| |
|
1951 |
| |
|
1952 |
| |
|
1953 |
| |
|
1954 |
| |
|
1955 |
| |
|
1956 |
| |
|
1957 |
0
| public Object getValue() {
|
|
1958 |
0
| return value;
|
|
1959 |
| } |
|
1960 |
| |
|
1961 |
0
| public boolean equals(Object o) {
|
|
1962 |
0
| if (!(o instanceof Map.Entry)) {
|
|
1963 |
0
| return false;
|
|
1964 |
| } |
|
1965 |
| |
|
1966 |
0
| Map.Entry e = (Map.Entry) o;
|
|
1967 |
| |
|
1968 |
0
| if (!key.equals(e.getKey())) {
|
|
1969 |
0
| return false;
|
|
1970 |
| } |
|
1971 |
| |
|
1972 |
0
| Object v = value;
|
|
1973 |
| |
|
1974 |
0
| return (v == null) ? (e.getValue() == null) : v.equals(e.getValue());
|
|
1975 |
| } |
|
1976 |
| |
|
1977 |
0
| public int hashCode() {
|
|
1978 |
0
| Object v = value;
|
|
1979 |
| |
|
1980 |
0
| return hash ^ ((v == null) ? 0 : v.hashCode());
|
|
1981 |
| } |
|
1982 |
| |
|
1983 |
0
| public String toString() {
|
|
1984 |
0
| return key + "=" + value;
|
|
1985 |
| } |
|
1986 |
| |
|
1987 |
0
| protected Object clone() {
|
|
1988 |
0
| return new Entry(hash, key, value, ((next == null) ? null : (Entry) next.clone()));
|
|
1989 |
| } |
|
1990 |
| } |
|
1991 |
| |
|
1992 |
| protected class HashIterator implements Iterator, Enumeration { |
|
1993 |
| protected final Entry[] tab; |
|
1994 |
| protected Entry entry = null; |
|
1995 |
| protected Entry lastReturned = null; |
|
1996 |
| protected Object currentKey; |
|
1997 |
| protected Object currentValue; |
|
1998 |
| protected int index; |
|
1999 |
| |
|
2000 |
48
| protected HashIterator() {
|
|
2001 |
48
| tab = AbstractConcurrentReadCache.this.getTableForReading();
|
|
2002 |
48
| index = tab.length - 1;
|
|
2003 |
| } |
|
2004 |
| |
|
2005 |
0
| public boolean hasMoreElements() {
|
|
2006 |
0
| return hasNext();
|
|
2007 |
| } |
|
2008 |
| |
|
2009 |
120
| public boolean hasNext() {
|
|
2010 |
| |
|
2011 |
| |
|
2012 |
| |
|
2013 |
| |
|
2014 |
| |
|
2015 |
| |
|
2016 |
| |
|
2017 |
120
| for (;;) {
|
|
2018 |
192
| if (entry != null) {
|
|
2019 |
72
| Object v = entry.value;
|
|
2020 |
| |
|
2021 |
72
| if (v != null) {
|
|
2022 |
72
| currentKey = entry.key;
|
|
2023 |
72
| currentValue = v;
|
|
2024 |
| |
|
2025 |
72
| return true;
|
|
2026 |
| } else { |
|
2027 |
0
| entry = entry.next;
|
|
2028 |
| } |
|
2029 |
| } |
|
2030 |
| |
|
2031 |
120
| while ((entry == null) && (index >= 0)) {
|
|
2032 |
1536
| entry = tab[index--];
|
|
2033 |
| } |
|
2034 |
| |
|
2035 |
120
| if (entry == null) {
|
|
2036 |
48
| currentKey = currentValue = null;
|
|
2037 |
| |
|
2038 |
48
| return false;
|
|
2039 |
| } |
|
2040 |
| } |
|
2041 |
| } |
|
2042 |
| |
|
2043 |
72
| public Object next() {
|
|
2044 |
72
| if ((currentKey == null) && !hasNext()) {
|
|
2045 |
0
| throw new NoSuchElementException();
|
|
2046 |
| } |
|
2047 |
| |
|
2048 |
72
| Object result = returnValueOfNext();
|
|
2049 |
72
| lastReturned = entry;
|
|
2050 |
72
| currentKey = currentValue = null;
|
|
2051 |
72
| entry = entry.next;
|
|
2052 |
| |
|
2053 |
72
| return result;
|
|
2054 |
| } |
|
2055 |
| |
|
2056 |
0
| public Object nextElement() {
|
|
2057 |
0
| return next();
|
|
2058 |
| } |
|
2059 |
| |
|
2060 |
0
| public void remove() {
|
|
2061 |
0
| if (lastReturned == null) {
|
|
2062 |
0
| throw new IllegalStateException();
|
|
2063 |
| } |
|
2064 |
| |
|
2065 |
0
| AbstractConcurrentReadCache.this.remove(lastReturned.key);
|
|
2066 |
| } |
|
2067 |
| |
|
2068 |
0
| protected Object returnValueOfNext() {
|
|
2069 |
0
| return entry;
|
|
2070 |
| } |
|
2071 |
| } |
|
2072 |
| |
|
2073 |
| protected class KeyIterator extends HashIterator { |
|
2074 |
72
| protected Object returnValueOfNext() {
|
|
2075 |
72
| return currentKey;
|
|
2076 |
| } |
|
2077 |
| } |
|
2078 |
| |
|
2079 |
| protected class ValueIterator extends HashIterator { |
|
2080 |
0
| protected Object returnValueOfNext() {
|
|
2081 |
0
| return currentValue;
|
|
2082 |
| } |
|
2083 |
| } |
|
2084 |
| } |