org.qi4j.cache.ehcache
Class EhCachePoolMixin

java.lang.Object
  extended by org.qi4j.cache.ehcache.EhCachePoolMixin
All Implemented Interfaces:
Activatable, CachePool

public class EhCachePoolMixin
extends Object
implements CachePool, Activatable


Constructor Summary
EhCachePoolMixin()
           
 
Method Summary
 void activate()
          This is invoked on the service when the instance is being activated
<T> Cache<T>
fetchCache(String cacheId, Class<T> valueType)
          Fethces a cache from the pool.
 void passivate()
          This is invoked on the service when the instance is being passivated
 void returnCache(Cache cache)
          Returns the cache back to the pool.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EhCachePoolMixin

public EhCachePoolMixin()
Method Detail

fetchCache

public <T> Cache<T> fetchCache(String cacheId,
                               Class<T> valueType)
Description copied from interface: CachePool
Fethces a cache from the pool. If the cache does not exist alread, then a new Cache should be created and returned. For each fetchCache() call, a reference count on the Cache must be increased.

Specified by:
fetchCache in interface CachePool
Parameters:
cacheId - The identity of the cache. If the same id is given as a previous fetch, the same cache will be returned.
Returns:

returnCache

public void returnCache(Cache cache)
Description copied from interface: CachePool
Returns the cache back to the pool. The reference count for the cache must then be decreased and if the count reaches zero, the Cache should be destroyed and cleared from memory.

Specified by:
returnCache in interface CachePool
Parameters:
cache - The cache to return to the pool.

activate

public void activate()
              throws Exception
Description copied from interface: Activatable
This is invoked on the service when the instance is being activated

Specified by:
activate in interface Activatable
Throws:
Exception - if service could not be activated

passivate

public void passivate()
               throws Exception
Description copied from interface: Activatable
This is invoked on the service when the instance is being passivated

Specified by:
passivate in interface Activatable
Throws:
Exception - if the service could not be passivated