Search in sources :

Example 11 with EmbeddedCacheManager

use of org.infinispan.manager.EmbeddedCacheManager in project wildfly by wildfly.

the class InfinispanRegionFactory method createCacheManager.

@Override
protected EmbeddedCacheManager createCacheManager(Properties properties, final ServiceRegistry serviceRegistry) throws CacheException {
    // Find a suitable service name to represent this session factory instance
    String name = properties.getProperty(AvailableSettings.SESSION_FACTORY_NAME);
    String container = properties.getProperty(CACHE_CONTAINER, DEFAULT_CACHE_CONTAINER);
    HibernateSecondLevelCache.addSecondLevelCacheDependencies(properties, null);
    Properties cacheSettings = new Properties();
    cacheSettings.put(HibernateSecondLevelCache.CACHE_TYPE, CACHE_PRIVATE);
    cacheSettings.put(HibernateSecondLevelCache.CONTAINER, container);
    if (name != null) {
        cacheSettings.put(HibernateSecondLevelCache.NAME, name);
    }
    try {
        // start a private cache for non-JPA use and return the started cache.
        wrapper = Notification.startCache(Classification.INFINISPAN, cacheSettings);
        return (EmbeddedCacheManager) wrapper.getValue();
    } catch (Exception e) {
        throw new CacheException(e);
    }
}
Also used : CacheException(org.hibernate.cache.CacheException) Properties(java.util.Properties) EmbeddedCacheManager(org.infinispan.manager.EmbeddedCacheManager) CacheException(org.hibernate.cache.CacheException)

Example 12 with EmbeddedCacheManager

use of org.infinispan.manager.EmbeddedCacheManager in project wildfly by wildfly.

the class InfinispanRegionFactory method createCacheManager.

@Override
protected EmbeddedCacheManager createCacheManager(Properties properties) throws CacheException {
    // Find a suitable service name to represent this session factory instance
    String name = properties.getProperty(AvailableSettings.SESSION_FACTORY_NAME);
    String container = properties.getProperty(CACHE_CONTAINER, DEFAULT_CACHE_CONTAINER);
    HibernateSecondLevelCache.addSecondLevelCacheDependencies(properties, null);
    Properties cacheSettings = new Properties();
    cacheSettings.put(HibernateSecondLevelCache.CACHE_TYPE, CACHE_PRIVATE);
    cacheSettings.put(HibernateSecondLevelCache.CONTAINER, container);
    if (name != null) {
        cacheSettings.put(HibernateSecondLevelCache.NAME, name);
    }
    try {
        // start a private cache for non-JPA use and return the started cache.
        wrapper = Notification.startCache(Classification.INFINISPAN, cacheSettings);
        return (EmbeddedCacheManager) wrapper.getValue();
    } catch (Exception e) {
        throw new CacheException(e);
    }
}
Also used : CacheException(org.hibernate.cache.CacheException) Properties(java.util.Properties) EmbeddedCacheManager(org.infinispan.manager.EmbeddedCacheManager) CacheException(org.hibernate.cache.CacheException)

Example 13 with EmbeddedCacheManager

use of org.infinispan.manager.EmbeddedCacheManager in project wildfly by wildfly.

the class SharedInfinispanRegionFactory method createCacheManager.

@Override
protected EmbeddedCacheManager createCacheManager(Properties properties) {
    String container = properties.getProperty(CACHE_CONTAINER, DEFAULT_CACHE_CONTAINER);
    Properties cacheSettings = new Properties();
    cacheSettings.put(HibernateSecondLevelCache.CONTAINER, container);
    try {
        // Get the (shared) cache manager for JPA application use
        wrapper = Notification.startCache(Classification.INFINISPAN, cacheSettings);
        return (EmbeddedCacheManager) wrapper.getValue();
    } catch (Exception e) {
        throw new CacheException(e);
    }
}
Also used : CacheException(org.hibernate.cache.CacheException) Properties(java.util.Properties) EmbeddedCacheManager(org.infinispan.manager.EmbeddedCacheManager) CacheException(org.hibernate.cache.CacheException)

Example 14 with EmbeddedCacheManager

use of org.infinispan.manager.EmbeddedCacheManager in project gora by apache.

the class SimulationDriver method startHotRodServer.

protected void startHotRodServer(GlobalConfigurationBuilder gbuilder, ConfigurationBuilder builder, int nodeIndex) {
    TransportFlags transportFlags = new TransportFlags();
    EmbeddedCacheManager cm = addClusterEnabledCacheManager(gbuilder, builder, transportFlags);
    HotRodServer server = HotRodClientTestingUtil.startHotRodServer(cm);
    servers.add(server);
}
Also used : HotRodServer(org.infinispan.server.hotrod.HotRodServer) TransportFlags(org.infinispan.test.fwk.TransportFlags) EmbeddedCacheManager(org.infinispan.manager.EmbeddedCacheManager)

Aggregations

EmbeddedCacheManager (org.infinispan.manager.EmbeddedCacheManager)14 Properties (java.util.Properties)6 CacheException (org.hibernate.cache.CacheException)4 DefaultCacheManager (org.infinispan.manager.DefaultCacheManager)3 Test (org.junit.Test)3 CollectionRegionImpl (org.hibernate.cache.infinispan.collection.CollectionRegionImpl)2 EntityRegionImpl (org.hibernate.cache.infinispan.entity.EntityRegionImpl)2 AdvancedCache (org.infinispan.AdvancedCache)2 Configuration (org.infinispan.configuration.cache.Configuration)2 ConfigurationBuilder (org.infinispan.configuration.cache.ConfigurationBuilder)2 GlobalConfigurationBuilder (org.infinispan.configuration.global.GlobalConfigurationBuilder)2 ServiceName (org.jboss.msc.service.ServiceName)2 LinkedList (java.util.LinkedList)1 List (java.util.List)1 Consumer (java.util.function.Consumer)1 Function (java.util.function.Function)1 Supplier (java.util.function.Supplier)1 InfinispanRegionFactory (org.hibernate.cache.infinispan.InfinispanRegionFactory)1 QueryResultsRegionImpl (org.hibernate.cache.infinispan.query.QueryResultsRegionImpl)1 TimestampsRegionImpl (org.hibernate.cache.infinispan.timestamp.TimestampsRegionImpl)1