Package com.hazelcast.config

Examples of com.hazelcast.config.MaxSizeConfig


        cfg.setProperty(GroupProperties.PROP_PARTITION_COUNT, "1");
        MapConfig mc = cfg.getMapConfig(mapName);
        mc.setEvictionPolicy(EvictionPolicy.LRU);
        mc.setEvictionPercentage(20);
        mc.setMinEvictionCheckMillis(0L);
        MaxSizeConfig msc = new MaxSizeConfig();
        msc.setMaxSizePolicy(MaxSizeConfig.MaxSizePolicy.PER_NODE);
        msc.setSize(perNodeMaxSize);
        mc.setMaxSizeConfig(msc);

        TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(nodeCount);
        final HazelcastInstance[] instances = factory.newInstances(cfg);
        IMap<Object, Object> map = instances[0].getMap(mapName);
View Full Code Here


        cfg.setProperty(GroupProperties.PROP_PARTITION_COUNT, "1");
        MapConfig mc = cfg.getMapConfig(mapName);
        mc.setStatisticsEnabled(false);
        mc.setEvictionPolicy(EvictionPolicy.LRU);
        mc.setEvictionPercentage(10);
        MaxSizeConfig msc = new MaxSizeConfig();
        msc.setMaxSizePolicy(MaxSizeConfig.MaxSizePolicy.PER_NODE);
        msc.setSize(size);
        mc.setMaxSizeConfig(msc);

        TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(nodeCount);
        final HazelcastInstance[] instances = factory.newInstances(cfg);
        IMap<Object, Object> map = instances[0].getMap(mapName);
View Full Code Here

        cfg.setProperty(GroupProperties.PROP_PARTITION_COUNT, "1");
        MapConfig mc = cfg.getMapConfig(mapName);
        mc.setStatisticsEnabled(false);
        mc.setEvictionPolicy(EvictionPolicy.LFU);
        mc.setEvictionPercentage(20);
        MaxSizeConfig msc = new MaxSizeConfig();
        msc.setMaxSizePolicy(MaxSizeConfig.MaxSizePolicy.PER_NODE);
        msc.setSize(size);
        mc.setMaxSizeConfig(msc);

        TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(instanceCount);
        final HazelcastInstance[] instances = factory.newInstances(cfg);
        final int atLeastShouldEvict = size / 40;
View Full Code Here

        Config cfg = new Config();
        cfg.setProperty(GroupProperties.PROP_PARTITION_COUNT, "1");
        MapConfig mc = cfg.getMapConfig(mapName);
        mc.setEvictionPolicy(EvictionPolicy.LFU);
        mc.setEvictionPercentage(20);
        MaxSizeConfig msc = new MaxSizeConfig();
        msc.setMaxSizePolicy(MaxSizeConfig.MaxSizePolicy.PER_NODE);
        msc.setSize(size);
        mc.setMaxSizeConfig(msc);
        TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(instanceCount);
        final HazelcastInstance[] instances = factory.newInstances(cfg);
        final int atLeastShouldEvict = size / 40;
        final CountDownLatch latch = new CountDownLatch(atLeastShouldEvict);
View Full Code Here

            Config cfg = new Config();
            cfg.setProperty(GroupProperties.PROP_PARTITION_COUNT, "1");
            MapConfig mc = cfg.getMapConfig(mapName);
            mc.setEvictionPolicy(EvictionPolicy.LFU);
            mc.setEvictionPercentage(90);
            MaxSizeConfig msc = new MaxSizeConfig();
            msc.setMaxSizePolicy(MaxSizeConfig.MaxSizePolicy.PER_NODE);
            msc.setSize(size);
            mc.setMaxSizeConfig(msc);
            TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(k);
            final HazelcastInstance[] instances = factory.newInstances(cfg);
            IMap<Object, Object> map = instances[0].getMap(mapName);
            for (int i = 0; i < size; i++) {
View Full Code Here

    }

    private static Config newConfig(String mapName, int maxSize, MaxSizeConfig.MaxSizePolicy maxSizePolicy) {
        final Config config = new Config();
        final MapConfig mapConfig = new MapConfig(mapName + "*");
        final MaxSizeConfig maxSizeConfig = new MaxSizeConfig(maxSize, maxSizePolicy);
        mapConfig.setMaxSizeConfig(maxSizeConfig);
        mapConfig.setEvictionPolicy(EvictionPolicy.LRU);
        mapConfig.setMinEvictionCheckMillis(0);
        config.addMapConfig(mapConfig);

View Full Code Here

        MapConfig mapConfig = config.getMapConfig(mapName);
        mapConfig.setEvictionPolicy(EvictionPolicy.LRU);
        mapConfig.setEvictionPercentage(25);

        MaxSizeConfig msc = new MaxSizeConfig();
        msc.setMaxSizePolicy(maxSizePolicy);
        msc.setSize(maxSize);

        mapConfig.setMaxSizeConfig(msc);
        mapConfig.setMinEvictionCheckMillis(0L);
        return config;
    }
View Full Code Here

     * Get max size per node setting form config
     *
     * @return max size or -1 if policy is not set
     */
    public int getMaxSizePerNode() {
        MaxSizeConfig maxSizeConfig = mapConfig.getMaxSizeConfig();
        int maxSize = -1;

        if (maxSizeConfig.getMaxSizePolicy() == PER_NODE) {
            maxSize = maxSizeConfig.getSize();
        }

        return maxSize;
    }
View Full Code Here

        .setInitialLoadMode( MapStoreConfig.InitialLoadMode.EAGER );

        MapConfig mapConfig = cfg.getMapConfig(mapName).setMapStoreConfig(mapStoreConfig);

        if( sizeLimited ) {
            MaxSizeConfig maxSizeConfig = new MaxSizeConfig(maxSizePerNode, MaxSizeConfig.MaxSizePolicy.PER_NODE);
            mapConfig.setMaxSizeConfig(maxSizeConfig);
        }

        return cfg;
    }
View Full Code Here

@Category(QuickTest.class)
public class MapMaxSizeConfigTest extends HazelcastTestSupport {

    @Test
    public void setMaxSize_withConstructor_toZero() throws Exception {
        MaxSizeConfig maxSizeConfig = new MaxSizeConfig(0, MaxSizeConfig.MaxSizePolicy.PER_NODE);

        assertEquals(Integer.MAX_VALUE, maxSizeConfig.getSize());
    }
View Full Code Here

TOP

Related Classes of com.hazelcast.config.MaxSizeConfig

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.