|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.apama.correlator.memstore.AbstractTable com.apama.correlator.memstore.ConcurrentMapAdapter<K,V>
K
- The class used to represent keys. Typically this is String, but could alternatively be an
application-specific class (if a custom converter is supplied).V
- The class used to represent row values. Typically this is RowValue
, but could alternatively be an
application-specific class (if a custom converter is supplied).public class ConcurrentMapAdapter<K,V>
Helper class for implementing the distributed MemoryStore AbstractTable class using an instance of ConcurrentMap, which is exposed by many providers.
Usually the type parameters for this class will be String,RowValue
, but if the distributed data is being
shared with other non-Apama applications it is possible to use any desired Java class for the K and V type
parameters, provided an appropriate converter is supplied when the constructor is invoked.
Drivers may optionally provide support for 'row changed' notifications. See the documentation for
AbstractTable
for further details.
AbstractTable
Constructor Summary | |
---|---|
ConcurrentMapAdapter(java.util.concurrent.ConcurrentMap<K,V> map)
Create a table implementation that handles all accessor methods by calling the supplied map, translating keys and values by casting to/from String (for keys) and RowValue (for row values). |
|
ConcurrentMapAdapter(java.util.concurrent.ConcurrentMap<K,V> map,
RowKeyValueConverter<K,V> converter)
Create a table implementation that handles all accessor methods by calling the supplied map, translating keys and values via the supplied converter. |
Method Summary | |
---|---|
void |
clear()
Removes all of the mappings from this map (optional operation). |
boolean |
containsKey(java.lang.String key)
Returns true if this map contains a mapping for the specified key. |
RowValue |
get(java.lang.String key)
Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key. |
java.util.Iterator<java.util.Map.Entry<java.lang.String,RowValue>> |
iterator()
Returns an iterator over all the rows of this table. |
RowValue |
putIfAbsent(java.lang.String key,
RowValue value)
If the specified key is not already associated with a value, associates it with the given value. |
RowValue |
remove(java.lang.String key)
Removes the mapping for a key from this map if it is present. |
boolean |
remove(java.lang.String key,
RowValue value)
Removes the entry for a key only if currently mapped to a given value. |
boolean |
replace(java.lang.String key,
RowValue oldValue,
RowValue newValue)
Replaces the entry for a key only if it is currently mapped to a given value. |
int |
size()
Returns the number of key-value mappings in this map. |
java.lang.String |
toString()
|
Methods inherited from class com.apama.correlator.memstore.AbstractTable |
---|
close, getRowChangedSubscriptionManager |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ConcurrentMapAdapter(java.util.concurrent.ConcurrentMap<K,V> map, RowKeyValueConverter<K,V> converter)
map
- the map this class will be adapting topublic ConcurrentMapAdapter(java.util.concurrent.ConcurrentMap<K,V> map)
Do not use this constructor overload if the map may contain keys and values put there by another (non-Apama) application, using some custom class other than RowValue to represent the values in the map (or a class other than String to represent the keys).
map
- the map this class will be adapting toMethod Detail |
---|
public RowValue get(java.lang.String key)
AbstractTable
null
if this map contains no mapping for the key.
get
in class AbstractTable
key
- the key whose associated value is to be returned
null
if this map contains no mapping for the keypublic void clear()
AbstractTable
clear
in class AbstractTable
public RowValue remove(java.lang.String key)
AbstractTable
(key==null ? k==null : key.equals(k))
, that mapping
is removed. (The map can contain at most one such mapping.)
Returns the value to which this map previously associated the key, or null if the map contained no mapping for the key.
remove
in class AbstractTable
key
- key whose mapping is to be removed from the map
public boolean remove(java.lang.String key, RowValue value)
AbstractTable
remove
in class AbstractTable
key
- key with which the specified value is associatedvalue
- value expected to be associated with the specified key
public boolean replace(java.lang.String key, RowValue oldValue, RowValue newValue)
AbstractTable
replace
in class AbstractTable
key
- key with which the specified value is associatedoldValue
- value expected to be associated with the specified keynewValue
- value to be associated with the specified key
public RowValue putIfAbsent(java.lang.String key, RowValue value)
AbstractTable
putIfAbsent
in class AbstractTable
key
- key with which the specified value is to be associatedvalue
- value to be associated with the specified key
public boolean containsKey(java.lang.String key)
AbstractTable
containsKey
in class AbstractTable
key
- key whose presence in this map is to be tested
public int size()
AbstractTable
size
in class AbstractTable
public java.util.Iterator<java.util.Map.Entry<java.lang.String,RowValue>> iterator()
AbstractTable
Note: a simple way to construct a Map.Entry is to use the AbstractMap.SimpleEntry class.
iterator
in interface java.lang.Iterable<java.util.Map.Entry<java.lang.String,RowValue>>
iterator
in class AbstractTable
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |