org.jboss.ejb3.cache.tree
Class StatefulTreeCache

java.lang.Object
  extended by org.jboss.ejb3.cache.tree.StatefulTreeCache
All Implemented Interfaces:
org.jboss.ejb3.cache.Cache<StatefulBeanContext>, ClusteredStatefulCache, StatefulCache

public class StatefulTreeCache
extends Object
implements ClusteredStatefulCache

Clustered SFSB cache that uses JBoss Cache to cache and replicate bean contexts.

Version:
$Revision: 87444 $
Author:
Bill Burke, Brian Stansberry

Nested Class Summary
 class StatefulTreeCache.ClusteredStatefulCacheListener
          A CacheListener that allows us to get notifications of passivations and activations and thus notify the cached StatefulBeanContext.
 
Field Summary
protected  Map<Object,Long> beans
           
protected  org.jboss.ejb3.annotation.CacheConfig cacheConfig
           
protected  org.jboss.cache.CacheManager cacheManager
           
protected  int createCount
           
protected  StatefulContainer ejbContainer
           
protected  String[] hashBuckets
           
static long MarkInUseWaitTime
           
protected  Object metricsLock
           
protected  int passivatedCount
           
protected  org.jboss.ejb3.cache.tree.StatefulTreeCache.RemovalTimeoutTask removalTask
           
protected  long removalTimeout
           
protected  int removeCount
           
protected  boolean running
           
protected  Object shutdownLock
           
protected  int totalSize
           
 
Constructor Summary
StatefulTreeCache()
           
 
Method Summary
 StatefulBeanContext create()
           
 StatefulBeanContext create(Class[] initTypes, Object[] initValues)
           
 StatefulBeanContext get(Object key)
          Gets the context with the given id.
 StatefulBeanContext get(Object key, boolean markInUse)
          Get the context with the given id, optionally marking the context as being in use.
 int getAvailableCount()
           
 int getCacheSize()
           
 int getCreateCount()
           
 int getCurrentSize()
           
protected  org.jboss.cache.config.EvictionRegionConfig getEvictionRegionConfig(org.jboss.cache.Fqn fqn)
           
 int getMaxSize()
           
 int getPassivatedCount()
           
 int getRemoveCount()
           
 int getTotalSize()
           
 void initialize(EJBContainer container)
           
 boolean isStarted()
           
 StatefulBeanContext peek(Object key)
           
 void release(StatefulBeanContext ctx)
           
 void remove(Object key)
           
 void replicate(StatefulBeanContext ctx)
           
 void start()
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MarkInUseWaitTime

public static long MarkInUseWaitTime

hashBuckets

protected String[] hashBuckets

createCount

protected volatile int createCount

passivatedCount

protected volatile int passivatedCount

removeCount

protected volatile int removeCount

totalSize

protected volatile int totalSize

removalTimeout

protected long removalTimeout

removalTask

protected org.jboss.ejb3.cache.tree.StatefulTreeCache.RemovalTimeoutTask removalTask

running

protected boolean running

beans

protected Map<Object,Long> beans

cacheConfig

protected org.jboss.ejb3.annotation.CacheConfig cacheConfig

cacheManager

protected org.jboss.cache.CacheManager cacheManager

ejbContainer

protected StatefulContainer ejbContainer

shutdownLock

protected Object shutdownLock

metricsLock

protected final Object metricsLock
Constructor Detail

StatefulTreeCache

public StatefulTreeCache()
Method Detail

create

public StatefulBeanContext create()

create

public StatefulBeanContext create(Class[] initTypes,
                                  Object[] initValues)
Specified by:
create in interface org.jboss.ejb3.cache.Cache<StatefulBeanContext>
Specified by:
create in interface StatefulCache

get

public StatefulBeanContext get(Object key)
                        throws javax.ejb.EJBException
Description copied from interface: StatefulCache
Gets the context with the given id.

Same as getContext(key, true)

Specified by:
get in interface org.jboss.ejb3.cache.Cache<StatefulBeanContext>
Specified by:
get in interface StatefulCache
Parameters:
key - the id
Returns:
the context
Throws:
javax.ejb.EJBException

get

public StatefulBeanContext get(Object key,
                               boolean markInUse)
                        throws javax.ejb.EJBException
Description copied from interface: StatefulCache
Get the context with the given id, optionally marking the context as being in use.

Specified by:
get in interface StatefulCache
Parameters:
key - the context's id
markInUse - if true, marks any returned context as being in use. If false, will return contexts that are marked as removed; otherwise will throw NoSuchEJBException if such a context is found
Returns:
the context
Throws:
javax.ejb.NoSuchEJBException - if no context with the given id exists or if the context exists but has been marked as removed and markInUse is true
javax.ejb.EJBException

peek

public StatefulBeanContext peek(Object key)
                         throws javax.ejb.NoSuchEJBException
Specified by:
peek in interface org.jboss.ejb3.cache.Cache<StatefulBeanContext>
Throws:
javax.ejb.NoSuchEJBException

remove

public void remove(Object key)
Specified by:
remove in interface org.jboss.ejb3.cache.Cache<StatefulBeanContext>

release

public void release(StatefulBeanContext ctx)
Specified by:
release in interface org.jboss.ejb3.cache.Cache<StatefulBeanContext>

replicate

public void replicate(StatefulBeanContext ctx)
Specified by:
replicate in interface ClusteredStatefulCache

initialize

public void initialize(EJBContainer container)
                throws Exception
Specified by:
initialize in interface StatefulCache
Throws:
Exception

getEvictionRegionConfig

protected org.jboss.cache.config.EvictionRegionConfig getEvictionRegionConfig(org.jboss.cache.Fqn fqn)

start

public void start()
Specified by:
start in interface org.jboss.ejb3.cache.Cache<StatefulBeanContext>

stop

public void stop()
Specified by:
stop in interface org.jboss.ejb3.cache.Cache<StatefulBeanContext>

getCacheSize

public int getCacheSize()
Specified by:
getCacheSize in interface StatefulCache

getTotalSize

public int getTotalSize()
Specified by:
getTotalSize in interface StatefulCache

getCreateCount

public int getCreateCount()
Specified by:
getCreateCount in interface StatefulCache

getPassivatedCount

public int getPassivatedCount()
Specified by:
getPassivatedCount in interface StatefulCache

getRemoveCount

public int getRemoveCount()
Specified by:
getRemoveCount in interface StatefulCache

getAvailableCount

public int getAvailableCount()
Specified by:
getAvailableCount in interface StatefulCache

getMaxSize

public int getMaxSize()
Specified by:
getMaxSize in interface StatefulCache

getCurrentSize

public int getCurrentSize()
Specified by:
getCurrentSize in interface StatefulCache

isStarted

public boolean isStarted()
Specified by:
isStarted in interface StatefulCache


Copyright © 2010 JBoss, a division of Red Hat, Inc.. All Rights Reserved.