|
||||||||||
PREV CLASS NEXT CLASS (src) | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | 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
(src) object;
the implementation of the cache policy object must respect the following
requirements:
Field Summary | |
protected static Logger (src) |
log
|
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 | |
AbstractInstanceCache()
|
Method Summary | |
protected abstract EnterpriseContext (src) |
acquireContext()
Acquires an EnterpriseContext from the pool |
protected abstract void |
activate(EnterpriseContext (src) ctx)
Activates the given EnterpriseContext |
protected abstract boolean |
canPassivate(EnterpriseContext (src) ctx)
Returns whether the given context can be passivated or not |
void |
create()
create the service, do expensive operations etc |
void |
destroy()
destroy the service, tear down |
protected boolean |
doActivate(EnterpriseContext (src) ctx)
Activate the given EnterpriseContext |
void |
flush()
Flush the cache. |
protected abstract 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 CachePolicy (src) |
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 |
java.lang.String |
getCachePolicyString()
Display the cache policy. |
long |
getCacheSize()
Get the current cache size |
protected abstract Container (src) |
getContainer()
Returns the container for this cache. |
protected abstract java.lang.Object |
getKey(EnterpriseContext (src) ctx)
Returns the key used by the cache to map the given context |
long |
getPassivatedCount()
Get the passivated count. |
void |
importXml(org.w3c.dom.Element element)
|
void |
insert(EnterpriseContext (src) 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. |
protected void |
logActivation(java.lang.Object id)
|
protected void |
logPassivation(java.lang.Object id)
|
protected abstract void |
passivate(EnterpriseContext (src) ctx)
Passivates the given EnterpriseContext |
void |
release(EnterpriseContext (src) ctx)
Releases the given bean instance from this cache. |
void |
remove(java.lang.Object id)
From InstanceCache interface |
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 abstract void |
setKey(java.lang.Object id,
EnterpriseContext (src) ctx)
Sets the given id as key for the given context |
void |
start()
start the service, create is already called |
void |
stop()
stop the service |
protected void |
tryToPassivate(EnterpriseContext (src) ctx)
|
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 (src) |
setContainer |
Field Detail |
protected static Logger (src) log
Constructor Detail |
public AbstractInstanceCache()
Method Detail |
public void sample(java.lang.Object s)
Monitorable (src)
sample
in interface Monitorable (src)
public java.util.Map retrieveStatistic()
public void resetStatistic()
public EnterpriseContext (src) get(java.lang.Object id) throws java.rmi.RemoteException, java.rmi.NoSuchObjectException
InstanceCache (src)
Implementation should have O(1) complexity.
This method is never called for stateless session beans.
get
in interface InstanceCache (src)
id
- The primary key of the bean .
java.rmi.NoSuchObjectException
- if the bean cannot be found.
java.rmi.RemoteException
- In case of illegal calls (concurrent /
reentrant)InstanceCache.release(org.jboss.ejb.EnterpriseContext)
public void insert(EnterpriseContext (src) ctx)
InstanceCache (src)
Implementation should guarantee proper locking and O(1) complexity.
insert
in interface InstanceCache (src)
ctx
- The EnterpriseContext to insert in the cacheInstanceCache.remove(java.lang.Object)
protected void tryToPassivate(EnterpriseContext (src) ctx)
public void release(EnterpriseContext (src) ctx)
InstanceCache (src)
release
in interface InstanceCache (src)
ctx
- The EnterpriseContext to releaseInstanceCache.get(java.lang.Object)
public void remove(java.lang.Object id)
remove
in interface InstanceCache (src)
id
- The pimary key of the bean.InstanceCache.insert(org.jboss.ejb.EnterpriseContext)
public boolean isActive(java.lang.Object id)
InstanceCache (src)
isActive
in interface InstanceCache (src)
id
- The pimary key of the bean.InstanceCache.insert(org.jboss.ejb.EnterpriseContext)
public long getCacheSize()
getCacheSize
in interface InstanceCache (src)
public void flush()
flush
in interface InstanceCache (src)
public long getPassivatedCount()
public java.lang.String getCachePolicyString()
public void importXml(org.w3c.dom.Element element) throws DeploymentException (src)
importXml
in interface XmlLoadable (src)
DeploymentException (src)
public void create() throws java.lang.Exception
Service (src)
create
in interface Service (src)
java.lang.Exception
public void start() throws java.lang.Exception
Service (src)
start
in interface Service (src)
java.lang.Exception
public void stop()
Service (src)
stop
in interface Service (src)
public void destroy()
Service (src)
destroy
in interface Service (src)
protected void logActivation(java.lang.Object id)
protected void logPassivation(java.lang.Object id)
protected abstract Container (src) getContainer()
protected CachePolicy (src) getCache()
public java.lang.Object getCacheLock()
protected abstract void passivate(EnterpriseContext (src) ctx) throws java.rmi.RemoteException
java.rmi.RemoteException
protected abstract void activate(EnterpriseContext (src) ctx) throws java.rmi.RemoteException
java.rmi.RemoteException
protected boolean doActivate(EnterpriseContext (src) ctx) throws java.rmi.RemoteException
ctx
- the context
java.rmi.RemoteException
- for any errorprotected abstract EnterpriseContext (src) acquireContext() throws java.lang.Exception
java.lang.Exception
protected abstract void freeContext(EnterpriseContext (src) ctx)
protected abstract java.lang.Object getKey(EnterpriseContext (src) ctx)
protected abstract void setKey(java.lang.Object id, EnterpriseContext (src) ctx)
protected abstract boolean canPassivate(EnterpriseContext (src) ctx)
|
||||||||||
PREV CLASS NEXT CLASS (src) | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |