|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap.Builder<K,V>
public static final class ConcurrentLinkedHashMap.Builder<K,V>
A builder that creates ConcurrentLinkedHashMap
instances. It
provides a flexible approach for constructing customized instances with
a named parameter syntax. It can be used in the following manner:
ConcurrentMap<Vertices, Set<Edge>> graph = new Builder<Vertices, Set<Edge>>()
.maximumWeightedCapacity(5000)
.weigher(Weighers.<Edge>set())
.build();
Constructor Summary | |
---|---|
ConcurrentLinkedHashMap.Builder()
|
Method Summary | |
---|---|
ConcurrentLinkedHashMap<K,V> |
build()
Creates a new ConcurrentLinkedHashMap instance. |
ConcurrentLinkedHashMap.Builder<K,V> |
catchup(ScheduledExecutorService executor,
long delay,
TimeUnit unit)
Specifies an executor for use in catching up the page replacement policy. |
ConcurrentLinkedHashMap.Builder<K,V> |
concurrencyLevel(int concurrencyLevel)
Specifies the estimated number of concurrently updating threads. |
ConcurrentLinkedHashMap.Builder<K,V> |
initialCapacity(int initialCapacity)
Specifies the initial capacity of the hash table (default 16). |
ConcurrentLinkedHashMap.Builder<K,V> |
listener(EvictionListener<K,V> listener)
Specifies an optional listener that is registered for notification when an entry is evicted. |
ConcurrentLinkedHashMap.Builder<K,V> |
maximumWeightedCapacity(int capacity)
Specifies the maximum weighted capacity to coerce the map to and may exceed it temporarily. |
ConcurrentLinkedHashMap.Builder<K,V> |
weigher(Weigher<? super V> weigher)
Specifies an algorithm to determine how many the units of capacity a value consumes. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ConcurrentLinkedHashMap.Builder()
Method Detail |
---|
public ConcurrentLinkedHashMap.Builder<K,V> initialCapacity(int initialCapacity)
initialCapacity
- the initial capacity used to size the hash table
to accommodate this many entries.
IllegalArgumentException
- if the initialCapacity is negativepublic ConcurrentLinkedHashMap.Builder<K,V> maximumWeightedCapacity(int capacity)
capacity
- the weighted threshold to bound the map by
IllegalArgumentException
- if the maximumWeightedCapacity is
negativepublic ConcurrentLinkedHashMap.Builder<K,V> concurrencyLevel(int concurrencyLevel)
concurrencyLevel
- the estimated number of concurrently updating
threads
IllegalArgumentException
- if the concurrencyLevel is less than or
equal to zeropublic ConcurrentLinkedHashMap.Builder<K,V> listener(EvictionListener<K,V> listener)
listener
- the object to forward evicted entries to
NullPointerException
- if the listener is nullpublic ConcurrentLinkedHashMap.Builder<K,V> weigher(Weigher<? super V> weigher)
weigher
- the algorithm to determine a value's weight
NullPointerException
- if the weigher is nullpublic ConcurrentLinkedHashMap.Builder<K,V> catchup(ScheduledExecutorService executor, long delay, TimeUnit unit)
If unspecified or the executor is shutdown, the catching up will be amortized on user threads during write operations (or during read operations, in the absence of writes).
A single-threaded ScheduledExecutorService
should be sufficient
for catching up the page replacement policy in many maps.
executor
- the executor to schedule ondelay
- the delay between executionsunit
- the time unit of the delay parameter
NullPointerException
- if the executor or time unit is null
IllegalArgumentException
- if the delay is less than or equal to
zeropublic ConcurrentLinkedHashMap<K,V> build()
ConcurrentLinkedHashMap
instance.
IllegalStateException
- if the maximum weighted capacity was
not set
RejectedExecutionException
- if an executor was specified and the
catch-up task cannot be scheduled for execution
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |