Top Description Fields Constructors Methods
org.codehaus.groovy.util

public Class ManagedConcurrentValueMap<K, V>

extends Object
Class Inheritance
Type Parameters
<K>
the key type
<V>
the value type
Imports
java.util.concurrent.ConcurrentHashMap

This is a basic implementation of a map able to forget its values. This map uses internally a ConcurrentHashMap, thus should be safe for concurrency. hashcode and equals are used to find the entries and should thus be implemented properly for the keys. This map does not support null keys.

Field Summary

Modifier and TypeField and Description
private ReferenceBundle
private final ConcurrentHashMap<K, ManagedReference<V>>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public V

Returns:

the value stored in the map for the given key
get
(K
a non null key
key
)

Returns the value stored for the given key at the point of call.

public void
put(final K
a non null key
key
,
V
the new value
value
)

Sets a new value for a given key.

public void
setBundle(ReferenceBundle
- the ReferenceBundle
bundle
)

Sets a new bundle used for reference creation.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bundleback to summary
private ReferenceBundle bundle
internalMapback to summary
private final ConcurrentHashMap<K, ManagedReference<V>> internalMap

Constructor Detail

ManagedConcurrentValueMapback to summary
public ManagedConcurrentValueMap(ReferenceBundle bundle)

Method Detail

getback to summary
public V get(K key)

Returns the value stored for the given key at the point of call.

Parameters
key:K

a non null key

Returns:V

the value stored in the map for the given key

putback to summary
public void put(final K key, V value)

Sets a new value for a given key. an older value is overwritten.

Parameters
key:K

a non null key

value:V

the new value

setBundleback to summary
public void setBundle(ReferenceBundle bundle)

Sets a new bundle used for reference creation. Be warned that older entries will not be changed by this

Parameters
bundle:ReferenceBundle

- the ReferenceBundle