org.hibernate.cache.impl.bridge
Class BaseRegionAdapter

java.lang.Object
  extended by org.hibernate.cache.impl.bridge.BaseRegionAdapter
All Implemented Interfaces:
Region
Direct Known Subclasses:
BaseGeneralDataRegionAdapter, BaseTransactionalDataRegionAdapter

public abstract class BaseRegionAdapter
extends Object
implements Region

Basic adapter bridging between Region and Cache.

Author:
Steve Ebersole

Field Summary
protected  Settings settings
           
protected  Cache underlyingCache
           
 
Constructor Summary
protected BaseRegionAdapter(Cache underlyingCache, Settings settings)
           
 
Method Summary
 void clear()
           
 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.
 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.
 long getSizeInMemory()
          The number of bytes is this cache region currently consuming in memory.
 int getTimeout()
           
 long nextTimestamp()
           
 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

underlyingCache

protected final Cache underlyingCache

settings

protected final Settings settings
Constructor Detail

BaseRegionAdapter

protected BaseRegionAdapter(Cache underlyingCache,
                            Settings settings)
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

clear

public void clear()
           throws CacheException
Throws:
CacheException

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.

getSizeInMemory

public long getSizeInMemory()
Description copied from interface: Region
The number of bytes is this cache region currently consuming in memory.

Specified by:
getSizeInMemory in interface Region
Returns:
The number of bytes consumed by this region; -1 if unknown or unsupported.

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()
Description copied from interface: Region
The count of entries currently contained in the regions disk store.

Specified by:
getElementCountOnDisk in interface Region
Returns:
The count of entries on disk; -1 if unknown or unsupported.

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.

nextTimestamp

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

getTimeout

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


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