org.jboss.ejb.plugins
Class EntityInstanceCache

java.lang.Object
  extended byorg.jboss.ejb.plugins.AbstractInstanceCache (src) 
      extended byorg.jboss.ejb.plugins.EntityInstanceCache
All Implemented Interfaces:
AllowedOperationsFlags (src) , ContainerPlugin (src) , EntityCache (src) , InstanceCache (src) , MetricsConstants (src) , Monitorable (src) , Service (src) , XmlLoadable (src)
Direct Known Subclasses:
ClusterSyncEntityInstanceCache (src) , InvalidableEntityInstanceCache (src)

public class EntityInstanceCache
extends AbstractInstanceCache (src)
implements EntityCache (src)

Cache subclass for entity beans.


Field Summary
 
Fields inherited from class org.jboss.ejb.plugins.AbstractInstanceCache (src)
log
 
Fields inherited from interface org.jboss.ejb.AllowedOperationsFlags (src)
IN_AFTER_BEGIN, IN_AFTER_COMPLETION, IN_BEFORE_COMPLETION, IN_BUSINESS_METHOD, IN_EJB_ACTIVATE, IN_EJB_CREATE, IN_EJB_FIND, IN_EJB_HOME, IN_EJB_LOAD, IN_EJB_PASSIVATE, IN_EJB_POST_CREATE, IN_EJB_REMOVE, IN_EJB_STORE, IN_EJB_TIMEOUT, IN_INTERCEPTOR_METHOD, IN_SERVICE_ENDPOINT_METHOD, IN_SET_ENTITY_CONTEXT, IN_SET_MESSAGE_DRIVEN_CONTEXT, IN_SET_SESSION_CONTEXT, IN_UNSET_ENTITY_CONTEXT, NOT_ALLOWED
 
Fields inherited from interface org.jboss.monitor.MetricsConstants (src)
ACTIVITY, APPLICATION, BEAN, BEANCACHE_METRICS, CHECKPOINT, INVOCATION_METRICS, MEMORY_MONITOR, METHOD, PRIMARY_KEY, SYSTEM_METRICS, THREAD_MONITOR, TIME, TYPE
 
Constructor Summary
EntityInstanceCache()
           
 
Method Summary
protected  EnterpriseContext (src) acquireContext()
          Acquires an EnterpriseContext from the pool
protected  void activate(EnterpriseContext (src)  ctx)
          Activates the given EnterpriseContext
protected  boolean canPassivate(EnterpriseContext (src)  ctx)
          Returns whether the given context can be passivated or not
 java.lang.Object createCacheKey(java.lang.Object id)
          Returns the key used to cache the context
 void destroy()
          destroy the service, tear down
protected  void freeContext(EnterpriseContext (src)  ctx)
          Frees the given EnterpriseContext to the pool
 EnterpriseContext (src) get(java.lang.Object id)
          Gets a bean instance from this cache given the identity.
protected  Container (src) getContainer()
          Returns the container for this cache.
protected  java.lang.Object getKey(EnterpriseContext (src)  ctx)
          Returns the key used by the cache to map the given context
protected  void passivate(EnterpriseContext (src)  ctx)
          Passivates the given EnterpriseContext
 void remove(java.lang.String id)
           
 void setContainer(Container (src)  c)
          This callback is set by the container so that the plugin may access it
protected  void setKey(java.lang.Object id, EnterpriseContext (src)  ctx)
          Sets the given id as key for the given context
 
Methods inherited from class org.jboss.ejb.plugins.AbstractInstanceCache (src)
create, doActivate, flush, getCache, getCacheLock, getCachePolicyString, getCacheSize, getPassivatedCount, importXml, insert, isActive, logActivation, logPassivation, release, remove, resetStatistic, retrieveStatistic, sample, start, stop, tryToPassivate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jboss.ejb.InstanceCache (src)
flush, getCacheSize, insert, isActive, release, remove
 
Methods inherited from interface org.jboss.system.Service (src)
create, start, stop
 

Constructor Detail

EntityInstanceCache

public EntityInstanceCache()
Method Detail

setContainer

public void setContainer(Container (src)  c)
Description copied from interface: ContainerPlugin (src)
This callback is set by the container so that the plugin may access it

Specified by:
setContainer in interface ContainerPlugin (src)
Parameters:
c - The container using this plugin. This may be null if the plugin is being disassociated from a container.

createCacheKey

public java.lang.Object createCacheKey(java.lang.Object id)
Description copied from interface: EntityCache (src)
Returns the key used to cache the context

Specified by:
createCacheKey in interface EntityCache (src)
Parameters:
id - Object id / primary key
Returns:
Cache key

get

public EnterpriseContext (src)  get(java.lang.Object id)
                      throws java.rmi.RemoteException,
                             java.rmi.NoSuchObjectException
Description copied from interface: InstanceCache (src)
Gets a bean instance from this cache given the identity. This method may involve activation if the instance is not in the cache.

Implementation should have O(1) complexity.

This method is never called for stateless session beans.

Specified by:
get in interface InstanceCache (src)
Overrides:
get in class AbstractInstanceCache (src)
Throws:
java.rmi.RemoteException
java.rmi.NoSuchObjectException

remove

public void remove(java.lang.String id)
            throws java.lang.Exception
Throws:
java.lang.Exception

destroy

public void destroy()
Description copied from interface: Service (src)
destroy the service, tear down

Specified by:
destroy in interface Service (src)
Overrides:
destroy in class AbstractInstanceCache (src)

getKey

protected java.lang.Object getKey(EnterpriseContext (src)  ctx)
Description copied from class: AbstractInstanceCache (src)
Returns the key used by the cache to map the given context

Specified by:
getKey in class AbstractInstanceCache (src)

setKey

protected void setKey(java.lang.Object id,
                      EnterpriseContext (src)  ctx)
Description copied from class: AbstractInstanceCache (src)
Sets the given id as key for the given context

Specified by:
setKey in class AbstractInstanceCache (src)

getContainer

protected Container (src)  getContainer()
Description copied from class: AbstractInstanceCache (src)
Returns the container for this cache.

Specified by:
getContainer in class AbstractInstanceCache (src)

passivate

protected void passivate(EnterpriseContext (src)  ctx)
                  throws java.rmi.RemoteException
Description copied from class: AbstractInstanceCache (src)
Passivates the given EnterpriseContext

Specified by:
passivate in class AbstractInstanceCache (src)
Throws:
java.rmi.RemoteException

activate

protected void activate(EnterpriseContext (src)  ctx)
                 throws java.rmi.RemoteException
Description copied from class: AbstractInstanceCache (src)
Activates the given EnterpriseContext

Specified by:
activate in class AbstractInstanceCache (src)
Throws:
java.rmi.RemoteException

acquireContext

protected EnterpriseContext (src)  acquireContext()
                                    throws java.lang.Exception
Description copied from class: AbstractInstanceCache (src)
Acquires an EnterpriseContext from the pool

Specified by:
acquireContext in class AbstractInstanceCache (src)
Throws:
java.lang.Exception

freeContext

protected void freeContext(EnterpriseContext (src)  ctx)
Description copied from class: AbstractInstanceCache (src)
Frees the given EnterpriseContext to the pool

Specified by:
freeContext in class AbstractInstanceCache (src)

canPassivate

protected boolean canPassivate(EnterpriseContext (src)  ctx)
Description copied from class: AbstractInstanceCache (src)
Returns whether the given context can be passivated or not

Specified by:
canPassivate in class AbstractInstanceCache (src)