Class CoherenceRegionFactory

java.lang.Object
org.hibernate.cache.spi.AbstractRegionFactory
org.hibernate.cache.spi.support.RegionFactoryTemplate
com.oracle.coherence.hibernate.cache.v6.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.RegionFactoryTemplate
A 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:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected com.tangosol.net.Session
     
     

    Fields inherited from class org.hibernate.cache.spi.AbstractRegionFactory

    LEGACY_QUERY_RESULTS_REGION_UNQUALIFIED_NAMES, LEGACY_UPDATE_TIMESTAMPS_REGION_UNQUALIFIED_NAMES

    Fields inherited from interface org.hibernate.cache.spi.RegionFactory

    DEFAULT_QUERY_RESULTS_REGION_UNQUALIFIED_NAME, DEFAULT_UPDATE_TIMESTAMPS_REGION_UNQUALIFIED_NAME
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor.
    CoherenceRegionFactory(com.tangosol.net.Session coherenceSession)
    Constructor that allows to pass-in an externally created Coherence Session.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.hibernate.cache.spi.DomainDataRegion
    buildDomainDataRegion(org.hibernate.cache.cfg.spi.DomainDataRegionConfig regionConfig, org.hibernate.cache.cfg.spi.DomainDataRegionBuildingContext buildingContext)
     
    protected CoherenceRegion
    createCoherenceRegion(String unqualifiedRegionName, org.hibernate.engine.spi.SessionFactoryImplementor sessionFactory)
     
    protected org.hibernate.cache.spi.support.DomainDataStorageAccess
    createDomainDataStorageAccess(org.hibernate.cache.cfg.spi.DomainDataRegionConfig regionConfig, org.hibernate.cache.cfg.spi.DomainDataRegionBuildingContext buildingContext)
     
    protected org.hibernate.cache.spi.support.StorageAccess
    createQueryResultsRegionStorageAccess(String regionName, org.hibernate.engine.spi.SessionFactoryImplementor sessionFactory)
     
    protected org.hibernate.cache.spi.support.StorageAccess
    createTimestampsRegionStorageAccess(String regionName, org.hibernate.engine.spi.SessionFactoryImplementor sessionFactory)
     
    protected com.tangosol.net.NamedCache<?,?>
    Ensure the initialization of a NamedCache of the argument name.
    protected com.tangosol.net.Session
    Returns the Coherence Session used by this CoherenceRegionFactory.
    org.hibernate.cache.spi.access.AccessType
    protected org.hibernate.cache.spi.CacheKeysFactory
     
    boolean
    long
    protected void
    prepareForUse(org.hibernate.boot.spi.SessionFactoryOptions settings, Map configValues)
     
    protected void
     
    protected void
    setCoherenceSession(com.tangosol.net.Session coherenceSession)
    Sets the Coherence Session used by this CoherenceRegionFactory.

    Methods inherited from class org.hibernate.cache.spi.support.RegionFactoryTemplate

    buildQueryResultsRegion, buildTimestampsRegion

    Methods inherited from class org.hibernate.cache.spi.AbstractRegionFactory

    createTransactionContext, getOptions, getTimeout, isStarted, qualify, start, stop, verifiedStartStatus, verifyStarted

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

  • Constructor Details

    • CoherenceRegionFactory

      public CoherenceRegionFactory()
      Default constructor. Any Coherence instances created will implicitly require a shutdown of Coherence when AbstractRegionFactory.stop() is called via releaseFromUse(). This option will by default start Coherence as a Cache client. This means that Coherence services are disabled by default (e.g. Local Storage). You can start Coherence as a CacheServer and local storage will be enabled by default and all default services will be started as well. Please provide property CoherenceHibernateProperties.START_CACHE_SERVER_PROPERTY_NAME
    • CoherenceRegionFactory

      public CoherenceRegionFactory(com.tangosol.net.Session coherenceSession)
      Constructor that allows to pass-in an externally created Coherence Session. In this case the external caller is responsible for any needed Coherence shut-downs when AbstractRegionFactory.stop() is called via releaseFromUse(). This means that call to AbstractRegionFactory.stop() will NOT result in a shutdown of Coherence; only the Session is closed.
      Parameters:
      coherenceSession - must not be null
  • Method Details

    • getImplicitCacheKeysFactory

      protected org.hibernate.cache.spi.CacheKeysFactory getImplicitCacheKeysFactory()
      Overrides:
      getImplicitCacheKeysFactory in class org.hibernate.cache.spi.support.RegionFactoryTemplate
    • getCoherenceSession

      protected com.tangosol.net.Session getCoherenceSession()
      Returns the Coherence Session used by this CoherenceRegionFactory.
      Returns:
      the Coherence Session
    • setCoherenceSession

      protected void setCoherenceSession(com.tangosol.net.Session coherenceSession)
      Sets the Coherence Session used by this CoherenceRegionFactory.
      Parameters:
      coherenceSession - the Coherence Session used by this CoherenceRegionFactory. May be null.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • prepareForUse

      protected void prepareForUse(org.hibernate.boot.spi.SessionFactoryOptions settings, Map configValues)
      Specified by:
      prepareForUse in class org.hibernate.cache.spi.AbstractRegionFactory
    • releaseFromUse

      protected void releaseFromUse()
      Specified by:
      releaseFromUse in class org.hibernate.cache.spi.AbstractRegionFactory
    • isMinimalPutsEnabledByDefault

      public boolean isMinimalPutsEnabledByDefault()

      see also https://stackoverflow.com/a/12389310/835934

      Specified by:
      isMinimalPutsEnabledByDefault in interface org.hibernate.cache.spi.RegionFactory
      Overrides:
      isMinimalPutsEnabledByDefault in class org.hibernate.cache.spi.AbstractRegionFactory
    • getDefaultAccessType

      public org.hibernate.cache.spi.access.AccessType getDefaultAccessType()
      Specified by:
      getDefaultAccessType in interface org.hibernate.cache.spi.RegionFactory
      Overrides:
      getDefaultAccessType in class org.hibernate.cache.spi.AbstractRegionFactory
    • nextTimestamp

      public long nextTimestamp()
      Specified by:
      nextTimestamp in interface org.hibernate.cache.spi.RegionFactory
      Overrides:
      nextTimestamp in class org.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:
      createDomainDataStorageAccess in class org.hibernate.cache.spi.support.RegionFactoryTemplate
    • createTimestampsRegionStorageAccess

      protected org.hibernate.cache.spi.support.StorageAccess createTimestampsRegionStorageAccess(String regionName, org.hibernate.engine.spi.SessionFactoryImplementor sessionFactory)
      Specified by:
      createTimestampsRegionStorageAccess in class org.hibernate.cache.spi.support.RegionFactoryTemplate
    • createQueryResultsRegionStorageAccess

      protected org.hibernate.cache.spi.support.StorageAccess createQueryResultsRegionStorageAccess(String regionName, org.hibernate.engine.spi.SessionFactoryImplementor sessionFactory)
      Specified by:
      createQueryResultsRegionStorageAccess in class org.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:
      buildDomainDataRegion in interface org.hibernate.cache.spi.RegionFactory
      Overrides:
      buildDomainDataRegion in class org.hibernate.cache.spi.support.RegionFactoryTemplate