Interface for a Map type that provides additional atomic putIfAbsent, remove, and replace methods alongside the already available Map interface. More...
#include <src/main/decaf/util/concurrent/ConcurrentMap.h>

Public Member Functions | |
| virtual | ~ConcurrentMap () |
| virtual bool | putIfAbsent (const K &key, const V &value)=0 |
| If the specified key is not already associated with a value, associate it with the given value. | |
| virtual bool | remove (const K &key, const V &value)=0 |
| Remove entry for key only if currently mapped to given value. | |
| virtual bool | replace (const K &key, const V &oldValue, const V &newValue)=0 |
| Replace entry for key only if currently mapped to given value. | |
| virtual V | replace (const K &key, const V &value)=0 |
| Replace entry for key only if currently mapped to some value. | |
Interface for a Map type that provides additional atomic putIfAbsent, remove, and replace methods alongside the already available Map interface.
| virtual decaf::util::concurrent::ConcurrentMap< K, V >::~ConcurrentMap | ( | ) | [inline, virtual] |
| virtual bool decaf::util::concurrent::ConcurrentMap< K, V >::putIfAbsent | ( | const K & | key, | |
| const V & | value | |||
| ) | [pure virtual] |
If the specified key is not already associated with a value, associate it with the given value.
This is equivalent to
if( !map.containsKey( key ) ) {
map.put( key, value );
return true;
} else {
return false;
}
except that the action is performed atomically.
| key | The key to map the value to. | |
| value | The value to map to the given key. |
| UnsupportedOperationException | if the put operation is not supported by this map |
Implemented in decaf::util::concurrent::ConcurrentStlMap< K, V, COMPARATOR >, decaf::util::concurrent::ConcurrentStlMap< Pointer< ConsumerId >, Pointer< ConsumerState >, ConsumerId::COMPARATOR >, decaf::util::concurrent::ConcurrentStlMap< Pointer< SessionId >, Pointer< SessionState >, SessionId::COMPARATOR >, decaf::util::concurrent::ConcurrentStlMap< Pointer< LocalTransactionId >, Pointer< TransactionState >, LocalTransactionId::COMPARATOR >, and decaf::util::concurrent::ConcurrentStlMap< Pointer< ProducerId >, Pointer< ProducerState >, ProducerId::COMPARATOR >.
| virtual bool decaf::util::concurrent::ConcurrentMap< K, V >::remove | ( | const K & | key, | |
| const V & | value | |||
| ) | [pure virtual] |
Remove entry for key only if currently mapped to given value.
Acts as
if( ( map.containsKey( key ) && ( map.get( key ) == value ) ) ) {
map.remove( key );
return true;
} else {
return false;
}
except that the action is performed atomically.
| key | key with which the specified value is associated. | |
| value | value associated with the specified key. |
Implemented in decaf::util::concurrent::ConcurrentStlMap< K, V, COMPARATOR >, decaf::util::concurrent::ConcurrentStlMap< Pointer< ConsumerId >, Pointer< ConsumerState >, ConsumerId::COMPARATOR >, decaf::util::concurrent::ConcurrentStlMap< Pointer< SessionId >, Pointer< SessionState >, SessionId::COMPARATOR >, decaf::util::concurrent::ConcurrentStlMap< Pointer< LocalTransactionId >, Pointer< TransactionState >, LocalTransactionId::COMPARATOR >, and decaf::util::concurrent::ConcurrentStlMap< Pointer< ProducerId >, Pointer< ProducerState >, ProducerId::COMPARATOR >.
| virtual V decaf::util::concurrent::ConcurrentMap< K, V >::replace | ( | const K & | key, | |
| const V & | value | |||
| ) | [pure virtual] |
Replace entry for key only if currently mapped to some value.
Acts as
if( ( map.containsKey( key ) ) {
return map.put( key, value );
} else {
throw NoSuchElementException(...);
};
except that the action is performed atomically.
| key | key with which the specified value is associated. | |
| value | value to be associated with the specified key. |
| NoSuchElementException | if there was no previous mapping. |
Implemented in decaf::util::concurrent::ConcurrentStlMap< K, V, COMPARATOR >, decaf::util::concurrent::ConcurrentStlMap< Pointer< ConsumerId >, Pointer< ConsumerState >, ConsumerId::COMPARATOR >, decaf::util::concurrent::ConcurrentStlMap< Pointer< SessionId >, Pointer< SessionState >, SessionId::COMPARATOR >, decaf::util::concurrent::ConcurrentStlMap< Pointer< LocalTransactionId >, Pointer< TransactionState >, LocalTransactionId::COMPARATOR >, and decaf::util::concurrent::ConcurrentStlMap< Pointer< ProducerId >, Pointer< ProducerState >, ProducerId::COMPARATOR >.
| virtual bool decaf::util::concurrent::ConcurrentMap< K, V >::replace | ( | const K & | key, | |
| const V & | oldValue, | |||
| const V & | newValue | |||
| ) | [pure virtual] |
Replace entry for key only if currently mapped to given value.
Acts as
if( ( map.containsKey( key ) && ( map.get( key ) == oldValue ) ) {
map.put( key, newValue );
return true;
} else {
return false;
}
except that the action is performed atomically.
| key | key with which the specified value is associated. | |
| oldValue | value expected to be associated with the specified key. | |
| newValue | value to be associated with the specified key. |
Implemented in decaf::util::concurrent::ConcurrentStlMap< K, V, COMPARATOR >, decaf::util::concurrent::ConcurrentStlMap< Pointer< ConsumerId >, Pointer< ConsumerState >, ConsumerId::COMPARATOR >, decaf::util::concurrent::ConcurrentStlMap< Pointer< SessionId >, Pointer< SessionState >, SessionId::COMPARATOR >, decaf::util::concurrent::ConcurrentStlMap< Pointer< LocalTransactionId >, Pointer< TransactionState >, LocalTransactionId::COMPARATOR >, and decaf::util::concurrent::ConcurrentStlMap< Pointer< ProducerId >, Pointer< ProducerState >, ProducerId::COMPARATOR >.
1.6.1