org.jboss.ejb.plugins
Class StatefulSessionInstanceCache

java.lang.Object
  extended by org.jboss.ejb.plugins.AbstractInstanceCache
      extended by org.jboss.ejb.plugins.StatefulSessionInstanceCache
All Implemented Interfaces:
AllowedOperationsFlags, ContainerPlugin, InstanceCache, AbstractInstanceCacheMBean, XmlLoadable, MetricsConstants, Monitorable, org.jboss.system.Service

public class StatefulSessionInstanceCache
extends AbstractInstanceCache

Cache for stateful session beans.

Version:
$Revision: 1.27.2.1 $
Author:
Simone Bordet, Sebastien Alborini

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
StatefulSessionInstanceCache()
           
 
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
 void destroy()
           
protected  boolean doActivate(EnterpriseContext ctx)
          Activate the given EnterpriseContext
protected  void freeContext(EnterpriseContext ctx)
          Frees the given EnterpriseContext to the pool
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
 long getPassivatedCount()
          Get the passivated count.
protected  void passivate(EnterpriseContext ctx)
          Passivates the given EnterpriseContext
protected  void postRemovalCleanup(Object key)
           
protected  void preRemovalPreparation(Object key)
           
protected  void removePassivated(long maxLifeAfterPassivation)
          Remove all passivated instances that have been inactive too long.
 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, flush, get, getCache, getCacheLock, getCachePolicyString, getCacheSize, 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
 

Constructor Detail

StatefulSessionInstanceCache

public StatefulSessionInstanceCache()
Method Detail

getPassivatedCount

public long getPassivatedCount()
Get the passivated count.

Specified by:
getPassivatedCount in interface AbstractInstanceCacheMBean
Overrides:
getPassivatedCount in class AbstractInstanceCache
Returns:
the number of passivated instances.

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

Parameters:
c - The container using this plugin. This may be null if the plugin is being disassociated from a container.

destroy

public void destroy()
Specified by:
destroy in interface org.jboss.system.Service
Overrides:
destroy 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

doActivate

protected boolean doActivate(EnterpriseContext ctx)
                      throws RemoteException
Description copied from class: AbstractInstanceCache
Activate the given EnterpriseContext

Overrides:
doActivate in class AbstractInstanceCache
Parameters:
ctx - the context
Returns:
false if we recursively activating
Throws:
RemoteException - for any error

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

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

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

removePassivated

protected void removePassivated(long maxLifeAfterPassivation)
Remove all passivated instances that have been inactive too long.

Parameters:
maxLifeAfterPassivation - the upper bound in milliseconds that an inactive session will be kept.

preRemovalPreparation

protected void preRemovalPreparation(Object key)

postRemovalCleanup

protected void postRemovalCleanup(Object key)


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