public StandardQueryCache( final Settings settings, final Properties props, final UpdateTimestampsCache updateTimestampsCache, String regionName) throws HibernateException { if ( regionName == null ) { regionName = StandardQueryCache.class.getName(); } String prefix = settings.getCacheRegionPrefix(); if ( prefix != null ) { regionName = prefix + '.' + regionName; } LOG.startingQueryCache( regionName ); this.cacheRegion = settings.getRegionFactory().buildQueryResultsRegion( regionName, props ); this.updateTimestampsCache = updateTimestampsCache; }
public StandardQueryCache( final Settings settings, final Properties props, final UpdateTimestampsCache updateTimestampsCache, String regionName) throws HibernateException { if ( regionName == null ) { regionName = StandardQueryCache.class.getName(); } String prefix = settings.getCacheRegionPrefix(); if ( prefix != null ) { regionName = prefix + '.' + regionName; } LOG.startingQueryCache( regionName ); this.cacheRegion = settings.getRegionFactory().buildQueryResultsRegion( regionName, props ); this.updateTimestampsCache = updateTimestampsCache; }
public UpdateTimestampsCache(Settings settings, Properties props, final SessionFactoryImplementor factory) throws HibernateException { this.factory = factory; String prefix = settings.getCacheRegionPrefix(); String regionName = prefix == null ? REGION_NAME : prefix + '.' + REGION_NAME; LOG.startingUpdateTimestampsCache( regionName ); this.region = settings.getRegionFactory().buildTimestampsRegion( regionName, props ); } @SuppressWarnings({"UnusedDeclaration"})
public UpdateTimestampsCache(Settings settings, Properties props, final SessionFactoryImplementor factory) throws HibernateException { this.factory = factory; String prefix = settings.getCacheRegionPrefix(); String regionName = prefix == null ? REGION_NAME : prefix + '.' + REGION_NAME; LOG.startingUpdateTimestampsCache( regionName ); this.region = settings.getRegionFactory().buildTimestampsRegion( regionName, props ); } @SuppressWarnings({"UnusedDeclaration"})
@Override public Session openSession() { return new SessionImpl( connection, sessionFactory, getTransactionCoordinator(), autoJoinTransactions, sessionFactory.settings.getRegionFactory().nextTimestamp(), interceptor, flushBeforeCompletion, autoClose, connectionReleaseMode, tenantIdentifier ); }
@Override public Session openSession() { return new SessionImpl( connection, sessionFactory, getTransactionCoordinator(), autoJoinTransactions, sessionFactory.settings.getRegionFactory().nextTimestamp(), interceptor, flushBeforeCompletion, autoClose, connectionReleaseMode, tenantIdentifier ); }
/** * Tries to extract <code>HazelcastInstance</code> from <code>SessionFactoryImplementor</code>. * * @param sessionFactory Hibernate <code>SessionFactory</code> to extract settings from * @return currently used <code>HazelcastInstance</code> or null if an error occurs. */ public static HazelcastInstance getHazelcastInstance(final SessionFactoryImplementor sessionFactory) { final Settings settings = sessionFactory.getSettings(); final RegionFactory rf = settings.getRegionFactory(); if (rf instanceof AbstractHazelcastCacheRegionFactory) { return ((AbstractHazelcastCacheRegionFactory) rf).getHazelcastInstance(); } else { LOGGER.warning("Current 2nd level cache implementation is not HazelcastCacheRegionFactory!"); } return null; } }
settings.getRegionFactory().stop();
settings.getRegionFactory().stop();
settings.getRegionFactory().start( settings, properties ); this.queryPlanCache = new QueryPlanCache( this ); LOG.tracev( "Building cache for entity data [{0}]", model.getEntityName() ); EntityRegion entityRegion = settings.getRegionFactory().buildEntityRegion( cacheRegionName, properties, CacheDataDescriptionImpl.decode( model ) ); accessStrategy = entityRegion.buildAccessStrategy( accessType ); entityAccessStrategies.put( cacheRegionName, accessStrategy ); final NaturalIdRegion naturalIdRegion = settings.getRegionFactory().buildNaturalIdRegion( naturalIdCacheRegionName, properties, CacheDataDescriptionImpl.decode( model ) ); naturalIdAccessStrategy = naturalIdRegion.buildAccessStrategy( settings.getRegionFactory().getDefaultAccessType() ); entityAccessStrategies.put( naturalIdCacheRegionName, naturalIdAccessStrategy ); allCacheRegions.put( naturalIdCacheRegionName, naturalIdRegion ); LOG.tracev("Building cache for collection data [{0}]", model.getRole() ); CollectionRegion collectionRegion = settings.getRegionFactory().buildCollectionRegion( cacheRegionName, properties, CacheDataDescriptionImpl .decode( model ) ); accessStrategy = collectionRegion.buildAccessStrategy( accessType );
settings.getRegionFactory().start( settings, properties ); this.queryPlanCache = new QueryPlanCache( this ); LOG.tracev( "Building cache for entity data [{0}]", model.getEntityName() ); EntityRegion entityRegion = settings.getRegionFactory().buildEntityRegion( cacheRegionName, properties, CacheDataDescriptionImpl.decode( model ) ); accessStrategy = entityRegion.buildAccessStrategy( accessType ); entityAccessStrategies.put( cacheRegionName, accessStrategy ); final NaturalIdRegion naturalIdRegion = settings.getRegionFactory().buildNaturalIdRegion( naturalIdCacheRegionName, properties, CacheDataDescriptionImpl.decode( model ) ); naturalIdAccessStrategy = naturalIdRegion.buildAccessStrategy( settings.getRegionFactory().getDefaultAccessType() ); entityAccessStrategies.put( naturalIdCacheRegionName, naturalIdAccessStrategy ); allCacheRegions.put( naturalIdCacheRegionName, naturalIdRegion ); LOG.tracev("Building cache for collection data [{0}]", model.getRole() ); CollectionRegion collectionRegion = settings.getRegionFactory().buildCollectionRegion( cacheRegionName, properties, CacheDataDescriptionImpl .decode( model ) ); accessStrategy = collectionRegion.buildAccessStrategy( accessType );
settings.getRegionFactory().start( settings, properties ); this.queryPlanCache = new QueryPlanCache( this ); LOG.tracev( "Building cache for entity data [{0}]", model.getEntity().getName() ); EntityRegion entityRegion = settings.getRegionFactory().buildEntityRegion( cacheRegionName, properties, CacheDataDescriptionImpl.decode( model ) ); LOG.tracev( "Building cache for collection data [{0}]", model.getAttribute().getRole() ); CollectionRegion collectionRegion = settings.getRegionFactory().buildCollectionRegion( cacheRegionName, properties, CacheDataDescriptionImpl.decode( model ) );
settings.getRegionFactory().start( settings, properties ); this.queryPlanCache = new QueryPlanCache( this ); LOG.tracev( "Building cache for entity data [{0}]", model.getEntity().getName() ); EntityRegion entityRegion = settings.getRegionFactory().buildEntityRegion( cacheRegionName, properties, CacheDataDescriptionImpl.decode( model ) ); LOG.tracev( "Building cache for collection data [{0}]", model.getAttribute().getRole() ); CollectionRegion collectionRegion = settings.getRegionFactory().buildCollectionRegion( cacheRegionName, properties, CacheDataDescriptionImpl.decode( model ) );
@Override protected void startUp() { super.startUp(); TestRegionFactory regionFactory = TestRegionFactoryProvider.load().wrap(sessionFactory().getSettings().getRegionFactory()); TIMEOUT = regionFactory.getPendingPutsCacheConfiguration().expiration().maxIdle(); region = TEST_SESSION_ACCESS.getRegion(sessionFactory(), Item.class.getName()); entityCache = region.getCache(); }
@Test public void testRedeployment() throws Exception { addEntityCheckCache( sessionFactory() ); bindToJndi = false; rebuildSessionFactory(); addEntityCheckCache( sessionFactory() ); TestRegionFactory regionFactory = TestRegionFactoryProvider.load().wrap(sessionFactory().getSettings().getRegionFactory()); Cache cache = regionFactory.getCacheManager().getCache( Item.class.getName() ); assertEquals( ComponentStatus.RUNNING, cache.getStatus() ); }
Environment.USE_MINIMAL_PUTS, properties, settings.getRegionFactory().isMinimalPutsEnabledByDefault() ); if ( debugEnabled ) {
Environment.USE_MINIMAL_PUTS, properties, settings.getRegionFactory().isMinimalPutsEnabledByDefault() ); if ( debugEnabled ) {