org.glassfish.grizzly
Class ThreadCache

java.lang.Object
  extended by org.glassfish.grizzly.ThreadCache

public final class ThreadCache
extends java.lang.Object

Author:
oleksiys

Nested Class Summary
static class ThreadCache.CachedTypeIndex<E>
           
static class ThreadCache.ObjectCache
           
static class ThreadCache.ObjectCacheElement
           
 
Constructor Summary
ThreadCache()
           
 
Method Summary
static
<E> E
getFromCache(ThreadCache.CachedTypeIndex<E> index)
          Get the cached object with the given type index from cache.
static
<E> ThreadCache.CachedTypeIndex<E>
obtainIndex(java.lang.Class<E> clazz, int size)
           
static
<E> ThreadCache.CachedTypeIndex<E>
obtainIndex(java.lang.String name, java.lang.Class<E> clazz, int size)
           
static
<E> boolean
putToCache(ThreadCache.CachedTypeIndex<E> index, E o)
           
static
<E> E
takeFromCache(ThreadCache.CachedTypeIndex<E> index)
          Take the cached object with the given type index from cache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ThreadCache

public ThreadCache()
Method Detail

obtainIndex

public static <E> ThreadCache.CachedTypeIndex<E> obtainIndex(java.lang.Class<E> clazz,
                                                             int size)

obtainIndex

public static <E> ThreadCache.CachedTypeIndex<E> obtainIndex(java.lang.String name,
                                                             java.lang.Class<E> clazz,
                                                             int size)

putToCache

public static <E> boolean putToCache(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. Unlike takeFromCache(org.glassfish.grizzly.ThreadCache.CachedTypeIndex), the object won't be removed from cache.

Type Parameters:
E -
Parameters:
index - 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. Unlike getFromCache(org.glassfish.grizzly.ThreadCache.CachedTypeIndex), the object will be removed from cache.

Type Parameters:
E -
Parameters:
index - the cached object type index.
Returns:
cached object.


Copyright © 2011 Oracle Corpration. All Rights Reserved.