public abstract class BaseRegion extends java.lang.Object implements Region
Region
s. Handles common "utility" methods for an underlying named
Cache. In other words, this implementation doesn't actually read or write data. Subclasses are
expected to provide core cache interaction appropriate to the semantics needed.Modifier and Type | Field and Description |
---|---|
protected org.infinispan.AdvancedCache |
cache |
protected InfinispanRegionFactory |
factory |
protected int |
invalidations |
protected long |
lastRegionInvalidation |
protected org.infinispan.AdvancedCache |
localAndSkipLoadCache |
protected java.lang.String |
name |
protected javax.transaction.TransactionManager |
tm |
Constructor and Description |
---|
BaseRegion(org.infinispan.AdvancedCache cache,
java.lang.String name,
javax.transaction.TransactionManager transactionManager,
InfinispanRegionFactory factory)
Base region constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
beginInvalidation() |
protected void |
checkAccessType(AccessType accessType) |
boolean |
checkValid()
Checks if the region is valid for operations such as storing new data
in the region, or retrieving data from the region.
|
boolean |
contains(java.lang.Object key)
Determine whether this region contains data for the given key.
|
void |
destroy()
The "end state" contract of the region's lifecycle.
|
void |
endInvalidation() |
org.infinispan.AdvancedCache |
getCache() |
protected javax.transaction.Transaction |
getCurrentTransaction() |
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.
|
java.lang.String |
getName()
Retrieve the name of this region.
|
InfinispanRegionFactory |
getRegionFactory() |
long |
getSizeInMemory()
The number of bytes is this cache region currently consuming in memory.
|
int |
getTimeout()
Get a timeout value.
|
javax.transaction.TransactionManager |
getTransactionManager() |
void |
invalidateRegion()
Invalidates the region.
|
boolean |
isTransactionAware() |
long |
nextTimestamp()
Get the next timestamp according to the underlying cache implementor.
|
void |
resume(javax.transaction.Transaction tx)
Tell the TransactionManager to resume the given transaction
|
protected void |
runInvalidation(boolean inTransaction) |
javax.transaction.Transaction |
suspend()
Tell the TransactionManager to suspend any ongoing transaction.
|
java.util.Map |
toMap()
Get the contents of this region as a map.
|
protected final java.lang.String name
protected final org.infinispan.AdvancedCache cache
protected final org.infinispan.AdvancedCache localAndSkipLoadCache
protected final javax.transaction.TransactionManager tm
protected final InfinispanRegionFactory factory
protected volatile long lastRegionInvalidation
protected int invalidations
public BaseRegion(org.infinispan.AdvancedCache cache, java.lang.String name, javax.transaction.TransactionManager transactionManager, InfinispanRegionFactory factory)
cache
- instance for the regionname
- of the regiontransactionManager
- transaction manager may be needed even for non-transactional caches.factory
- for this regionpublic java.lang.String getName()
Region
public long getElementCountInMemory()
Region
getElementCountInMemory
in interface Region
public long getElementCountOnDisk()
getElementCountOnDisk
in interface Region
public long getSizeInMemory()
getSizeInMemory
in interface Region
public int getTimeout()
Region
getTimeout
in interface Region
public long nextTimestamp()
Region
nextTimestamp
in interface Region
public java.util.Map toMap()
Region
public void destroy() throws CacheException
Region
SessionFactory.close()
to give
the region a chance to cleanup.destroy
in interface Region
CacheException
- Indicates problem shutting downpublic boolean contains(java.lang.Object key)
Region
public boolean checkValid()
public javax.transaction.Transaction suspend()
null
if
there wasn't onepublic void resume(javax.transaction.Transaction tx)
tx
- the transaction to suspend. May be null
.public void invalidateRegion()
public void beginInvalidation()
public void endInvalidation()
public javax.transaction.TransactionManager getTransactionManager()
public boolean isTransactionAware()
public org.infinispan.AdvancedCache getCache()
protected javax.transaction.Transaction getCurrentTransaction()
protected void checkAccessType(AccessType accessType)
protected void runInvalidation(boolean inTransaction)
public InfinispanRegionFactory getRegionFactory()
Copyright © 2001-2018 Red Hat, Inc. All Rights Reserved.