org.jboss.ejb3.cache.impl
Class SimplePassivatingCache<T extends Identifiable & Serializable>

java.lang.Object
  extended by org.jboss.ejb3.cache.impl.SimplePassivatingCache<T>
All Implemented Interfaces:
Cache<T>, PassivatingCache<T>

public class SimplePassivatingCache<T extends Identifiable & Serializable>
extends Object
implements PassivatingCache<T>

Comment

Version:
$Revision: 66008 $
Author:
Carlo de Wolf

Constructor Summary
SimplePassivatingCache(StatefulObjectFactory<T> factory, PassivationManager<T> passivationManager, ObjectStore<T> store)
           
 
Method Summary
protected  org.jboss.ejb3.cache.impl.SimplePassivatingCache.Entry activate(Object key)
          Activate an entry and put it back in the cache.
 T create(Class<?>[] initTypes, Object[] initValues)
          Create a new object.
 T get(Object key)
          Get the specified object from cache.
 void passivate(Object key)
          Force passivation of an object.
 T peek(Object key)
          Peek at an object which might be in use.
 void release(T obj)
          Release the object from use.
protected  void releaseByKey(Object key)
           
 void remove(Object key)
          Remove the specified object from cache.
 void setName(String name)
           
 void setSessionTimeout(int sessionTimeout)
           
 void start()
          Start the cache.
 void stop()
          Stop the cache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimplePassivatingCache

public SimplePassivatingCache(StatefulObjectFactory<T> factory,
                              PassivationManager<T> passivationManager,
                              ObjectStore<T> store)
Method Detail

activate

protected org.jboss.ejb3.cache.impl.SimplePassivatingCache.Entry activate(Object key)
Activate an entry and put it back in the cache. This method is not thread safe.

Parameters:
key - the indentifier of the object
Returns:
the entry or null if not found

create

public T create(Class<?>[] initTypes,
                Object[] initValues)
Description copied from interface: Cache
Create a new object.

Specified by:
create in interface Cache<T extends Identifiable & Serializable>
Returns:

get

public T get(Object key)
                                         throws javax.ejb.NoSuchEJBException
Description copied from interface: Cache
Get the specified object from cache. This will mark the object as being in use.

Specified by:
get in interface Cache<T extends Identifiable & Serializable>
Parameters:
key - the identifier of the object
Returns:
the object
Throws:
javax.ejb.NoSuchEJBException - if the object does not exist

passivate

public void passivate(Object key)
Description copied from interface: PassivatingCache
Force passivation of an object. The object must not be in use.

Specified by:
passivate in interface PassivatingCache<T extends Identifiable & Serializable>
Parameters:
key - the identifier of the object

peek

public T peek(Object key)
                                          throws javax.ejb.NoSuchEJBException
Description copied from interface: Cache
Peek at an object which might be in use.

Specified by:
peek in interface Cache<T extends Identifiable & Serializable>
Parameters:
key - the identifier of the object
Returns:
the object
Throws:
javax.ejb.NoSuchEJBException - if the object does not exist

release

public void release(T obj)
Description copied from interface: Cache
Release the object from use.

Specified by:
release in interface Cache<T extends Identifiable & Serializable>
Parameters:
obj - the object

releaseByKey

protected void releaseByKey(Object key)

remove

public void remove(Object key)
Description copied from interface: Cache
Remove the specified object from cache.

Specified by:
remove in interface Cache<T extends Identifiable & Serializable>
Parameters:
key - the identifier of the object

setName

public void setName(String name)

setSessionTimeout

public void setSessionTimeout(int sessionTimeout)

start

public void start()
Description copied from interface: Cache
Start the cache.

Specified by:
start in interface Cache<T extends Identifiable & Serializable>

stop

public void stop()
Description copied from interface: Cache
Stop the cache.

Specified by:
stop in interface Cache<T extends Identifiable & Serializable>


Copyright © 2011 JBoss, a division of Red Hat, Inc.. All Rights Reserved.