#include <coherence/util/ConcurrentMap.hpp>
Inherits Map.
Inherited by NamedCache [virtual]
, and ConverterCollections::ConverterConcurrentMap [virtual]
.
Public Types | |
typedef spec::Handle | Handle |
ConcurrentMap Handle definition. | |
typedef spec::View | View |
ConcurrentMap View definition. | |
typedef spec::Holder | Holder |
ConcurrentMap Holder definition. | |
typedef this_spec::Handle | Handle |
Map Handle definition. | |
typedef this_spec::View | View |
Map View definition. | |
typedef this_spec::Holder | Holder |
Map Holder definition. | |
Public Member Functions | |
virtual bool | lock (Object::View vKey, int64_t cWait) const =0 |
Attempt to lock the specified item within the specified period of time. | |
virtual bool | lock (Object::View vKey) const =0 |
Attempt to lock the specified item and return immediately. | |
virtual bool | unlock (Object::View vKey) const =0 |
Unlock the specified item. | |
Static Public Member Functions | |
static Object::View | getLockAll () |
Special key value indicating an intent to lock the entire map. | |
Classes | |
class | LockBlock |
The LockBlock allows for easy creation of ConcurrentMap::lock code. More... |
virtual bool lock | ( | Object::View | vKey, | |
int64_t | cWait | |||
) | const [pure virtual] |
Attempt to lock the specified item within the specified period of time.
The item doesn't have to exist to be locked. While the item is locked there is known to be a lock holder which has an exclusive right to modify (calling put and remove methods) that item.
Lock holder is an abstract concept that depends on the ConcurrentMap implementation. For example, holder could be a process or a thread (or both).
Locking strategy may vary for concrete implementations as well. Lock could have an expiration time (this lock is sometimes called a "lease") or be held indefinitely (until the lock holder terminates).
Some implementations may allow the entire map to be locked. If the map is locked in such a way, then only a lock holder is allowed to perform any of the "put" or "remove" operations. Pass the special constant getLockAll() as the vKey parameter to indicate the map lock.
vKey | key being locked | |
cWait | the number of milliseconds to continue trying to obtain a lock; pass zero to return immediately; pass -1 to block the calling thread until the lock could be obtained |
Implemented in ContinuousQueryCache, NearCache, WrapperNamedCache, ConverterCollections::ConverterConcurrentMap, and ConverterCollections::ConverterNamedCache.
virtual bool lock | ( | Object::View | vKey | ) | const [pure virtual] |
Attempt to lock the specified item and return immediately.
This method behaves exactly as if it simply performs the call lock(vKey, 0)
.
vKey | key being locked |
Implemented in ContinuousQueryCache, NearCache, WrapperNamedCache, ConverterCollections::ConverterConcurrentMap, and ConverterCollections::ConverterNamedCache.
virtual bool unlock | ( | Object::View | vKey | ) | const [pure virtual] |
Unlock the specified item.
The item doesn't have to exist to be unlocked. If the item is currently locked, only the holder of the lock could successfully unlock it.
vKey | key being unlocked |
Implemented in ContinuousQueryCache, NearCache, WrapperNamedCache, ConverterCollections::ConverterConcurrentMap, and ConverterCollections::ConverterNamedCache.