Class CoherenceRegionFactory
- java.lang.Object
-
- org.hibernate.cache.spi.AbstractRegionFactory
-
- org.hibernate.cache.spi.support.RegionFactoryTemplate
-
- com.oracle.coherence.hibernate.cache.v53.CoherenceRegionFactory
-
- All Implemented Interfaces:
Serializable,org.hibernate.cache.spi.RegionFactory,org.hibernate.service.Service,org.hibernate.service.spi.Stoppable
public class CoherenceRegionFactory extends org.hibernate.cache.spi.support.RegionFactoryTemplateA CoherenceRegionFactory is a factory for regions of Hibernate second-level cache implemented with Oracle Coherence.- Since:
- 2.1
- Author:
- Randy Stafford, Gunnar Hillert
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected com.tangosol.net.SessioncoherenceSessionprotected CoherenceHibernateSystemPropertyResolversystemPropertyResolver
-
Constructor Summary
Constructors Constructor Description CoherenceRegionFactory()Default constructor.CoherenceRegionFactory(com.tangosol.net.Session coherenceSession)Constructor that allows to pass-in an externally created CoherenceSession.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.hibernate.cache.spi.DomainDataRegionbuildDomainDataRegion(org.hibernate.cache.cfg.spi.DomainDataRegionConfig regionConfig, org.hibernate.cache.cfg.spi.DomainDataRegionBuildingContext buildingContext)protected com.tangosol.net.CoherencecreateCoherenceInstance(SessionType sessionType, com.tangosol.net.CoherenceConfiguration coherenceConfiguration)Creates aCoherenceinstance with theCoherenceConfigurationprovided.protected CoherenceRegioncreateCoherenceRegion(String unqualifiedRegionName, org.hibernate.engine.spi.SessionFactoryImplementor sessionFactory)protected org.hibernate.cache.spi.support.DomainDataStorageAccesscreateDomainDataStorageAccess(org.hibernate.cache.cfg.spi.DomainDataRegionConfig regionConfig, org.hibernate.cache.cfg.spi.DomainDataRegionBuildingContext buildingContext)protected org.hibernate.cache.spi.support.StorageAccesscreateQueryResultsRegionStorageAccess(String regionName, org.hibernate.engine.spi.SessionFactoryImplementor sessionFactory)protected org.hibernate.cache.spi.support.StorageAccesscreateTimestampsRegionStorageAccess(String regionName, org.hibernate.engine.spi.SessionFactoryImplementor sessionFactory)protected com.tangosol.net.NamedCache<?,?>ensureNamedCache(String cacheName)Ensure the initialization of a NamedCache of the argument name.protected com.tangosol.net.SessiongetCoherenceSession()Returns the CoherenceSessionused by thisCoherenceRegionFactory.org.hibernate.cache.spi.access.AccessTypegetDefaultAccessType()protected org.hibernate.cache.spi.CacheKeysFactorygetImplicitCacheKeysFactory()booleanisMinimalPutsEnabledByDefault()see also https://stackoverflow.com/a/12389310/835934longnextTimestamp()protected voidprepareForUse(org.hibernate.boot.spi.SessionFactoryOptions settings, Map configValues)protected voidreleaseFromUse()protected voidsetCoherenceSession(com.tangosol.net.Session coherenceSession)Sets the CoherenceSessionused by thisCoherenceRegionFactory.StringtoString()-
Methods inherited from class org.hibernate.cache.spi.support.RegionFactoryTemplate
buildQueryResultsRegion, buildTimestampsRegion
-
-
-
-
Field Detail
-
systemPropertyResolver
protected CoherenceHibernateSystemPropertyResolver systemPropertyResolver
-
coherenceSession
protected com.tangosol.net.Session coherenceSession
-
-
Constructor Detail
-
CoherenceRegionFactory
public CoherenceRegionFactory()
Default constructor. Any Coherence instances created will implicitly require a shutdown of Coherence whenAbstractRegionFactory.stop()is called viareleaseFromUse().
-
CoherenceRegionFactory
public CoherenceRegionFactory(com.tangosol.net.Session coherenceSession)
Constructor that allows to pass-in an externally created CoherenceSession. In this case the external caller is responsible for any needed Coherence shut-downs whenAbstractRegionFactory.stop()is called viareleaseFromUse(). This means that call toAbstractRegionFactory.stop()will NOT result in a shutdown of Coherence; only theSessionis closed.- Parameters:
coherenceSession- must not be null
-
-
Method Detail
-
getImplicitCacheKeysFactory
protected org.hibernate.cache.spi.CacheKeysFactory getImplicitCacheKeysFactory()
- Overrides:
getImplicitCacheKeysFactoryin classorg.hibernate.cache.spi.support.RegionFactoryTemplate
-
getCoherenceSession
protected com.tangosol.net.Session getCoherenceSession()
Returns the CoherenceSessionused by thisCoherenceRegionFactory.- Returns:
- the Coherence
Session
-
setCoherenceSession
protected void setCoherenceSession(com.tangosol.net.Session coherenceSession)
Sets the CoherenceSessionused by thisCoherenceRegionFactory.- Parameters:
coherenceSession- the CoherenceSessionused by this CoherenceRegionFactory. May be null.
-
prepareForUse
protected void prepareForUse(org.hibernate.boot.spi.SessionFactoryOptions settings, Map configValues)- Specified by:
prepareForUsein classorg.hibernate.cache.spi.AbstractRegionFactory
-
releaseFromUse
protected void releaseFromUse()
- Specified by:
releaseFromUsein classorg.hibernate.cache.spi.AbstractRegionFactory
-
isMinimalPutsEnabledByDefault
public boolean isMinimalPutsEnabledByDefault()
see also https://stackoverflow.com/a/12389310/835934- Specified by:
isMinimalPutsEnabledByDefaultin interfaceorg.hibernate.cache.spi.RegionFactory- Overrides:
isMinimalPutsEnabledByDefaultin classorg.hibernate.cache.spi.AbstractRegionFactory
-
getDefaultAccessType
public org.hibernate.cache.spi.access.AccessType getDefaultAccessType()
- Specified by:
getDefaultAccessTypein interfaceorg.hibernate.cache.spi.RegionFactory- Overrides:
getDefaultAccessTypein classorg.hibernate.cache.spi.AbstractRegionFactory
-
nextTimestamp
public long nextTimestamp()
- Specified by:
nextTimestampin interfaceorg.hibernate.cache.spi.RegionFactory- Overrides:
nextTimestampin classorg.hibernate.cache.spi.AbstractRegionFactory
-
ensureNamedCache
protected com.tangosol.net.NamedCache<?,?> ensureNamedCache(String cacheName)
Ensure the initialization of a NamedCache of the argument name.- Parameters:
cacheName- the name of the NamedCache whose initialization to ensure- Returns:
- a NamedCache for the argument name
-
createDomainDataStorageAccess
protected org.hibernate.cache.spi.support.DomainDataStorageAccess createDomainDataStorageAccess(org.hibernate.cache.cfg.spi.DomainDataRegionConfig regionConfig, org.hibernate.cache.cfg.spi.DomainDataRegionBuildingContext buildingContext)- Overrides:
createDomainDataStorageAccessin classorg.hibernate.cache.spi.support.RegionFactoryTemplate
-
createTimestampsRegionStorageAccess
protected org.hibernate.cache.spi.support.StorageAccess createTimestampsRegionStorageAccess(String regionName, org.hibernate.engine.spi.SessionFactoryImplementor sessionFactory)
- Specified by:
createTimestampsRegionStorageAccessin classorg.hibernate.cache.spi.support.RegionFactoryTemplate
-
createQueryResultsRegionStorageAccess
protected org.hibernate.cache.spi.support.StorageAccess createQueryResultsRegionStorageAccess(String regionName, org.hibernate.engine.spi.SessionFactoryImplementor sessionFactory)
- Specified by:
createQueryResultsRegionStorageAccessin classorg.hibernate.cache.spi.support.RegionFactoryTemplate
-
createCoherenceRegion
protected CoherenceRegion createCoherenceRegion(String unqualifiedRegionName, org.hibernate.engine.spi.SessionFactoryImplementor sessionFactory)
-
buildDomainDataRegion
public org.hibernate.cache.spi.DomainDataRegion buildDomainDataRegion(org.hibernate.cache.cfg.spi.DomainDataRegionConfig regionConfig, org.hibernate.cache.cfg.spi.DomainDataRegionBuildingContext buildingContext)- Specified by:
buildDomainDataRegionin interfaceorg.hibernate.cache.spi.RegionFactory- Overrides:
buildDomainDataRegionin classorg.hibernate.cache.spi.support.RegionFactoryTemplate
-
createCoherenceInstance
protected com.tangosol.net.Coherence createCoherenceInstance(SessionType sessionType, com.tangosol.net.CoherenceConfiguration coherenceConfiguration)
Creates aCoherenceinstance with theCoherenceConfigurationprovided. The created Coherence instance may either be a client Coherence instance (Coherence.client(CoherenceConfiguration)) or a cluster member instance (Coherence.clusterMember(CoherenceConfiguration).The rules for determining the instance type are as follows in descending priority:
- Explicit configuration via parameter coherenceInstanceType.
- Via the provided
SessionType. As soon asSessionType.SERVERis provided, the Coherence instance is configured usingCoherence.clusterMember(CoherenceConfiguration). - If the provided
SessionTypeis null, the Coherence instances is configured usingCoherence.clusterMember(CoherenceConfiguration).
- Parameters:
sessionType- can be nullcoherenceConfiguration- must not be null- Returns:
- the Coherence instance
-
-