org.hibernate.cache.infinispan.impl
Class BaseRegion

java.lang.Object
  extended by org.hibernate.cache.infinispan.impl.BaseRegion
All Implemented Interfaces:
Region
Direct Known Subclasses:
BaseGeneralDataRegion, BaseTransactionalDataRegion

public abstract class BaseRegion
extends Object
implements Region

Support for Infinispan Regions. 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.

Since:
3.5

Field Summary
protected  org.infinispan.AdvancedCache cache
           
 
Constructor Summary
BaseRegion(org.infinispan.AdvancedCache cache, String name, RegionFactory factory)
           
 
Method Summary
 boolean checkValid()
           
 boolean contains(Object key)
          Determine whether this region contains data for the given key.
 void destroy()
          The "end state" contract of the region's lifecycle.
 org.infinispan.AdvancedCache getCache()
           
 long getElementCountInMemory()
          The count of entries currently contained in the regions in-memory store.
 long getElementCountOnDisk()
          Not supported.
 String getName()
          Retrieve the name of this region.
 long getSizeInMemory()
          Not supported.
 int getTimeout()
           
 TransactionManager getTransactionManager()
           
 void invalidateRegion()
           
 boolean isTransactionAware()
           
protected  boolean isValid()
           
 long nextTimestamp()
           
 void resume(Transaction tx)
          Tell the TransactionManager to resume the given transaction
 Transaction suspend()
          Tell the TransactionManager to suspend 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

cache

protected final org.infinispan.AdvancedCache cache
Constructor Detail

BaseRegion

public BaseRegion(org.infinispan.AdvancedCache cache,
                  String name,
                  RegionFactory factory)
Method Detail

getName

public String getName()
Description copied from interface: Region
Retrieve the name of this region.

Specified by:
getName in interface Region
Returns:
The region name

getElementCountInMemory

public long getElementCountInMemory()
Description copied from interface: Region
The count of entries currently contained in the regions in-memory store.

Specified by:
getElementCountInMemory in interface Region
Returns:
The count of entries in memory; -1 if unknown or unsupported.

getElementCountOnDisk

public long getElementCountOnDisk()
Not supported.

Specified by:
getElementCountOnDisk in interface Region
Returns:
-1

getSizeInMemory

public long getSizeInMemory()
Not supported.

Specified by:
getSizeInMemory in interface Region
Returns:
-1

getTimeout

public int getTimeout()
Specified by:
getTimeout in interface Region

nextTimestamp

public long nextTimestamp()
Specified by:
nextTimestamp in interface Region

toMap

public Map toMap()
Description copied from interface: Region
Get the contents of this region as a map.

Implementors which do not support this notion should simply return an empty map.

Specified by:
toMap in interface Region
Returns:
The content map.

destroy

public void destroy()
             throws CacheException
Description copied from interface: Region
The "end state" contract of the region's lifecycle. Called during SessionFactory.close() to give the region a chance to cleanup.

Specified by:
destroy in interface Region
Throws:
CacheException - Indicates problem shutting down

contains

public boolean contains(Object key)
Description copied from interface: Region
Determine whether this region contains data for the given key.

The semantic here is whether the cache contains data visible for the current call context. This should be viewed as a "best effort", meaning blocking should be avoid if possible.

Specified by:
contains in interface Region
Parameters:
key - The cache key
Returns:
True if the underlying cache contains corresponding data; false otherwise.

checkValid

public boolean checkValid()

isValid

protected boolean isValid()

suspend

public Transaction suspend()
Tell the TransactionManager to suspend any ongoing transaction.

Returns:
the transaction that was suspended, or null if there wasn't one

resume

public void resume(Transaction tx)
Tell the TransactionManager to resume the given transaction

Parameters:
tx - the transaction to suspend. May be null.

invalidateRegion

public void invalidateRegion()

getTransactionManager

public TransactionManager getTransactionManager()

isTransactionAware

public boolean isTransactionAware()

getCache

public org.infinispan.AdvancedCache getCache()


Copyright © 2001-2013 Red Hat, Inc. All Rights Reserved.