com.hazelcast.hibernate.region
Class HazelcastCollectionRegion<Cache extends RegionCache>

java.lang.Object
  extended by com.hazelcast.hibernate.region.AbstractTransactionalDataRegion<Cache>
      extended by com.hazelcast.hibernate.region.HazelcastCollectionRegion<Cache>
Type Parameters:
Cache - implementation type of RegionCache
All Implemented Interfaces:
HazelcastRegion<Cache>, org.hibernate.cache.CollectionRegion, org.hibernate.cache.Region, org.hibernate.cache.TransactionalDataRegion

public final class HazelcastCollectionRegion<Cache extends RegionCache>
extends AbstractTransactionalDataRegion<Cache>
implements org.hibernate.cache.CollectionRegion

An collection region implementation based upon Hazelcast IMap with basic concurrency / transactional support by supplying CollectionRegionAccessStrategy

Author:
mdogan 11/9/12

Field Summary
protected  Properties props
           
 
Constructor Summary
HazelcastCollectionRegion(HazelcastInstance instance, String regionName, Properties props, org.hibernate.cache.CacheDataDescription metadata, Cache cache)
           
 
Method Summary
 org.hibernate.cache.access.CollectionRegionAccessStrategy buildAccessStrategy(org.hibernate.cache.access.AccessType accessType)
           
 boolean contains(Object key)
           
 void destroy()
           
 long getElementCountInMemory()
           
 long getElementCountOnDisk()
          Hazelcast does not support pushing elements to disk.
 HazelcastInstance getInstance()
           
 ILogger getLogger()
           
 String getName()
           
 long getSizeInMemory()
           
 int getTimeout()
           
 long nextTimestamp()
           
 Map toMap()
          Appears to be used only by org.hibernate.stat.SecondLevelCacheStatistics.
 
Methods inherited from class com.hazelcast.hibernate.region.AbstractTransactionalDataRegion
getCache, getCacheDataDescription, isTransactionAware
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.hibernate.cache.TransactionalDataRegion
getCacheDataDescription, isTransactionAware
 
Methods inherited from interface org.hibernate.cache.Region
contains, destroy, getElementCountInMemory, getElementCountOnDisk, getName, getSizeInMemory, getTimeout, nextTimestamp, toMap
 

Field Detail

props

protected final Properties props
Constructor Detail

HazelcastCollectionRegion

public HazelcastCollectionRegion(HazelcastInstance instance,
                                 String regionName,
                                 Properties props,
                                 org.hibernate.cache.CacheDataDescription metadata,
                                 Cache cache)
Method Detail

buildAccessStrategy

public org.hibernate.cache.access.CollectionRegionAccessStrategy buildAccessStrategy(org.hibernate.cache.access.AccessType accessType)
                                                                              throws org.hibernate.cache.CacheException
Specified by:
buildAccessStrategy in interface org.hibernate.cache.CollectionRegion
Throws:
org.hibernate.cache.CacheException

destroy

public void destroy()
             throws org.hibernate.cache.CacheException
Specified by:
destroy in interface org.hibernate.cache.Region
Throws:
org.hibernate.cache.CacheException

getElementCountInMemory

public long getElementCountInMemory()
Specified by:
getElementCountInMemory in interface org.hibernate.cache.Region
Returns:
The size of the internal IMap.

getElementCountOnDisk

public long getElementCountOnDisk()
Hazelcast does not support pushing elements to disk.

Specified by:
getElementCountOnDisk in interface org.hibernate.cache.Region
Returns:
-1 this value means "unsupported"

getName

public String getName()
Specified by:
getName in interface org.hibernate.cache.Region
Returns:
The name of the region.

getSizeInMemory

public long getSizeInMemory()
Specified by:
getSizeInMemory in interface org.hibernate.cache.Region
Returns:
a rough estimate of number of bytes used by this region.

getTimeout

public final int getTimeout()
Specified by:
getTimeout in interface org.hibernate.cache.Region

nextTimestamp

public final long nextTimestamp()
Specified by:
nextTimestamp in interface org.hibernate.cache.Region

toMap

public Map toMap()
Appears to be used only by org.hibernate.stat.SecondLevelCacheStatistics.

Specified by:
toMap in interface org.hibernate.cache.Region
Returns:
the internal IMap used for this region.

contains

public boolean contains(Object key)
Specified by:
contains in interface org.hibernate.cache.Region

getInstance

public final HazelcastInstance getInstance()
Specified by:
getInstance in interface HazelcastRegion<Cache extends RegionCache>

getLogger

public final ILogger getLogger()
Specified by:
getLogger in interface HazelcastRegion<Cache extends RegionCache>


Copyright © 2015 Hazelcast, Inc.. All Rights Reserved.