Package com.j_spaces.core.cache
Class CacheContextFactory
java.lang.Object
com.j_spaces.core.cache.CacheContextFactory
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose all contexts free and occupied, waits until all Contexts are returned.voidfreeCacheContext(Context ctx) Free a Context acquired by getCacheContext().returns a free Context from the pool.returns the active Context of this thread or null if none
-
Constructor Details
-
CacheContextFactory
-
-
Method Details
-
getCacheContext
returns a free Context from the pool. If none are available, one is allocated on demand. This call *MUST* be followed by a freeCacheContext() in a finally() block!- Returns:
- a free Context object
-
viewCacheContext
returns the active Context of this thread or null if none- Returns:
- an active Context object
-
freeCacheContext
Free a Context acquired by getCacheContext(). If Context was taken from the pool, it will be returned to it. Otherwise, it was allocated on demand, and will be collected by the JVM GC. Make sure to call this method from within a finally block to release any acquired Contexts.- Parameters:
ctx- A Context object in use, and to be freed.
-
closeAllContexts
public void closeAllContexts()close all contexts free and occupied, waits until all Contexts are returned.
-