|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.hibernate.cache.jbc.BasicRegionAdapter
public abstract class BasicRegionAdapter
General support for writing Region
implementations for JBoss Cache
2.x.
Field Summary | |
---|---|
protected Set<Object> |
currentView
|
protected org.jboss.cache.Fqn |
internalFqn
|
protected AtomicReference<org.hibernate.cache.jbc.BasicRegionAdapter.InvalidateState> |
invalidateState
|
protected Object |
invalidationMutex
|
static String |
ITEM
|
protected org.jboss.cache.Cache |
jbcCache
|
protected org.slf4j.Logger |
log
|
protected Object |
memberId
|
protected boolean |
optimistic
|
protected org.jboss.cache.Fqn |
regionFqn
|
protected String |
regionName
|
protected org.jboss.cache.Node |
regionRoot
|
protected Object |
regionRootMutex
|
protected boolean |
replication
|
protected TransactionManager |
transactionManager
|
Constructor Summary | |
---|---|
BasicRegionAdapter(org.jboss.cache.Cache jbcCache,
String regionName,
String regionPrefix)
|
Method Summary | |
---|---|
protected void |
activateLocalClusterNode()
|
boolean |
checkValid()
|
boolean |
contains(Object key)
Determine whether this region contains data for the given key. |
protected abstract org.jboss.cache.Fqn<String> |
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. |
Object |
getMemberId()
|
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 org.jboss.cache.Fqn<String> |
getTypeFirstRegionFqn(String regionName,
String regionPrefix,
String regionType)
|
static org.jboss.cache.Fqn<String> |
getTypeLastRegionFqn(String regionName,
String regionPrefix,
String regionType)
|
protected boolean |
handleEvictAllInvalidation(org.jboss.cache.notifications.event.NodeInvalidatedEvent event)
|
protected boolean |
handleEvictAllModification(org.jboss.cache.notifications.event.NodeModifiedEvent event)
|
long |
nextTimestamp()
|
void |
nodeInvalidated(org.jboss.cache.notifications.event.NodeInvalidatedEvent event)
|
void |
nodeModified(org.jboss.cache.notifications.event.NodeModifiedEvent event)
|
void |
resume(Transaction tx)
Tell the TransactionManager to resume the given transaction |
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. |
void |
viewChanged(org.jboss.cache.notifications.event.ViewChangedEvent event)
|
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 final org.jboss.cache.Fqn internalFqn
protected org.jboss.cache.Node regionRoot
protected final boolean optimistic
protected final TransactionManager transactionManager
protected final org.slf4j.Logger log
protected final Object regionRootMutex
protected final Object memberId
protected final boolean replication
protected final Object invalidationMutex
protected final AtomicReference<org.hibernate.cache.jbc.BasicRegionAdapter.InvalidateState> invalidateState
protected final Set<Object> currentView
Constructor Detail |
---|
public BasicRegionAdapter(org.jboss.cache.Cache jbcCache, String regionName, String regionPrefix)
Method Detail |
---|
protected abstract org.jboss.cache.Fqn<String> createRegionFqn(String regionName, String regionPrefix)
protected void activateLocalClusterNode()
public String getName()
Region
getName
in interface Region
public org.jboss.cache.Cache getCacheInstance()
public org.jboss.cache.Fqn getRegionFqn()
public Object getMemberId()
public void ensureRegionRootExists()
public boolean checkValid()
public void destroy() throws CacheException
Region
SessionFactory.close()
to give
the region a chance to cleanup.
destroy
in interface Region
CacheException
- Indicates problem shutting downprotected void deactivateLocalNode()
public boolean contains(Object key)
Region
contains
in interface Region
key
- The cache key
public long getSizeInMemory()
Region
getSizeInMemory
in interface Region
public long getElementCountInMemory()
Region
getElementCountInMemory
in interface Region
public long getElementCountOnDisk()
Region
getElementCountOnDisk
in interface Region
public Map toMap()
Region
toMap
in interface Region
public long nextTimestamp()
nextTimestamp
in interface Region
public 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 null
suppressTimeout
- should any TimeoutException be suppressed?
CacheException
- issue managing transaction or talking to cachepublic Transaction suspend()
null
if
there wasn't onepublic 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 static org.jboss.cache.Fqn<String> getTypeFirstRegionFqn(String regionName, String regionPrefix, String regionType)
public static org.jboss.cache.Fqn<String> getTypeLastRegionFqn(String regionName, String regionPrefix, String regionType)
public static String escapeRegionName(String regionName, String regionPrefix)
public void nodeModified(org.jboss.cache.notifications.event.NodeModifiedEvent event)
protected boolean handleEvictAllModification(org.jboss.cache.notifications.event.NodeModifiedEvent event)
public void nodeInvalidated(org.jboss.cache.notifications.event.NodeInvalidatedEvent event)
protected boolean handleEvictAllInvalidation(org.jboss.cache.notifications.event.NodeInvalidatedEvent event)
public void viewChanged(org.jboss.cache.notifications.event.ViewChangedEvent event)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |