149150151152153154155156157158
this.key = k; } } private void processQueue() { SpecialValue sv = null; while ((sv = (SpecialValue) rq.poll()) != null) { map.remove(sv.key); } }
157158159160161162163164165166167168169170171172173174
} } @Override public Object get(Object key) { SpecialValue value = map.get(key); if (value == null) return null; if (value.get() == null) { // it got GC'd map.remove(value.key); if (recordMiss) missSharedEvicted++; return null; } else { return value.get(); } }
174175176177178179180
} @Override public Object put(Object k, Object v) { processQueue(); return map.put(k, new SpecialValue(k, v)); }
197198199200201202203204205206207208209
} @Override public Object remove(Object k) { processQueue(); SpecialValue value = map.remove(k); if (value == null) return null; if (value.get() != null) { return value.get(); } return null; }