Package com.hazelcast.config

Examples of com.hazelcast.config.Config


        }

        try {
            String sessionTTL = getParam("session-ttl-seconds");
            if (sessionTTL != null) {
                Config hzConfig = hazelcastInstance.getConfig();

                MapConfig mapConfig = hzConfig.getMapConfig(clusterMapName);
                mapConfig.setTimeToLiveSeconds(Integer.parseInt(sessionTTL));

                hzConfig.addMapConfig(mapConfig);
            }
        } catch (UnsupportedOperationException ignored) {
            LOGGER.info("client cannot access Config.");
        }
View Full Code Here


        Hazelcast.shutdownAll();
    }

    @Test
    public void testTtl_issue1783() throws IOException, InterruptedException {
        final Config conf = new Config();
        String name = "map";

        final CountDownLatch latch = new CountDownLatch(1);
        final MapConfig mapConfig = conf.getMapConfig(name);
        mapConfig.setTimeToLiveSeconds(3);
        mapConfig.addEntryListenerConfig(new EntryListenerConfig()
                .setImplementation(new EntryAdapter() {
                    @Override
                    public void entryEvicted(EntryEvent event) {
View Full Code Here

        List<String> allMembers = new ArrayList<String>();
        for (int i = 0; i < configCount; i++) {
            allMembers.add("127.0.0.1:" + availablePorts.get(i));
        }
        for (int i = 0; i < configCount; i++) {
            Config c = buildConfig(false);
            int port = availablePorts.get(i);

            c.getNetworkConfig().setPort(port);
            c.getNetworkConfig().getJoin().getTcpIpConfig().setMembers(allMembers);

            configList.add(c);
        }
        return configList;
    }
View Full Code Here

        }
        return configList;
    }

    private static Config buildConfig(boolean multicastEnabled) {
        Config c = new Config();
        c.getGroupConfig().setName("group").setPassword("pass");
        c.setProperty(GroupProperties.PROP_MERGE_FIRST_RUN_DELAY_SECONDS, "10");
        c.setProperty(GroupProperties.PROP_MERGE_NEXT_RUN_DELAY_SECONDS, "5");
        c.setProperty(GroupProperties.PROP_MAX_NO_HEARTBEAT_SECONDS, "10");
        c.setProperty(GroupProperties.PROP_MASTER_CONFIRMATION_INTERVAL_SECONDS, "2");
        c.setProperty(GroupProperties.PROP_MAX_NO_MASTER_CONFIRMATION_SECONDS, "10");
        c.setProperty(GroupProperties.PROP_MEMBER_LIST_PUBLISH_INTERVAL_SECONDS, "10");
        final NetworkConfig networkConfig = c.getNetworkConfig();
        networkConfig.getJoin().getMulticastConfig().setEnabled(multicastEnabled);
        networkConfig.getJoin().getTcpIpConfig().setEnabled(!multicastEnabled);
        networkConfig.setPortAutoIncrement(false);
        return c;
    }
View Full Code Here

@Category(QuickTest.class)
public class EntryAdapterTest extends HazelcastTestSupport {
    @Test
    public void testEntryAdapterMapEvicted() {
        String mapName = randomMapName();
        Config cfg = new Config();

        TestHazelcastInstanceFactory instanceFactory = createHazelcastInstanceFactory(1);
        HazelcastInstance instance = instanceFactory.newHazelcastInstance(cfg);

        IMap map = instance.getMap(mapName);
View Full Code Here

    }

    @Test
    public void testEntryAdapterMapCleared() {
        String mapName = randomMapName();
        Config cfg = new Config();
        TestHazelcastInstanceFactory instanceFactory = createHazelcastInstanceFactory(1);
        HazelcastInstance instance = instanceFactory.newHazelcastInstance(cfg);

        IMap map = instance.getMap(mapName);
        map.put(1, 1);
View Full Code Here


    //what are you testing? The intent is not clear
    @Test
    public void testQueueEviction() throws Exception {
        final Config config = new Config();
        config.getQueueConfig("q").setEmptyQueueTtl(2);
        final HazelcastInstance hz = createHazelcastInstance(config);
        final IQueue<Object> q = hz.getQueue("q");

        try {
            assertTrue(q.offer("item"));
View Full Code Here

    }

    // TODO: Can you come up with a better name. A name with a number is not very informative.
    @Test
    public void testQueueEviction2() throws Exception {
        final Config config = new Config();
        config.getQueueConfig("q2").setEmptyQueueTtl(0);
        final HazelcastInstance hz = createHazelcastInstance(config);

        final CountDownLatch latch = new CountDownLatch(2);
        hz.addDistributedObjectListener(new DistributedObjectListener() {
            public void distributedObjectCreated(DistributedObjectEvent event) {
View Full Code Here

    }

    @Test
    public void testLatestUpdateMapMergePolicy() {
        String mapName = randomMapName();
        Config config = newConfig(LatestUpdateMapMergePolicy.class.getName(), mapName);
        HazelcastInstance h1 = Hazelcast.newHazelcastInstance(config);
        HazelcastInstance h2 = Hazelcast.newHazelcastInstance(config);

        TestMemberShipListener memberShipListener = new TestMemberShipListener(1);
        h2.getCluster().addMembershipListener(memberShipListener);
View Full Code Here

    }

    @Test
    public void testHigherHitsMapMergePolicy() {
        String mapName = randomMapName();
        Config config = newConfig(HigherHitsMapMergePolicy.class.getName(), mapName);
        HazelcastInstance h1 = Hazelcast.newHazelcastInstance(config);
        HazelcastInstance h2 = Hazelcast.newHazelcastInstance(config);

        TestMemberShipListener memberShipListener = new TestMemberShipListener(1);
        h2.getCluster().addMembershipListener(memberShipListener);
View Full Code Here

TOP

Related Classes of com.hazelcast.config.Config

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.