ConcurrentHashMap in that it maintains a
page replacement algorithm that is used to evict an entry when the map has
exceeded its capacity. Unlike the Java Collections Framework, this
map does not have a publicly visible constructor and instances are created
through a Builder.
An entry is evicted from the map when the entry size exceeds its maximum capacity threshold.
An EvictionListener may be supplied for notification when an entry
is evicted from the map. This listener is invoked on a caller's thread and
will not block other threads from operating on the map. An implementation
should be aware that the caller's thread will not expect long execution
times or failures as a side effect of the listener being notified. Execution
safety and a fast turn around time can be achieved by performing the
operation asynchronously, such as by submitting a task to an
java..
The concurrency level determines the number of threads that can concurrently modify the table. Using a significantly higher or lower value than needed can waste space or lead to thread contention, but an estimate within an order of magnitude of the ideal value does not usually have a noticeable impact. Because placement in hash tables is essentially random, the actual concurrency will vary.
This class and its views and iterators implement all of the
optional methods of the Map and Iterator
interfaces.
Like java. but unlike HashMap, this class
does not allow null to be used as a key or value. Unlike
java., this class does not provide
predictable iteration order. A snapshot of the keys and entries may be
obtained in ascending and descending order of retention.
| Modifier and Type | Class and Description |
|---|---|
| pack-priv class | PrivateMaxEntriesMap.AddTask
Adds the node to the page replacement policy. |
| public static class | |
| pack-priv static enum | PrivateMaxEntriesMap.DrainStatus
The draining status of the buffers. |
| pack-priv class | PrivateMaxEntriesMap.EntryIterator
An adapter to safely externalize the entry iterator. |
| pack-priv class | PrivateMaxEntriesMap.EntrySet
An adapter to safely externalize the entries. |
| pack-priv class | PrivateMaxEntriesMap.KeyIterator
An adapter to safely externalize the key iterator. |
| pack-priv class | PrivateMaxEntriesMap.KeySet
An adapter to safely externalize the keys. |
| pack-priv static class | PrivateMaxEntriesMap.Node<K, V>
A node contains the key, the weighted value, and the linkage pointers on the page-replacement algorithm's data structures. |
| pack-priv class | PrivateMaxEntriesMap.RemovalTask
Removes a node from the page replacement policy. |
| pack-priv static class | |
| pack-priv class | PrivateMaxEntriesMap.UpdateTask
Updates the weighted size and evicts an entry on overflow. |
| pack-priv class | PrivateMaxEntriesMap.ValueIterator
An adapter to safely externalize the value iterator. |
| pack-priv class | PrivateMaxEntriesMap.Values
An adapter to safely externalize the values. |
| pack-priv static class | |
| pack-priv class | PrivateMaxEntriesMap.WriteThroughEntry
An entry that allows updates to write through to the map. |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final AtomicLong | |
| pack-priv final int | |
| pack-priv final ConcurrentMap | |
| pack-priv final AtomicReference | |
| pack-priv transient Set | |
| pack-priv final LinkedDeque | |
| pack-priv final Lock | |
| pack-priv transient Set | |
| pack-priv static final long | MAXIMUM_CAPACITY
The maximum capacity of the map. |
| pack-priv static final int | NCPU
The number of CPUs |
| pack-priv static final int | NUMBER_OF_READ_BUFFERS
The number of read buffers to use. |
| pack-priv static final int | READ_BUFFER_DRAIN_THRESHOLD
The maximum number of read operations to perform per amortized drain. |
| pack-priv static final int | READ_BUFFER_INDEX_MASK
Mask value for indexing into the read buffer. |
| pack-priv static final int | READ_BUFFER_SIZE
The maximum number of pending reads per buffer. |
| pack-priv static final int | READ_BUFFER_THRESHOLD
The number of pending read operations before attempting to drain. |
| pack-priv static final int | READ_BUFFERS_MASK
Mask value for indexing into the read buffers. |
| pack-priv final AtomicLongArray | |
| pack-priv final long[] | |
| pack-priv final AtomicReferenceArray | |
| pack-priv final AtomicLongArray | |
| pack-priv static final long | |
| pack-priv transient Collection | |
| pack-priv final AtomicLong | |
| pack-priv static final int | WRITE_BUFFER_DRAIN_THRESHOLD
The maximum number of write operations to perform per amortized drain. |
| pack-priv final Queue |
| Access | Constructor and Description |
|---|---|
| pack-priv | PrivateMaxEntriesMap(PrivateMaxEntriesMap.
Creates an instance based on the builder's configuration. |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv void | afterRead(PrivateMaxEntriesMap.
the entry in the page replacement policy nodePerforms the post-processing work required after a read. |
| pack-priv void | afterWrite(Runnable
the pending operation to be applied task)Performs the post-processing work required after a write. |
| pack-priv void | applyRead(PrivateMaxEntriesMap.
Updates the node's location in the page replacement policy. |
| public long | |
| pack-priv static int | |
| pack-priv static void | |
| pack-priv static void | |
| pack-priv static void | |
| public void | clear()
Overrides java. Implements java. |
| public boolean | containsKey(Object
key whose presence in this map is to be tested key)Overrides java. Implements java. true if this map contains a mapping for the specified
key.
|
| public boolean | containsValue(Object
value whose presence in this map is to be tested value)Overrides java. Implements java. true if this map maps one or more keys to the
specified value.
|
| pack-priv void | |
| pack-priv void | drainOnReadIfNeeded(int
the index to the chosen read buffer bufferIndex, long the number of writes on the chosen read buffer writeCount)Attempts to drain the buffers if it is determined to be needed when post-processing a read. |
| pack-priv void | |
| pack-priv void | |
| pack-priv void | |
| public Set | entrySet()
Implements abstract java. Implements java. Set view of the mappings contained in this map.
|
| pack-priv void | evict()
Evicts entries from the map while it exceeds the capacity and appends evicted entries to the notification queue for processing. |
| public V | get(Object
the key whose associated value is to be returned key)Overrides java. Implements java. null if this map contains no mapping for the key.
|
| pack-priv boolean | |
| public boolean | isEmpty()
Overrides java. Implements java. true if this map contains no key-value mappings.
|
| public Set | keySet()
Overrides java. Implements java. Set view of the keys contained in this map.
|
| pack-priv void | makeDead(PrivateMaxEntriesMap.
the entry in the page replacement policy nodeAtomically transitions the node to the dead state and decrements the weightedSize. |
| pack-priv void | makeRetired(PrivateMaxEntriesMap.
the entry in the page replacement policy nodeAtomically transitions the node from the alive state to the retired state, if a valid transition. |
| public V | put(K
key with which the specified value is to be associated key, V value to be associated with the specified key value)Overrides java. Implements java. |
| pack-priv V | Returns: the prior value in the data store or null if no mapping was foundkey with which the specified value is to be associated key, V value to be associated with the specified key value, boolean a write is performed only if the key is not already
associated with a value onlyIfAbsent)Adds a node to the list and the data store. |
| public V | putIfAbsent(K
key with which the specified value is to be associated key, V value to be associated with the specified key value)Overrides default java. Implements java. |
| private static int | |
| pack-priv static int | |
| private void | |
| pack-priv long | Returns: the number of writes on the chosen read bufferthe index to the chosen read buffer bufferIndex, PrivateMaxEntriesMap.the entry in the page replacement policy nodeRecords a read in the buffer and return its write count. |
| public V | remove(Object
key whose mapping is to be removed from the map key)Overrides java. Implements java. |
| public boolean | remove(Object
key with which the specified value is associated key, Object value expected to be associated with the specified key value)Overrides default java. Implements java. |
| public V | replace(K
key with which the specified value is associated key, V value to be associated with the specified key value)Overrides default java. Implements java. |
| public boolean | replace(K
key with which the specified value is associated key, V value expected to be associated with the specified key oldValue, V value to be associated with the specified key newValue)Overrides default java. Implements java. |
| public void | setCapacity(long
the maximum capacity of the map capacity)Sets the maximum capacity of the map and eagerly evicts entries until it shrinks to the appropriate size. |
| public int | size()
Overrides java. Implements java. |
| pack-priv void | tryToDrainBuffers()
Attempts to acquire the eviction lock and apply the pending operations, up to the amortized threshold, to the page replacement policy. |
| pack-priv boolean | Returns: if successfulthe entry in the page replacement policy node,the expected weighted value expectAttempts to transition the node from the alive state to the retired state. |
| public Collection | values()
Overrides java. Implements java. Collection view of the values contained in this map.
|
| pack-priv Object |