/** * Performs eviction if the segment is full. This should only be called prior to adding a new * entry and increasing {@code count}. * * @return {@code true} if eviction occurred */ @GuardedBy("Segment.this") boolean evictEntries() { if (map.evictsBySize() && count >= maxSegmentSize) { drainRecencyQueue(); ReferenceEntry<K, V> e = evictionQueue.remove(); if (!removeEntry(e, e.getHash(), RemovalCause.SIZE)) { throw new AssertionError(); } return true; } return false; }
/** * Performs eviction if the segment is full. This should only be called prior to adding a new * entry and increasing {@code count}. * * @return {@code true} if eviction occurred */ @GuardedBy("Segment.this") boolean evictEntries() { if (map.evictsBySize() && count >= maxSegmentSize) { drainRecencyQueue(); ReferenceEntry<K, V> e = evictionQueue.remove(); if (!removeEntry(e, e.getHash(), RemovalCause.SIZE)) { throw new AssertionError(); } return true; } return false; }
/** * Performs eviction if the segment is full. This should only be called prior to adding a new * entry and increasing {@code count}. * * @return {@code true} if eviction occurred */ @GuardedBy("this") boolean evictEntries() { if (map.evictsBySize() && count >= maxSegmentSize) { drainRecencyQueue(); ReferenceEntry<K, V> e = evictionQueue.remove(); if (!removeEntry(e, e.getHash(), RemovalCause.SIZE)) { throw new AssertionError(); } return true; } return false; }
/** * Performs eviction if the segment is full. This should only be called prior to adding a new * entry and increasing {@code count}. * * @return {@code true} if eviction occurred */ @GuardedBy("Segment.this") boolean evictEntries() { if (map.evictsBySize() && count >= maxSegmentSize) { drainRecencyQueue(); ReferenceEntry<K, V> e = evictionQueue.remove(); if (!removeEntry(e, e.getHash(), RemovalCause.SIZE)) { throw new AssertionError(); } return true; } return false; }
/** * Performs eviction if the segment is full. This should only be called prior to adding a new * entry and increasing {@code count}. * * @return {@code true} if eviction occurred */ @GuardedBy("Segment.this") boolean evictEntries() { if (map.evictsBySize() && count >= maxSegmentSize) { drainRecencyQueue(); ReferenceEntry<K, V> e = evictionQueue.remove(); if (!removeEntry(e, e.getHash(), RemovalCause.SIZE)) { throw new AssertionError(); } return true; } return false; }
/** * Performs eviction if the segment is full. This should only be called prior to adding a new * entry and increasing {@code count}. * * @return {@code true} if eviction occurred */ @GuardedBy("Segment.this") boolean evictEntries() { if (map.evictsBySize() && count >= maxSegmentSize) { drainRecencyQueue(); ReferenceEntry<K, V> e = evictionQueue.remove(); if (!removeEntry(e, e.getHash(), RemovalCause.SIZE)) { throw new AssertionError(); } return true; } return false; }
HashIterator() { nextSegmentIndex = segments.length - 1; nextTableIndex = -1; advance(); }
HashIterator() { nextSegmentIndex = segments.length - 1; nextTableIndex = -1; advance(); }
HashIterator() { nextSegmentIndex = segments.length - 1; nextTableIndex = -1; advance(); }
HashIterator() { nextSegmentIndex = segments.length - 1; nextTableIndex = -1; advance(); }
HashIterator() { nextSegmentIndex = segments.length - 1; nextTableIndex = -1; advance(); }
HashIterator() { nextSegmentIndex = segments.length - 1; nextTableIndex = -1; advance(); }
HashIterator() { nextSegmentIndex = segments.length - 1; nextTableIndex = -1; advance(); }
HashIterator() { nextSegmentIndex = segments.length - 1; nextTableIndex = -1; advance(); }
Segment(MapMakerInternalMap<K, V> map, int initialCapacity, int maxSegmentSize) { this.map = map; this.maxSegmentSize = maxSegmentSize; initTable(newEntryArray(initialCapacity)); keyReferenceQueue = map.usesKeyReferences() ? new ReferenceQueue<K>() : null; valueReferenceQueue = map.usesValueReferences() ? new ReferenceQueue<V>() : null; recencyQueue = (map.evictsBySize() || map.expiresAfterAccess()) ? new ConcurrentLinkedQueue<ReferenceEntry<K, V>>() : MapMakerInternalMap.<ReferenceEntry<K, V>> discardingQueue(); evictionQueue = map.evictsBySize() ? new EvictionQueue<K, V>() : MapMakerInternalMap.<ReferenceEntry<K, V>> discardingQueue(); expirationQueue = map.expires() ? new ExpirationQueue<K, V>() : MapMakerInternalMap.<ReferenceEntry<K, V>> discardingQueue(); }
Segment(MapMakerInternalMap<K, V> map, int initialCapacity, int maxSegmentSize) { this.map = map; this.maxSegmentSize = maxSegmentSize; initTable(newEntryArray(initialCapacity)); keyReferenceQueue = map.usesKeyReferences() ? new ReferenceQueue<K>() : null; valueReferenceQueue = map.usesValueReferences() ? new ReferenceQueue<V>() : null; recencyQueue = (map.evictsBySize() || map.expiresAfterAccess()) ? new ConcurrentLinkedQueue<ReferenceEntry<K, V>>() : MapMakerInternalMap.<ReferenceEntry<K, V>>discardingQueue(); evictionQueue = map.evictsBySize() ? new EvictionQueue<K, V>() : MapMakerInternalMap.<ReferenceEntry<K, V>>discardingQueue(); expirationQueue = map.expires() ? new ExpirationQueue<K, V>() : MapMakerInternalMap.<ReferenceEntry<K, V>>discardingQueue(); }
Segment(MapMakerInternalMap<K, V> map, int initialCapacity, int maxSegmentSize) { this.map = map; this.maxSegmentSize = maxSegmentSize; initTable(newEntryArray(initialCapacity)); keyReferenceQueue = map.usesKeyReferences() ? new ReferenceQueue<K>() : null; valueReferenceQueue = map.usesValueReferences() ? new ReferenceQueue<V>() : null; recencyQueue = (map.evictsBySize() || map.expiresAfterAccess()) ? new ConcurrentLinkedQueue<ReferenceEntry<K, V>>() : MapMakerInternalMap.<ReferenceEntry<K, V>>discardingQueue(); evictionQueue = map.evictsBySize() ? new EvictionQueue<K, V>() : MapMakerInternalMap.<ReferenceEntry<K, V>>discardingQueue(); expirationQueue = map.expires() ? new ExpirationQueue<K, V>() : MapMakerInternalMap.<ReferenceEntry<K, V>>discardingQueue(); }
Segment(MapMakerInternalMap<K, V> map, int initialCapacity, int maxSegmentSize) { this.map = map; this.maxSegmentSize = maxSegmentSize; initTable(newEntryArray(initialCapacity)); keyReferenceQueue = map.usesKeyReferences() ? new ReferenceQueue<K>() : null; valueReferenceQueue = map.usesValueReferences() ? new ReferenceQueue<V>() : null; recencyQueue = (map.evictsBySize() || map.expiresAfterAccess()) ? new ConcurrentLinkedQueue<ReferenceEntry<K, V>>() : MapMakerInternalMap.<ReferenceEntry<K, V>>discardingQueue(); evictionQueue = map.evictsBySize() ? new EvictionQueue<K, V>() : MapMakerInternalMap.<ReferenceEntry<K, V>>discardingQueue(); expirationQueue = map.expires() ? new ExpirationQueue<K, V>() : MapMakerInternalMap.<ReferenceEntry<K, V>>discardingQueue(); }
Segment(MapMakerInternalMap<K, V> map, int initialCapacity, int maxSegmentSize) { this.map = map; this.maxSegmentSize = maxSegmentSize; initTable(newEntryArray(initialCapacity)); keyReferenceQueue = map.usesKeyReferences() ? new ReferenceQueue<K>() : null; valueReferenceQueue = map.usesValueReferences() ? new ReferenceQueue<V>() : null; recencyQueue = (map.evictsBySize() || map.expiresAfterAccess()) ? new ConcurrentLinkedQueue<ReferenceEntry<K, V>>() : MapMakerInternalMap.<ReferenceEntry<K, V>>discardingQueue(); evictionQueue = map.evictsBySize() ? new EvictionQueue<K, V>() : MapMakerInternalMap.<ReferenceEntry<K, V>>discardingQueue(); expirationQueue = map.expires() ? new ExpirationQueue<K, V>() : MapMakerInternalMap.<ReferenceEntry<K, V>>discardingQueue(); }
Segment(MapMakerInternalMap<K, V> map, int initialCapacity, int maxSegmentSize) { this.map = map; this.maxSegmentSize = maxSegmentSize; initTable(newEntryArray(initialCapacity)); keyReferenceQueue = map.usesKeyReferences() ? new ReferenceQueue<K>() : null; valueReferenceQueue = map.usesValueReferences() ? new ReferenceQueue<V>() : null; recencyQueue = (map.evictsBySize() || map.expiresAfterAccess()) ? new ConcurrentLinkedQueue<ReferenceEntry<K, V>>() : MapMakerInternalMap.<ReferenceEntry<K, V>>discardingQueue(); evictionQueue = map.evictsBySize() ? new EvictionQueue<K, V>() : MapMakerInternalMap.<ReferenceEntry<K, V>>discardingQueue(); expirationQueue = map.expires() ? new ExpirationQueue<K, V>() : MapMakerInternalMap.<ReferenceEntry<K, V>>discardingQueue(); }