Class InfinispanRegionFactory

  • All Implemented Interfaces:
    Serializable, org.hibernate.cache.spi.RegionFactory, org.hibernate.service.Service, org.hibernate.service.spi.Stoppable, org.infinispan.hibernate.cache.commons.TimeSource, org.infinispan.hibernate.cache.spi.InfinispanProperties

    public class InfinispanRegionFactory
    extends Object
    implements org.hibernate.cache.spi.RegionFactory, org.infinispan.hibernate.cache.commons.TimeSource, org.infinispan.hibernate.cache.spi.InfinispanProperties
    A RegionFactory for Infinispan-backed cache regions.
    Since:
    3.5
    Author:
    Chris Bredesen, Galder ZamarreƱo
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected Map<String,​String> baseConfigurations
      Defines custom mapping for regionName -> cacheName and also DataType.key -> cacheName (for the case that you want to change the cache configuration for whole type)
      protected Map<String,​org.infinispan.configuration.cache.ConfigurationBuilder> configOverrides
      Defines configuration properties applied on top of configuration set in any file, by regionName or DataType.key
      • Fields inherited from interface org.infinispan.hibernate.cache.spi.InfinispanProperties

        CACHE_MANAGER_RESOURCE_PROP, COLLECTION, COLLECTION_CACHE_RESOURCE_PROP, CONFIG_SUFFIX, DEF_ENTITY_RESOURCE, DEF_INFINISPAN_CONFIG_RESOURCE, DEF_PENDING_PUTS_RESOURCE, DEF_QUERY_RESOURCE, DEF_TIMESTAMPS_RESOURCE, DEF_USE_SYNCHRONIZATION, DEPRECATED_MAX_ENTRIES_SUFFIX, DEPRECATED_STRATEGY_SUFFIX, DEPRECATED_WAKE_UP_INTERVAL_SUFFIX, ENTITY, ENTITY_CACHE_RESOURCE_PROP, IMMUTABLE_ENTITY, IMMUTABLE_ENTITY_CACHE_RESOURCE_PROP, INFINISPAN_CONFIG_LOCAL_RESOURCE, INFINISPAN_CONFIG_RESOURCE_PROP, INFINISPAN_GLOBAL_STATISTICS_PROP, INFINISPAN_USE_SYNCHRONIZATION_PROP, LIFESPAN_SUFFIX, MAX_IDLE_SUFFIX, NATURAL_ID, NATURAL_ID_CACHE_RESOURCE_PROP, PENDING_PUTS, PENDING_PUTS_CACHE_NAME, PENDING_PUTS_CACHE_RESOURCE_PROP, PREFIX, QUERY, QUERY_CACHE_RESOURCE_PROP, SIZE_SUFFIX, TIMESTAMPS, TIMESTAMPS_CACHE_RESOURCE_PROP, WAKE_UP_INTERVAL_SUFFIX
      • Fields inherited from interface org.hibernate.cache.spi.RegionFactory

        DEFAULT_QUERY_RESULTS_REGION_UNQUALIFIED_NAME, DEFAULT_UPDATE_TIMESTAMPS_REGION_UNQUALIFIED_NAME
    • Field Detail

      • baseConfigurations

        protected final Map<String,​String> baseConfigurations
        Defines custom mapping for regionName -> cacheName and also DataType.key -> cacheName (for the case that you want to change the cache configuration for whole type)
      • configOverrides

        protected final Map<String,​org.infinispan.configuration.cache.ConfigurationBuilder> configOverrides
        Defines configuration properties applied on top of configuration set in any file, by regionName or DataType.key
    • Constructor Detail

      • InfinispanRegionFactory

        public InfinispanRegionFactory()
        Create a new instance using the default configuration.
      • InfinispanRegionFactory

        public InfinispanRegionFactory​(Properties props)
        Create a new instance using conifguration properties in props.
        Parameters:
        props - Environmental properties; currently unused.
    • Method Detail

      • 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
      • buildQueryResultsRegion

        public org.hibernate.cache.spi.QueryResultsRegion buildQueryResultsRegion​(String regionName,
                                                                                  org.hibernate.engine.spi.SessionFactoryImplementor sessionFactory)
        Specified by:
        buildQueryResultsRegion in interface org.hibernate.cache.spi.RegionFactory
      • buildTimestampsRegion

        public org.hibernate.cache.spi.TimestampsRegion buildTimestampsRegion​(String regionName,
                                                                              org.hibernate.engine.spi.SessionFactoryImplementor sessionFactory)
        Specified by:
        buildTimestampsRegion in interface org.hibernate.cache.spi.RegionFactory
      • createTimestampsRegion

        protected TimestampsRegionImpl createTimestampsRegion​(org.infinispan.AdvancedCache cache,
                                                              String regionName)
      • getPendingPutsCacheConfiguration

        public org.infinispan.configuration.cache.Configuration getPendingPutsCacheConfiguration()
      • getCacheKeysFactory

        protected org.hibernate.cache.spi.CacheKeysFactory getCacheKeysFactory()
      • isMinimalPutsEnabledByDefault

        public boolean isMinimalPutsEnabledByDefault()
        Specified by:
        isMinimalPutsEnabledByDefault in interface org.hibernate.cache.spi.RegionFactory
      • getDefaultAccessType

        public org.hibernate.cache.spi.access.AccessType getDefaultAccessType()
        Specified by:
        getDefaultAccessType in interface org.hibernate.cache.spi.RegionFactory
      • qualify

        public String qualify​(String regionName)
        Specified by:
        qualify in interface org.hibernate.cache.spi.RegionFactory
      • createTransactionContext

        public org.hibernate.cache.spi.CacheTransactionSynchronization createTransactionContext​(org.hibernate.engine.spi.SharedSessionContractImplementor session)
        Specified by:
        createTransactionContext in interface org.hibernate.cache.spi.RegionFactory
      • nextTimestamp

        public long nextTimestamp()
        Specified by:
        nextTimestamp in interface org.hibernate.cache.spi.RegionFactory
        Specified by:
        nextTimestamp in interface org.infinispan.hibernate.cache.commons.TimeSource
      • setCacheManager

        public void setCacheManager​(org.infinispan.manager.EmbeddedCacheManager manager)
      • getCacheManager

        public org.infinispan.manager.EmbeddedCacheManager getCacheManager()
      • start

        public void start​(org.hibernate.boot.spi.SessionFactoryOptions settings,
                          Map configValues)
                   throws org.hibernate.cache.CacheException
        Specified by:
        start in interface org.hibernate.cache.spi.RegionFactory
        Throws:
        org.hibernate.cache.CacheException
      • createCacheManager

        protected org.infinispan.manager.EmbeddedCacheManager createCacheManager​(Properties properties,
                                                                                 org.hibernate.service.ServiceRegistry serviceRegistry)
      • stop

        public void stop()
        Specified by:
        stop in interface org.hibernate.service.spi.Stoppable
      • stopCacheRegions

        protected void stopCacheRegions()
      • stopCacheManager

        protected void stopCacheManager()
      • getCache

        protected org.infinispan.AdvancedCache getCache​(String cacheName,
                                                        String unqualifiedRegionName,
                                                        org.infinispan.hibernate.cache.commons.DataType type,
                                                        Collection<String> legacyUnqualifiedNames)