Package com.identityworksllc.iiq.common
Class ThreadStorage
- java.lang.Object
-
- com.identityworksllc.iiq.common.ThreadStorage
-
- All Implemented Interfaces:
DelegatedConcurrentMap<String,Object>,DelegatedMap<String,Object>,TypeFriendlyMap<String,Object>,ConcurrentMap<String,Object>,Map<String,Object>
public final class ThreadStorage extends Object implements DelegatedConcurrentMap<String,Object>, TypeFriendlyMap<String,Object>
A singleton global object with an internal InheritableThreadLocal, allowing sharing of cached objects within a single thread.Objects will be garbage collected when the thread itself is cleaned up, so this should either not be used or routinely clear()’d in long-running threads.
Since the ThreadLocal is inheritable, child threads will automatically inherit any stored values.
This class exposes the ConcurrentMap interface and can be used as such.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ThreadStorageget()Retrieves the singleton thread storage object, constructing a new one if neededConcurrentMap<String,Object>getDelegate()Retrieves the delegate, in this case the ThreadLocal map-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.concurrent.ConcurrentMap
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, replaceAll
-
Methods inherited from interface com.identityworksllc.iiq.common.DelegatedConcurrentMap
putIfAbsent, remove, replace, replace
-
Methods inherited from interface com.identityworksllc.iiq.common.DelegatedMap
clear, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values
-
Methods inherited from interface com.identityworksllc.iiq.common.TypeFriendlyMap
getAs, getBoolean, getInt, getLong, getSailPointObject, getString, getStringList
-
-
-
-
Method Detail
-
get
public static ThreadStorage get()
Retrieves the singleton thread storage object, constructing a new one if needed- Returns:
- The singleton thread storage object
-
getDelegate
public ConcurrentMap<String,Object> getDelegate()
Retrieves the delegate, in this case the ThreadLocal map- Specified by:
getDelegatein interfaceDelegatedConcurrentMap<String,Object>- Specified by:
getDelegatein interfaceDelegatedMap<String,Object>- Returns:
- The delegated map object
-
-