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