站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 4.0.1 sp1 server API Documentation 英文版文档

EntityInstanceCache (JBoss Server API) - JBoss 4.0.1 sp1 server API Documentation 英文版文档


org.jboss.ejb.plugins
Class EntityInstanceCache

java.lang.Object
  extended byorg.jboss.ejb.plugins.AbstractInstanceCache
      extended byorg.jboss.ejb.plugins.EntityInstanceCache
All Implemented Interfaces:
AbstractInstanceCacheMBean, AllowedOperationsFlags, ContainerPlugin, EntityCache, EntityInstanceCacheMBean, InstanceCache, MetricsConstants, Monitorable, org.jboss.system.Service, XmlLoadable
Direct Known Subclasses:
InvalidableEntityInstanceCache

public class EntityInstanceCache
extends AbstractInstanceCache
implements EntityCache, EntityInstanceCacheMBean

Cache subclass for entity beans.

Version:
$Revision: 1.23 $
Author:
Simone Bordet, Bill Burke

Field Summary
 
Fields inherited from class org.jboss.ejb.plugins.AbstractInstanceCache
log
 
Fields inherited from interface org.jboss.ejb.AllowedOperationsFlags
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
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 acquireContext()
          Acquires an EnterpriseContext from the pool
protected  void activate(EnterpriseContext ctx)
          Activates the given EnterpriseContext
protected  boolean canPassivate(EnterpriseContext ctx)
          Returns whether the given context can be passivated or not
 Object createCacheKey(Object id)
          Returns the key used to cache the context
 void destroy()
           
protected  void freeContext(EnterpriseContext ctx)
          Frees the given EnterpriseContext to the pool
 EnterpriseContext get(Object id)
          Gets a bean instance from this cache given the identity.
protected  Container getContainer()
          Returns the container for this cache.
protected  Object getKey(EnterpriseContext ctx)
          Returns the key used by the cache to map the given context
protected  void passivate(EnterpriseContext ctx)
          Passivates the given EnterpriseContext
 void remove(String id)
           
 void setContainer(Container c)
          This callback is set by the container so that the plugin may access it
protected  void setKey(Object id, EnterpriseContext ctx)
          Sets the given id as key for the given context
 
Methods inherited from class org.jboss.ejb.plugins.AbstractInstanceCache
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
flush, getCacheSize, insert, isActive, release, remove
 
Methods inherited from interface org.jboss.system.Service
create, start, stop
 
Methods inherited from interface org.jboss.ejb.plugins.AbstractInstanceCacheMBean
flush, getCachePolicyString, getCacheSize, getPassivatedCount, remove
 

Constructor Detail

EntityInstanceCache

public EntityInstanceCache()
Method Detail

setContainer

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

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

createCacheKey

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

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

get

public EnterpriseContext get(Object id)
                      throws RemoteException,
                             NoSuchObjectException
Description copied from interface: InstanceCache
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
Overrides:
get in class AbstractInstanceCache
Throws:
RemoteException
NoSuchObjectException

remove

public void remove(String id)
            throws Exception
Specified by:
remove in interface EntityInstanceCacheMBean
Throws:
Exception

destroy

public void destroy()
Specified by:
destroy in interface org.jboss.system.Service
Overrides:
destroy in class AbstractInstanceCache

getKey

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

Specified by:
getKey in class AbstractInstanceCache

setKey

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

Specified by:
setKey in class AbstractInstanceCache

getContainer

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

Specified by:
getContainer in class AbstractInstanceCache

passivate

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

Specified by:
passivate in class AbstractInstanceCache
Throws:
RemoteException

activate

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

Specified by:
activate in class AbstractInstanceCache
Throws:
RemoteException

acquireContext

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

Specified by:
acquireContext in class AbstractInstanceCache
Throws:
Exception

freeContext

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

Specified by:
freeContext in class AbstractInstanceCache

canPassivate

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

Specified by:
canPassivate in class AbstractInstanceCache


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.