protected QueryResultsRegion makeQueryResultsRegion(String regionName) { // make sure there is not an existing domain-data region with that name.. final Region existing = regionsByName.get( regionName ); if ( existing != null ) { if ( !QueryResultsRegion.class.isInstance( existing ) ) { throw new IllegalStateException( "Cannot store both domain-data and query-result-data in the same region [" + regionName ); } throw new IllegalStateException( "Illegal call to create QueryResultsRegion - one already existed" ); } return regionFactory.buildQueryResultsRegion( regionName, getSessionFactory() ); }
public EnabledCaching(SessionFactoryImplementor sessionFactory) { this.sessionFactory = sessionFactory; this.regionFactory = getSessionFactory().getSessionFactoryOptions().getServiceRegistry().getService( RegionFactory.class ); this.regionFactory.start( sessionFactory.getSessionFactoryOptions(), sessionFactory.getProperties() ); if ( getSessionFactory().getSessionFactoryOptions().isQueryCacheEnabled() ) { final TimestampsRegion timestampsRegion = regionFactory.buildTimestampsRegion( RegionFactory.DEFAULT_UPDATE_TIMESTAMPS_REGION_UNQUALIFIED_NAME, sessionFactory ); timestampsCache = sessionFactory.getSessionFactoryOptions() .getTimestampsCacheFactory() .buildTimestampsCache( this, timestampsRegion ); legacySecondLevelCacheNames.add( timestampsRegion.getName() ); final QueryResultsRegion queryResultsRegion = regionFactory.buildQueryResultsRegion( RegionFactory.DEFAULT_QUERY_RESULTS_REGION_UNQUALIFIED_NAME, sessionFactory ); regionsByName.put( queryResultsRegion.getName(), queryResultsRegion ); defaultQueryResultsCache = new QueryResultsCacheImpl( queryResultsRegion, timestampsCache ); } else { timestampsCache = new TimestampsCacheDisabledImpl(); defaultQueryResultsCache = null; } }
protected QueryResultsRegion makeQueryResultsRegion(String regionName) { // make sure there is not an existing domain-data region with that name.. final Region existing = regionsByName.get( regionName ); if ( existing != null ) { if ( !QueryResultsRegion.class.isInstance( existing ) ) { throw new IllegalStateException( "Cannot store both domain-data and query-result-data in the same region [" + regionName ); } throw new IllegalStateException( "Illegal call to create QueryResultsRegion - one already existed" ); } return regionFactory.buildQueryResultsRegion( regionName, getSessionFactory() ); }
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 EnabledCaching(SessionFactoryImplementor sessionFactory) { this.sessionFactory = sessionFactory; this.regionFactory = getSessionFactory().getSessionFactoryOptions().getServiceRegistry().getService( RegionFactory.class ); this.regionFactory.start( sessionFactory.getSessionFactoryOptions(), sessionFactory.getProperties() ); if ( getSessionFactory().getSessionFactoryOptions().isQueryCacheEnabled() ) { final TimestampsRegion timestampsRegion = regionFactory.buildTimestampsRegion( RegionFactory.DEFAULT_UPDATE_TIMESTAMPS_REGION_UNQUALIFIED_NAME, sessionFactory ); timestampsCache = sessionFactory.getSessionFactoryOptions() .getTimestampsCacheFactory() .buildTimestampsCache( this, timestampsRegion ); legacySecondLevelCacheNames.add( timestampsRegion.getName() ); final QueryResultsRegion queryResultsRegion = regionFactory.buildQueryResultsRegion( RegionFactory.DEFAULT_QUERY_RESULTS_REGION_UNQUALIFIED_NAME, sessionFactory ); regionsByName.put( queryResultsRegion.getName(), queryResultsRegion ); defaultQueryResultsCache = new QueryResultsCacheImpl( queryResultsRegion, timestampsCache ); } else { timestampsCache = new TimestampsCacheDisabledImpl(); defaultQueryResultsCache = null; } }