Package org.glassfish.grizzly
Class ThreadCache
- java.lang.Object
-
- org.glassfish.grizzly.ThreadCache
-
public final class ThreadCache extends Object
- Author:
- oleksiys
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classThreadCache.CachedTypeIndex<E>static classThreadCache.ObjectCachestatic classThreadCache.ObjectCacheElement
-
Constructor Summary
Constructors Constructor Description ThreadCache()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <E> EgetFromCache(Thread currentThread, ThreadCache.CachedTypeIndex<E> index)Get the cached object with the given type index from cache.static <E> EgetFromCache(ThreadCache.CachedTypeIndex<E> index)Get the cached object with the given type index from cache.static <E> ThreadCache.CachedTypeIndex<E>obtainIndex(Class<E> clazz, int size)static <E> ThreadCache.CachedTypeIndex<E>obtainIndex(String name, Class<E> clazz, int size)static <E> booleanputToCache(Thread currentThread, ThreadCache.CachedTypeIndex<E> index, E o)static <E> booleanputToCache(ThreadCache.CachedTypeIndex<E> index, E o)static <E> EtakeFromCache(Thread currentThread, ThreadCache.CachedTypeIndex<E> index)Take the cached object with the given type index from cache.static <E> EtakeFromCache(ThreadCache.CachedTypeIndex<E> index)Take the cached object with the given type index from cache.
-
-
-
Method Detail
-
obtainIndex
public static <E> ThreadCache.CachedTypeIndex<E> obtainIndex(Class<E> clazz, int size)
-
obtainIndex
public static <E> ThreadCache.CachedTypeIndex<E> obtainIndex(String name, Class<E> clazz, int size)
-
putToCache
public static <E> boolean putToCache(ThreadCache.CachedTypeIndex<E> index, E o)
-
putToCache
public static <E> boolean putToCache(Thread currentThread, ThreadCache.CachedTypeIndex<E> index, E o)
-
getFromCache
public static <E> E getFromCache(ThreadCache.CachedTypeIndex<E> index)
Get the cached object with the given type index from cache. UnliketakeFromCache(org.glassfish.grizzly.ThreadCache.CachedTypeIndex), the object won't be removed from cache.- Type Parameters:
E- cached object type- Parameters:
index- the cached object type index.- Returns:
- cached object.
-
getFromCache
public static <E> E getFromCache(Thread currentThread, ThreadCache.CachedTypeIndex<E> index)
Get the cached object with the given type index from cache. UnliketakeFromCache(org.glassfish.grizzly.ThreadCache.CachedTypeIndex), the object won't be removed from cache.- Type Parameters:
E- cached object type- Parameters:
currentThread- currentThreadindex- the cached object type index.- Returns:
- cached object.
-
takeFromCache
public static <E> E takeFromCache(ThreadCache.CachedTypeIndex<E> index)
Take the cached object with the given type index from cache. UnlikegetFromCache(org.glassfish.grizzly.ThreadCache.CachedTypeIndex), the object will be removed from cache.- Type Parameters:
E- cached object type- Parameters:
index- the cached object type index- Returns:
- cached object
-
takeFromCache
public static <E> E takeFromCache(Thread currentThread, ThreadCache.CachedTypeIndex<E> index)
Take the cached object with the given type index from cache. UnlikegetFromCache(org.glassfish.grizzly.ThreadCache.CachedTypeIndex), the object will be removed from cache.- Type Parameters:
E- cached object type- Parameters:
currentThread- currentThreadindex- the cached object type index- Returns:
- cached object
-
-