Interface SharedMap<K,V>
- All Superinterfaces:
Map<K,
V>
- All Known Implementing Classes:
HttpServletContextMap
,HttpSessionMap
,SharedMapDecorator
A simple subinterface of
Map
that exposes a mutex that application code can synchronize on.
Expected to be implemented by Maps that are backed by shared objects that require synchronization between multiple threads. An example would be the HTTP session map.
- Author:
- Keith Donald
-
Nested Class Summary
-
Method Summary
Methods inherited from interface java.util.Map
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
-
Method Details
-
getMutex
Object getMutex()Returns the shared mutex that may be synchronized on using a synchronized block. The returned mutex is guaranteed to be non-null. Example usage:synchronized (sharedMap.getMutex()) { // do synchronized work }
- Returns:
- the mutex
-