org.apache.openejb.core.stateful
Class SimpleCache<K,V>

java.lang.Object
  extended by org.apache.openejb.core.stateful.SimpleCache<K,V>
All Implemented Interfaces:
Cache<K,V>

public class SimpleCache<K,V>
extends Object
implements Cache<K,V>


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.openejb.core.stateful.Cache
Cache.CacheFilter<V>, Cache.CacheListener<V>
 
Field Summary
static Logger logger
           
 
Constructor Summary
SimpleCache()
           
SimpleCache(Cache.CacheListener<V> listener, PassivationStrategy passivator, int capacity, int bulkPassivate, Duration timeOut)
           
 
Method Summary
 void add(K key, V value)
          Add a new entry to the cache.
 void checkIn(K key)
          Marks the entry available, so it can be accessed again.
 V checkOut(K key)
          Marks the entry checked-out, so this entry can not be accessed until checked-in.
 int getBulkPassivate()
           
 int getCapacity()
           
 Cache.CacheListener<V> getListener()
          Gets the listener for cache events.
 PassivationStrategy getPassivator()
           
 long getTimeOut()
           
 void processLRU()
           
 V remove(K key)
          Removes the entry from the cache.
 void removeAll(Cache.CacheFilter<V> filter)
          Removes all of th entries that match the specified filter.
 void setBulkPassivate(int bulkPassivate)
           
 void setCapacity(int capacity)
           
 void setListener(Cache.CacheListener<V> listener)
          Sets the listener for cache events.
 void setPassivator(Class<? extends PassivationStrategy> passivatorClass)
           
 void setPassivator(PassivationStrategy passivator)
           
 void setPoolSize(int capacity)
           
 void setTimeOut(long timeOut)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

public static final Logger logger
Constructor Detail

SimpleCache

public SimpleCache()

SimpleCache

public SimpleCache(Cache.CacheListener<V> listener,
                   PassivationStrategy passivator,
                   int capacity,
                   int bulkPassivate,
                   Duration timeOut)
Method Detail

getListener

public Cache.CacheListener<V> getListener()
Description copied from interface: Cache
Gets the listener for cache events.

Specified by:
getListener in interface Cache<K,V>

setListener

public void setListener(Cache.CacheListener<V> listener)
Description copied from interface: Cache
Sets the listener for cache events. This should be called by the container before using the cache.

Specified by:
setListener in interface Cache<K,V>

getPassivator

public PassivationStrategy getPassivator()

setPassivator

public void setPassivator(PassivationStrategy passivator)

setPassivator

public void setPassivator(Class<? extends PassivationStrategy> passivatorClass)
                   throws Exception
Throws:
Exception

getCapacity

public int getCapacity()

setCapacity

public void setCapacity(int capacity)

setPoolSize

public void setPoolSize(int capacity)

getBulkPassivate

public int getBulkPassivate()

setBulkPassivate

public void setBulkPassivate(int bulkPassivate)

getTimeOut

public long getTimeOut()

setTimeOut

public void setTimeOut(long timeOut)

add

public void add(K key,
                V value)
Description copied from interface: Cache
Add a new entry to the cache. The entry is marked checked-out and can not be accessed again until checked-in.

Specified by:
add in interface Cache<K,V>

checkOut

public V checkOut(K key)
           throws Exception
Description copied from interface: Cache
Marks the entry checked-out, so this entry can not be accessed until checked-in.

Specified by:
checkOut in interface Cache<K,V>
Throws:
IllegalStateException - if the entry is already checked out.
Exception - if an entry is loaded and the afterLoad method threw an exception

checkIn

public void checkIn(K key)
Description copied from interface: Cache
Marks the entry available, so it can be accessed again.

Specified by:
checkIn in interface Cache<K,V>

remove

public V remove(K key)
Description copied from interface: Cache
Removes the entry from the cache.

Specified by:
remove in interface Cache<K,V>

removeAll

public void removeAll(Cache.CacheFilter<V> filter)
Description copied from interface: Cache
Removes all of th entries that match the specified filter.

Specified by:
removeAll in interface Cache<K,V>

processLRU

public void processLRU()


Copyright © 1999-2013 The Apache OpenEJB development community. All Rights Reserved.