Package com.hazelcast.config

Examples of com.hazelcast.config.CacheConfig


    @Test
    public void testCachesTypedConfig() {
        CacheManager cacheManager = cachingProvider1.getCacheManager();

        CacheConfig<Integer, Long> config = new CacheConfig();
        String cacheName = "test";
        config.setName(cacheName);
        config.setTypes(Integer.class, Long.class);

        Cache<Integer, Long> cache = cacheManager.createCache(cacheName, config);
        Cache<Integer, Long> cache2 = cacheManager.getCache(cacheName, config.getKeyType(), config.getValueType());

        assertNotNull(cache);
        assertNotNull(cache2);
    }
View Full Code Here


            //REGISTER LISTENERS
            registerListeners(newCacheConfig, cacheProxy);
            return cacheProxy;
        }
        ICache<?, ?> cache = getOrPutIfAbsent(current.getNameWithPrefix(), cacheProxy);
        CacheConfig config = cache.getConfiguration(CacheConfig.class);
        if (config.equals(newCacheConfig)) {
            return (ICache<K, V>) cache;
        }
        throw new CacheException("A cache named " + cacheName + " already exists.");
    }
View Full Code Here

        }
    }

    @Override
    public void destroyCache(String objectName, boolean isLocal, String callerUuid) {
        CacheConfig config = deleteCacheConfig(objectName);
        destroySegments(objectName);

        if (!isLocal) {
            deregisterAllListener(objectName);
        }
View Full Code Here

        }
    }

    @Override
    public CacheConfig createCacheConfigIfAbsent(CacheConfig config, boolean isLocal) {
        final CacheConfig localConfig = configs.putIfAbsent(config.getNameWithPrefix(), config);
        if (localConfig == null) {
            if (config.isStatisticsEnabled()) {
                setStatisticsEnabled(config, config.getNameWithPrefix(), true);
            }
            if (config.isManagementEnabled()) {
View Full Code Here

    @Override
    public void run()
            throws Exception {
        final CacheService service = getService();
        CacheConfig cacheConfig = service.getCacheConfig(name);
        if (register) {
            //REGISTER
            if (cacheConfig == null) {
                throw new IllegalStateException("CacheConfig does not exist!!! name: " + name);
            }
            cacheConfig.addCacheEntryListenerConfiguration(cacheEntryListenerConfiguration);
        } else if (cacheConfig != null) {
            //UNREGISTER
            cacheConfig.removeCacheEntryListenerConfiguration(cacheEntryListenerConfiguration);
        }
    }
View Full Code Here

        data = new HashMap<String, Map<Data, CacheRecord>>();

        Iterator<ICacheRecordStore> iter = segment.cacheIterator();
        while (iter.hasNext()) {
            ICacheRecordStore cacheRecordStore = iter.next();
            CacheConfig cacheConfig = cacheRecordStore.getConfig();
            if (cacheConfig.getAsyncBackupCount() + cacheConfig.getBackupCount() >= replicaIndex) {
                data.put(cacheRecordStore.getName(), cacheRecordStore.getReadOnlyRecords());
            }
        }

        configs = new ArrayList<CacheConfig>(segment.getCacheConfigs());
View Full Code Here

    protected void readInternal(ObjectDataInput in)
            throws IOException {
        super.readInternal(in);
        int confSize = in.readInt();
        for (int i = 0; i < confSize; i++) {
            final CacheConfig config = in.readObject();
            configs.add(config);
        }
        int count = in.readInt();
        for (int i = 0; i < count; i++) {
            int subCount = in.readInt();
View Full Code Here

    @Override
    public void run()
            throws Exception {
        final CacheService service = getService();
        final CacheConfig cacheConfig = service.getCacheConfig(name);
        if (cacheConfig == null) {
            CacheSimpleConfig simpleConfig = service.findCacheConfig(simpleName);
            if (simpleConfig != null) {
                try {
                    CacheConfig cacheConfigFromSimpleConfig = new CacheConfig(simpleConfig);
                    cacheConfigFromSimpleConfig.setName(name);
                    cacheConfigFromSimpleConfig.setManagerPrefix(name.substring(0, name.lastIndexOf(simpleName)));
                    if (service.createCacheConfigIfAbsent(cacheConfigFromSimpleConfig, false) == null) {
                        response = cacheConfigFromSimpleConfig;
                        return;
                    }
                } catch (Exception e) {
View Full Code Here

        this.name = name;
    }

    CacheOperationProvider getOperationProvider() {
        ICacheService service = getService();
        CacheConfig cacheConfig = service.getCacheConfig(name);
        return service.getCacheOperationProvider(name, cacheConfig.getInMemoryFormat());
    }
View Full Code Here

TOP

Related Classes of com.hazelcast.config.CacheConfig

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.