Java 类org.hibernate.cache.spi.RegionFactory 实例源码

项目:lams    文件:LocalSessionFactoryBuilder.java   
@Override
public Settings buildSettings(Properties props, ServiceRegistry serviceRegistry) throws HibernateException {
    Settings settings = super.buildSettings(props, serviceRegistry);
    if (this.cacheRegionFactory != null) {
        try {
            Method setRegionFactory = Settings.class.getDeclaredMethod("setRegionFactory", RegionFactory.class);
            setRegionFactory.setAccessible(true);
            setRegionFactory.invoke(settings, this.cacheRegionFactory);
        }
        catch (Exception ex) {
            throw new IllegalStateException("Failed to invoke Hibernate's setRegionFactory method", ex);
        }
    }
    return settings;
}
项目:lams    文件:AnnotationBinder.java   
private static CacheConcurrencyStrategy determineCacheConcurrencyStrategy(Mappings mappings) {
    if ( DEFAULT_CACHE_CONCURRENCY_STRATEGY == null ) {
        final RegionFactory cacheRegionFactory = SettingsFactory.createRegionFactory(
                mappings.getConfigurationProperties(), true
        );
        DEFAULT_CACHE_CONCURRENCY_STRATEGY = CacheConcurrencyStrategy.fromAccessType( cacheRegionFactory.getDefaultAccessType() );
    }
    return DEFAULT_CACHE_CONCURRENCY_STRATEGY;
}
项目:spring4-understanding    文件:LocalSessionFactoryBuilder.java   
@Override
public Settings buildSettings(Properties props, ServiceRegistry serviceRegistry) throws HibernateException {
    Settings settings = super.buildSettings(props, serviceRegistry);
    if (this.cacheRegionFactory != null) {
        try {
            Method setRegionFactory = Settings.class.getDeclaredMethod("setRegionFactory", RegionFactory.class);
            setRegionFactory.setAccessible(true);
            setRegionFactory.invoke(settings, this.cacheRegionFactory);
        }
        catch (Exception ex) {
            throw new IllegalStateException("Failed to invoke Hibernate's setRegionFactory method", ex);
        }
    }
    return settings;
}
项目:hazelcast-hibernate5    文件:HazelcastAccessor.java   
/**
 * Tries to extract <code>HazelcastInstance</code> from <code>SessionFactoryImplementor</code>.
 *
 * @param sessionFactory the {@code SessionFactoryImplementor} to retrieve the Hazelcast instance for
 * @return currently used <code>HazelcastInstance</code> or null if an error occurs.
 */
public static HazelcastInstance getHazelcastInstance(final SessionFactoryImplementor sessionFactory) {
    final RegionFactory rf = sessionFactory.getSessionFactoryOptions()
            .getServiceRegistry().getService(RegionFactory.class);
    if (rf instanceof AbstractHazelcastCacheRegionFactory) {
        return ((AbstractHazelcastCacheRegionFactory) rf).getHazelcastInstance();
    } else {
        LOGGER.warning("Current 2nd level cache implementation is not HazelcastCacheRegionFactory!");
    }
    return null;
}
项目:hazelcast-hibernate    文件:HazelcastAccessor.java   
/**
 * 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;
}
项目:sdcct    文件:CacheRegionFactory.java   
@Override
@SuppressWarnings({ CompilerWarnings.RAWTYPES })
public CacheRegionFactory initiateService(Map configValues, ServiceRegistryImplementor serviceRegistry) {
    CacheRegionFactory service = super.initiateService(configValues, serviceRegistry);

    serviceRegistry.locateServiceBinding(RegionFactory.class).setService(service);

    return service;
}
项目:lams    文件:Settings.java   
public RegionFactory getRegionFactory() {
    return regionFactory;
}
项目:lams    文件:Settings.java   
void setRegionFactory(RegionFactory regionFactory) {
    this.regionFactory = regionFactory;
}
项目:lams    文件:MetadataImpl.java   
@Override
public AccessType initialize() {
    final RegionFactory regionFactory = getServiceRegistry().getService( RegionFactory.class );
    return regionFactory.getDefaultAccessType();
}
项目:lams    文件:CacheImpl.java   
@Override
public RegionFactory getRegionFactory() {
    return regionFactory;
}
项目:lams    文件:RegionFactoryInitiator.java   
@Override
public Class<RegionFactory> getServiceInitiated() {
    return RegionFactory.class;
}
项目:owsi-core-parent    文件:DefaultJpaConfigurationProvider.java   
@Override
public Class<? extends RegionFactory> getEhCacheRegionFactory() {
    return ehCacheRegionFactory;
}
项目:lams    文件:LocalSessionFactoryBean.java   
/**
 * Set the Hibernate RegionFactory to use for the SessionFactory.
 * Allows for using a Spring-managed RegionFactory instance.
 * <p>Note: If this is set, the Hibernate settings should not define a
 * cache provider to avoid meaningless double configuration.
 * @see org.hibernate.cache.spi.RegionFactory
 * @see LocalSessionFactoryBuilder#setCacheRegionFactory
 */
public void setCacheRegionFactory(RegionFactory cacheRegionFactory) {
    this.cacheRegionFactory = cacheRegionFactory;
}
项目:lams    文件:LocalSessionFactoryBuilder.java   
/**
 * Set the Hibernate RegionFactory to use for the SessionFactory.
 * Allows for using a Spring-managed RegionFactory instance.
 * <p>Note: If this is set, the Hibernate settings should not define a
 * cache provider to avoid meaningless double configuration.
 * @see org.hibernate.cache.spi.RegionFactory
 */
public LocalSessionFactoryBuilder setCacheRegionFactory(RegionFactory cacheRegionFactory) {
    this.cacheRegionFactory = cacheRegionFactory;
    return this;
}
项目:lams    文件:CacheImplementor.java   
/**
 *
 * @return The {@code RegionFactory}
 */
public RegionFactory getRegionFactory();
项目:spring4-understanding    文件:LocalSessionFactoryBean.java   
/**
 * Set the Hibernate RegionFactory to use for the SessionFactory.
 * Allows for using a Spring-managed RegionFactory instance.
 * <p>Note: If this is set, the Hibernate settings should not define a
 * cache provider to avoid meaningless double configuration.
 * @since 4.0
 * @see org.hibernate.cache.spi.RegionFactory
 * @see LocalSessionFactoryBuilder#setCacheRegionFactory
 */
public void setCacheRegionFactory(RegionFactory cacheRegionFactory) {
    this.cacheRegionFactory = cacheRegionFactory;
}
项目:spring4-understanding    文件:LocalSessionFactoryBuilder.java   
/**
 * Set the Hibernate RegionFactory to use for the SessionFactory.
 * Allows for using a Spring-managed RegionFactory instance.
 * <p>Note: If this is set, the Hibernate settings should not define a
 * cache provider to avoid meaningless double configuration.
 * @since 4.0
 * @see org.hibernate.cache.spi.RegionFactory
 */
public LocalSessionFactoryBuilder setCacheRegionFactory(RegionFactory cacheRegionFactory) {
    this.cacheRegionFactory = cacheRegionFactory;
    return this;
}
项目:owsi-core-parent    文件:IJpaPropertiesProvider.java   
Class<? extends RegionFactory> getEhCacheRegionFactory();