|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.hibernate.cache.jbc2.BasicRegionAdapter
public abstract class BasicRegionAdapter
General support for writing Region implementations for JBoss Cache
2.x.
| Field Summary | |
|---|---|
static String |
ITEM
|
protected org.jboss.cache.Cache |
jbcCache
|
protected org.slf4j.Logger |
log
|
protected boolean |
optimistic
|
protected org.jboss.cache.Fqn |
regionFqn
|
protected String |
regionName
|
protected org.jboss.cache.Node |
regionRoot
|
protected Object |
regionRootMutex
|
protected TransactionManager |
transactionManager
|
| Constructor Summary | |
|---|---|
BasicRegionAdapter(org.jboss.cache.Cache jbcCache,
String regionName,
String regionPrefix)
|
|
| Method Summary | |
|---|---|
protected void |
activateLocalClusterNode()
|
protected abstract |
createRegionFqn(String regionName,
String regionPrefix)
|
protected void |
deactivateLocalNode()
|
void |
destroy()
The "end state" contract of the region's lifecycle. |
void |
ensureRegionRootExists()
Checks for the validity of the root cache node for this region, creating a new one if it does not exist or is invalid, and also ensuring that the root node is marked as resident. |
static String |
escapeRegionName(String regionName,
String regionPrefix)
|
org.jboss.cache.Cache |
getCacheInstance()
|
long |
getElementCountInMemory()
The count of entries currently contained in the regions in-memory store. |
long |
getElementCountOnDisk()
The count of entries currently contained in the regions disk store. |
String |
getName()
Retrieve the name of this region. |
protected org.jboss.cache.config.Option |
getNonLockingDataVersionOption(boolean allowNullReturn)
Get an Option with a data version
of NonLockingDataVersion. |
org.jboss.cache.Fqn |
getRegionFqn()
|
long |
getSizeInMemory()
The number of bytes is this cache region currently consuming in memory. |
int |
getTimeout()
|
static |
getTypeFirstRegionFqn(String regionName,
String regionPrefix,
String regionType)
|
static |
getTypeLastRegionFqn(String regionName,
String regionPrefix,
String regionType)
|
long |
nextTimestamp()
|
protected void |
resume(Transaction tx)
Tell the TransactionManager to resume the given transaction |
protected Transaction |
suspend()
Tell the TransactionManager to suspend any ongoing transaction. |
protected Object |
suspendAndGet(Object key,
org.jboss.cache.config.Option opt,
boolean suppressTimeout)
Performs a JBoss Cache get(Fqn, Object) after first
suspending any ongoing transaction. |
Map |
toMap()
Get the contents of this region as a map. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String ITEM
protected final org.jboss.cache.Cache jbcCache
protected final String regionName
protected final org.jboss.cache.Fqn regionFqn
protected org.jboss.cache.Node regionRoot
protected final boolean optimistic
protected final TransactionManager transactionManager
protected final org.slf4j.Logger log
protected final Object regionRootMutex
| Constructor Detail |
|---|
public BasicRegionAdapter(org.jboss.cache.Cache jbcCache,
String regionName,
String regionPrefix)
| Method Detail |
|---|
protected abstractcreateRegionFqn(String regionName, String regionPrefix)
protected void activateLocalClusterNode()
public String getName()
Region
getName in interface Regionpublic org.jboss.cache.Cache getCacheInstance()
public org.jboss.cache.Fqn getRegionFqn()
public void ensureRegionRootExists()
public void destroy()
throws CacheException
RegionSessionFactory.close() to give
the region a chance to cleanup.
destroy in interface RegionCacheException - Indicates problem shutting downprotected void deactivateLocalNode()
public long getSizeInMemory()
Region
getSizeInMemory in interface Regionpublic long getElementCountInMemory()
Region
getElementCountInMemory in interface Regionpublic long getElementCountOnDisk()
Region
getElementCountOnDisk in interface Regionpublic Map toMap()
Region
toMap in interface Regionpublic long nextTimestamp()
nextTimestamp in interface Regionpublic int getTimeout()
getTimeout in interface Region
protected Object suspendAndGet(Object key,
org.jboss.cache.config.Option opt,
boolean suppressTimeout)
throws CacheException
get(Fqn, Object) after first
suspending any ongoing transaction. Wraps any exception
in a CacheException. Ensures any ongoing transaction is resumed.
key - The key of the item to getopt - any option to add to the get invocation. May be nullsuppressTimeout - should any TimeoutException be suppressed?
CacheException - issue managing transaction or talking to cacheprotected Transaction suspend()
null if
there wasn't oneprotected void resume(Transaction tx)
tx - the transaction to suspend. May be null.protected org.jboss.cache.config.Option getNonLockingDataVersionOption(boolean allowNullReturn)
data version
of NonLockingDataVersion. The data version will not be
set if the cache is not configured for optimistic locking.
allowNullReturn - If true, return null
if the cache is not using optimistic locking.
If false, return a default
Option.
null.public staticgetTypeFirstRegionFqn(String regionName, String regionPrefix, String regionType)
public staticgetTypeLastRegionFqn(String regionName, String regionPrefix, String regionType)
public static String escapeRegionName(String regionName,
String regionPrefix)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||