Search in sources :

Example 16 with CacheConfig

use of com.hazelcast.config.CacheConfig in project hazelcast by hazelcast.

the class CacheGetConfigOperation method run.

@Override
public void run() throws Exception {
    final ICacheService service = getService();
    CacheConfig cacheConfig = service.getCacheConfig(name);
    if (cacheConfig == null) {
        cacheConfig = service.findCacheConfig(simpleName);
        if (cacheConfig != null) {
            cacheConfig.setManagerPrefix(name.substring(0, name.lastIndexOf(simpleName)));
            CacheConfig existingCacheConfig = service.putCacheConfigIfAbsent(cacheConfig);
            if (existingCacheConfig != null) {
                cacheConfig = existingCacheConfig;
            }
        }
    }
    response = cacheConfig;
}
Also used : ICacheService(com.hazelcast.cache.impl.ICacheService) CacheConfig(com.hazelcast.config.CacheConfig)

Example 17 with CacheConfig

use of com.hazelcast.config.CacheConfig in project hazelcast by hazelcast.

the class CacheListenerRegistrationOperation method run.

@Override
public void run() throws Exception {
    final AbstractCacheService service = getService();
    CacheConfig cacheConfig = service.getCacheConfig(name);
    if (register) {
        service.cacheEntryListenerRegistered(name, cacheEntryListenerConfiguration);
    } else if (cacheConfig != null) {
        service.cacheEntryListenerDeregistered(name, cacheEntryListenerConfiguration);
    }
}
Also used : CacheConfig(com.hazelcast.config.CacheConfig) AbstractCacheService(com.hazelcast.cache.impl.AbstractCacheService)

Example 18 with CacheConfig

use of com.hazelcast.config.CacheConfig in project hazelcast by hazelcast.

the class AbstractCacheAllPartitionsTask method getOperationProvider.

protected CacheOperationProvider getOperationProvider(String name) {
    ICacheService service = getService(CacheService.SERVICE_NAME);
    CacheConfig cacheConfig = service.getCacheConfig(name);
    if (cacheConfig == null) {
        throw new CacheNotExistsException("Cache config for cache " + name + " has not been created yet!");
    }
    return service.getCacheOperationProvider(name, cacheConfig.getInMemoryFormat());
}
Also used : ICacheService(com.hazelcast.cache.impl.ICacheService) CacheConfig(com.hazelcast.config.CacheConfig) CacheNotExistsException(com.hazelcast.cache.CacheNotExistsException)

Example 19 with CacheConfig

use of com.hazelcast.config.CacheConfig in project hazelcast by hazelcast.

the class AbstractCacheMessageTask method getOperationProvider.

protected CacheOperationProvider getOperationProvider(String name) {
    ICacheService service = getService(CacheService.SERVICE_NAME);
    final CacheConfig cacheConfig = service.getCacheConfig(name);
    if (cacheConfig == null) {
        throw new CacheNotExistsException("Cache " + name + " is already destroyed or not created yet, on " + nodeEngine.getLocalMember());
    }
    final InMemoryFormat inMemoryFormat = cacheConfig.getInMemoryFormat();
    return service.getCacheOperationProvider(name, inMemoryFormat);
}
Also used : ICacheService(com.hazelcast.cache.impl.ICacheService) LegacyCacheConfig(com.hazelcast.config.LegacyCacheConfig) CacheConfig(com.hazelcast.config.CacheConfig) CacheNotExistsException(com.hazelcast.cache.CacheNotExistsException) InMemoryFormat(com.hazelcast.config.InMemoryFormat)

Example 20 with CacheConfig

use of com.hazelcast.config.CacheConfig in project hazelcast by hazelcast.

the class CacheCreateConfigMessageTask method extractCacheConfigFromMessage.

private CacheConfig extractCacheConfigFromMessage() {
    int clientVersion = getClientVersion();
    CacheConfig cacheConfig = null;
    if (BuildInfo.UNKNOWN_HAZELCAST_VERSION == clientVersion) {
        boolean compatibilityEnabled = nodeEngine.getProperties().getBoolean(GroupProperty.COMPATIBILITY_3_6_CLIENT_ENABLED);
        if (compatibilityEnabled) {
            LegacyCacheConfig legacyCacheConfig = nodeEngine.toObject(parameters.cacheConfig, LegacyCacheConfig.class);
            if (null == legacyCacheConfig) {
                return null;
            }
            return legacyCacheConfig.getConfigAndReset();
        }
    }
    return (CacheConfig) nodeEngine.toObject(parameters.cacheConfig);
}
Also used : LegacyCacheConfig(com.hazelcast.config.LegacyCacheConfig) LegacyCacheConfig(com.hazelcast.config.LegacyCacheConfig) CacheConfig(com.hazelcast.config.CacheConfig)

Aggregations

CacheConfig (com.hazelcast.config.CacheConfig)77 Test (org.junit.Test)30 CacheManager (javax.cache.CacheManager)28 QuickTest (com.hazelcast.test.annotation.QuickTest)27 ParallelTest (com.hazelcast.test.annotation.ParallelTest)25 CachingProvider (javax.cache.spi.CachingProvider)16 HazelcastServerCachingProvider (com.hazelcast.cache.impl.HazelcastServerCachingProvider)14 HazelcastInstance (com.hazelcast.core.HazelcastInstance)14 AssertTask (com.hazelcast.test.AssertTask)13 NearCacheConfig (com.hazelcast.config.NearCacheConfig)11 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)9 ICacheService (com.hazelcast.cache.impl.ICacheService)8 HazelcastClientCachingProvider (com.hazelcast.client.cache.impl.HazelcastClientCachingProvider)8 ICache (com.hazelcast.cache.ICache)5 ClientConfig (com.hazelcast.client.config.ClientConfig)5 Config (com.hazelcast.config.Config)5 Data (com.hazelcast.nio.serialization.Data)5 CacheService (com.hazelcast.cache.impl.CacheService)4 HazelcastServerCachingProvider.createCachingProvider (com.hazelcast.cache.impl.HazelcastServerCachingProvider.createCachingProvider)4 Map (java.util.Map)4