|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.jboss.ejb.plugins.AbstractInstanceCache
Base class for caches of entity and stateful beans.
It manages the cache entries through a CachePolicy
object;
the implementation of the cache policy object must respect the following
requirements:
Revisions:
20010703 marcf:
20010704 marcf:
2001/07/26: billb
2001/08/07: billb
2001/12/03: billb
Inner Class Summary | |
protected class |
AbstractInstanceCache.PassivationHelper
Helper class that schedules, unschedules, and executes the passivation jobs. |
Field Summary | |
protected Logger |
log
The log for this cache instance |
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 | |
AbstractInstanceCache()
|
Method Summary | |
protected abstract EnterpriseContext |
acquireContext()
Acquires an EnterpriseContext from the pool |
protected abstract void |
activate(EnterpriseContext ctx)
Activates the given EnterpriseContext |
protected abstract boolean |
canPassivate(EnterpriseContext ctx)
Returns whether the given context can be passivated or not |
javax.jms.Message |
createMessage(java.lang.Object id)
|
void |
destroy()
|
protected abstract void |
freeContext(EnterpriseContext ctx)
Frees the given EnterpriseContext to the pool |
EnterpriseContext |
get(java.lang.Object id)
Gets a bean instance from this cache given the identity. |
protected CachePolicy |
getCache()
Returns the cache policy used for this cache. |
java.lang.Object |
getCacheLock()
Returns the mutex used to sync access to the cache policy object |
protected abstract Container |
getContainer()
Returns the container for this cache. |
protected abstract java.lang.Object |
getKey(EnterpriseContext ctx)
Returns the key used by the cache to map the given context |
void |
importXml(org.w3c.dom.Element element)
|
void |
init()
|
void |
insert(EnterpriseContext ctx)
Inserts an active bean instance after creation or activation. |
boolean |
isActive(java.lang.Object id)
Checks whether an instance corresponding to a particular id is active |
boolean |
isJMSMonitoringEnabled()
|
protected void |
logActivation(java.lang.Object id)
|
protected void |
logPassivation(java.lang.Object id)
|
protected void |
logPassivationPostponed(java.lang.Object id)
|
protected void |
logPassivationScheduled(java.lang.Object id)
|
protected abstract void |
passivate(EnterpriseContext ctx)
Passivates the given EnterpriseContext |
void |
release(EnterpriseContext ctx)
Releases the given bean instance from this cache. |
void |
remove(java.lang.Object id)
Removes a bean instance from this cache given the identity. |
void |
resetStatistic()
|
java.util.Map |
retrieveStatistic()
|
void |
sample(java.lang.Object s)
Samples the status of the implementor object and register the status into the snapshot argument. |
protected void |
schedulePassivation(EnterpriseContext ctx)
Schedules the given EnterpriseContext for passivation |
void |
sendMessage(javax.jms.Message message)
|
void |
setJMSMonitoringEnabled(boolean enable)
|
protected abstract void |
setKey(java.lang.Object id,
EnterpriseContext ctx)
Sets the given id as key for the given context |
void |
start()
|
void |
stop()
|
protected EnterpriseContext |
unschedulePassivation(java.lang.Object id)
Tries to unschedule the given EnterpriseContext for passivation; returns the unscheduled context if it wasn't passivated yet, null if the passivation already happened. |
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.ContainerPlugin |
setContainer |
Field Detail |
protected Logger log
Constructor Detail |
public AbstractInstanceCache()
Method Detail |
public void sample(java.lang.Object s)
Monitorable
sample
in interface Monitorable
public java.util.Map retrieveStatistic()
public void resetStatistic()
public void setJMSMonitoringEnabled(boolean enable)
public boolean isJMSMonitoringEnabled()
public void sendMessage(javax.jms.Message message)
public javax.jms.Message createMessage(java.lang.Object id)
public EnterpriseContext get(java.lang.Object id) throws java.rmi.RemoteException, java.rmi.NoSuchObjectException
InstanceCache
get
in interface InstanceCache
org.jboss.ejb.InstanceCache
id
- the primary key of the beanjava.rmi.RemoteException
- in case of illegal calls (concurrent / reentrant),
NoSuchObjectException if the bean cannot be found.InstanceCache.release(org.jboss.ejb.EnterpriseContext)
public void insert(EnterpriseContext ctx)
InstanceCache
insert
in interface InstanceCache
org.jboss.ejb.InstanceCache
ctx
- the EnterpriseContext to insert in the cacheInstanceCache.remove(java.lang.Object)
public void release(EnterpriseContext ctx)
InstanceCache
release
in interface InstanceCache
org.jboss.ejb.InstanceCache
ctx
- the EnterpriseContext to releaseInstanceCache.get(java.lang.Object)
public void remove(java.lang.Object id)
InstanceCache
remove
in interface InstanceCache
org.jboss.ejb.InstanceCache
id
- the pimary key of the beanInstanceCache.insert(org.jboss.ejb.EnterpriseContext)
public boolean isActive(java.lang.Object id)
InstanceCache
isActive
in interface InstanceCache
org.jboss.ejb.InstanceCache
id
- the pimary key of the beanInstanceCache.insert(org.jboss.ejb.EnterpriseContext)
public void importXml(org.w3c.dom.Element element) throws DeploymentException
importXml
in interface XmlLoadable
public void init() throws java.lang.Exception
init
in interface Service
public void start() throws java.lang.Exception
start
in interface Service
public void stop()
stop
in interface Service
public void destroy()
destroy
in interface Service
protected void schedulePassivation(EnterpriseContext ctx)
AbstractInstanceCache.PassivationHelper.schedule(org.jboss.ejb.EnterpriseContext)
protected EnterpriseContext unschedulePassivation(java.lang.Object id)
AbstractInstanceCache.PassivationHelper.unschedule(java.lang.Object)
protected void logActivation(java.lang.Object id)
protected void logPassivationScheduled(java.lang.Object id)
protected void logPassivation(java.lang.Object id)
protected void logPassivationPostponed(java.lang.Object id)
protected abstract Container getContainer()
protected CachePolicy getCache()
public java.lang.Object getCacheLock()
protected abstract void passivate(EnterpriseContext ctx) throws java.rmi.RemoteException
protected abstract void activate(EnterpriseContext ctx) throws java.rmi.RemoteException
protected abstract EnterpriseContext acquireContext() throws java.lang.Exception
protected abstract void freeContext(EnterpriseContext ctx)
protected abstract java.lang.Object getKey(EnterpriseContext ctx)
protected abstract void setKey(java.lang.Object id, EnterpriseContext ctx)
protected abstract boolean canPassivate(EnterpriseContext ctx)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |