Package com.hazelcast.config

Examples of com.hazelcast.config.MapConfig


    public void testMapStoreNotCalledFromEntryProcessorBackup() throws Exception {
        final String mapName = "testMapStoreNotCalledFromEntryProcessorBackup_" + randomString();
        final int instanceCount = 2;
        Config config = new Config();
        // Configure map with one backup and dummy map store
        MapConfig mapConfig = config.getMapConfig(mapName);
        mapConfig.setBackupCount(1);
        MapStoreConfig mapStoreConfig = new MapStoreConfig();
        MapStoreWithStoreCount mapStore = new MapStoreWithStoreCount(1, 120);
        mapStoreConfig.setImplementation(mapStore);
        mapConfig.setMapStoreConfig(mapStoreConfig);

        TestHazelcastInstanceFactory nodeFactory = createHazelcastInstanceFactory(instanceCount);
        HazelcastInstance instance1 = nodeFactory.newHazelcastInstance(config);
        HazelcastInstance instance2 = nodeFactory.newHazelcastInstance(config);
View Full Code Here


        MapStoreConfig mapStoreConfig = new MapStoreConfig()
                .setEnabled(true)
                .setImplementation(new SimpleMapStore<String, String>())
                .setWriteDelaySeconds(Integer.MAX_VALUE);

        Config config = new Config().addMapConfig(new MapConfig("map").setMapStoreConfig(mapStoreConfig));

        HazelcastInstance instance = createHazelcastInstance(config);
        IMap<String, String> map = instance.getMap("map");
        map.put("foo", "bar");
        map.remove("foo");
View Full Code Here

    }

    public static Config newConfig(String mapName, Object storeImpl, int writeDelaySeconds) {
        XmlConfigBuilder configBuilder = new XmlConfigBuilder();
        Config config = configBuilder.build();
        MapConfig mapConfig = config.getMapConfig(mapName);
        MapStoreConfig mapStoreConfig = new MapStoreConfig();
        mapStoreConfig.setImplementation(storeImpl);
        mapStoreConfig.setWriteDelaySeconds(writeDelaySeconds);
        mapConfig.setMapStoreConfig(mapStoreConfig);
        return config;
    }
View Full Code Here

     * Nullify old value if in memory format is object and operation is not removal
     * since old and new value in fired event {@link com.hazelcast.core.EntryEvent}
     * may be same due to the object in memory format.
     */
    private void nullifyOldValueIfNecessary() {
        final MapConfig mapConfig = mapContainer.getMapConfig();
        final InMemoryFormat format = mapConfig.getInMemoryFormat();
        if (format == InMemoryFormat.OBJECT && eventType != EntryEventType.REMOVED) {
            oldValue = null;
        }
    }
View Full Code Here

        Properties props = getDefaultProperties();
        props.put(CacheEnvironment.SHUTDOWN_ON_STOP, "false");
        SessionFactory sf = createSessionFactory(props);
        HazelcastInstance hz = HazelcastAccessor.getHazelcastInstance(sf);
        assertEquals(1, hz.getCluster().getMembers().size());
        MapConfig cfg = hz.getConfig().getMapConfig("com.hazelcast.hibernate.entity.*");
        assertNotNull(cfg);
        assertEquals(30, cfg.getTimeToLiveSeconds());
        assertEquals(50, cfg.getMaxSizeConfig().getSize());
        sf.close();
        assertTrue(hz.getLifecycleService().isRunning());
        hz.shutdown();
    }
View Full Code Here

        verify(description).isVersioned();
    }

    @Test
    public void testFourArgConstructorDoesNotRegisterTopicListenerIfNotRequested() {
        MapConfig mapConfig = mock(MapConfig.class);

        Config config = mock(Config.class);
        when(config.findMapConfig(eq(CACHE_NAME))).thenReturn(mapConfig);

        HazelcastInstance instance = mock(HazelcastInstance.class);
View Full Code Here

    // Verifies that the three-argument constructor still registers a listener with a topic if the HazelcastInstance
    // is provided. This ensures the old behavior has not been regressed by adding the new four argument constructor
    @Test
    public void testThreeArgConstructorRegistersTopicListener() {
        MapConfig mapConfig = mock(MapConfig.class);

        Config config = mock(Config.class);
        when(config.findMapConfig(eq(CACHE_NAME))).thenReturn(mapConfig);

        ITopic<Object> topic = mock(ITopic.class);
View Full Code Here

      if (hcInstance != null) {
        return hcInstance;
      }
      com.hazelcast.config.Config cfg = new com.hazelcast.config.Config();
      cfg.setInstanceName(getNodeName());
      MapConfig mapcfg = new MapConfig("default");
      mapcfg.setEvictionPercentage(25);
      mapcfg.setEvictionPolicy(MapConfig.EvictionPolicy.LRU);
  //      mapcfg.setMapStoreConfig(new MapStoreConfig().setEnabled(false).setClassName(NODE_NAME));
      mapcfg.setMaxSizeConfig(new MaxSizeConfig().setSize(25).setMaxSizePolicy(USED_HEAP_PERCENTAGE));
      cfg.addMapConfig(mapcfg);
      cfg.setProperty("hazelcast.jmx", "true");
      cfg.setProperty("hazelcast.logging.type", "slf4j");
      if (Config.IN_PRODUCTION) {
        cfg.setNetworkConfig(new NetworkConfig().setJoin(new JoinConfig().
View Full Code Here

      if (hcInstance != null) {
        return hcInstance;
      }
      com.hazelcast.config.Config cfg = new com.hazelcast.config.Config();
      cfg.setInstanceName(getNodeName());
      MapConfig mapcfg = new MapConfig("default");
      mapcfg.setEvictionPercentage(25);
      mapcfg.setEvictionPolicy(MapConfig.EvictionPolicy.LRU);
  //      mapcfg.setMapStoreConfig(new MapStoreConfig().setEnabled(false).setClassName(NODE_NAME));
      mapcfg.setMaxSizeConfig(new MaxSizeConfig().setSize(25).setMaxSizePolicy(USED_HEAP_PERCENTAGE));
      cfg.addMapConfig(mapcfg);
      cfg.setProperty("hazelcast.jmx", "true");
      cfg.setProperty("hazelcast.logging.type", "slf4j");
      if (Config.IN_PRODUCTION) {
        cfg.setNetworkConfig(new NetworkConfig().setJoin(new JoinConfig().
View Full Code Here

TOP

Related Classes of com.hazelcast.config.MapConfig

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.