Package com.hazelcast.config

Examples of com.hazelcast.config.MapConfig


            String port = ((String) localMemberPort.getValue()).trim();
            nwConfig.setPort(Integer.parseInt(port))// localMemberPort
        }

        configureMembershipScheme(nwConfig);
        MapConfig mapConfig = new MapConfig("foo");
        mapConfig.setEvictionPolicy("LRU");
        primaryHazelcastConfig.addMapConfig(mapConfig);

        if (clusterManagementMode) {
            for (Map.Entry<String, Map<String, GroupManagementAgent>> entry : groupManagementAgents.entrySet()) {
                for (GroupManagementAgent agent : entry.getValue().values()) {
View Full Code Here


        return hazelcastInstance;
    }<% } %><% if (hibernateCache == 'hazelcast') { %>

    private MapConfig initializeDefaultMapConfig() {
        MapConfig mapConfig = new MapConfig();

        /*
            Number of backups. If 1 is set as the backup-count for example,
            then all entries of the map will be copied to another JVM for
            fail-safety. Valid numbers are 0 (no backup), 1, 2, 3.
         */
        mapConfig.setBackupCount(0);

        /*
            Valid values are:
            NONE (no eviction),
            LRU (Least Recently Used),
            LFU (Least Frequently Used).
            NONE is the default.
         */
        mapConfig.setEvictionPolicy(MapConfig.EvictionPolicy.LRU);

        /*
            Maximum size of the map. When max size is reached,
            map is evicted based on the policy defined.
            Any integer between 0 and Integer.MAX_VALUE. 0 means
            Integer.MAX_VALUE. Default is 0.
         */
        mapConfig.setMaxSizeConfig(new MaxSizeConfig(0, MaxSizeConfig.MaxSizePolicy.USED_HEAP_SIZE));

        /*
            When max. size is reached, specified percentage of
            the map will be evicted. Any integer between 0 and 100.
            If 25 is set for example, 25% of the entries will
            get evicted.
         */
        mapConfig.setEvictionPercentage(25);

        return mapConfig;
    }
View Full Code Here

        return mapConfig;
    }

    private MapConfig initializeDomainMapConfig() {
        MapConfig mapConfig = new MapConfig();

        mapConfig.setTimeToLiveSeconds(env.getProperty("cache.timeToLiveSeconds", Integer.class, 3600));
        return mapConfig;
    }
View Full Code Here

        return mapConfig;
    }
    <% } %><% if (clusteredHttpSession == 'hazelcast') { %>

    private MapConfig initializeClusteredSession() {
        MapConfig mapConfig = new MapConfig();

        mapConfig.setBackupCount(env.getProperty("cache.hazelcast.backupCount", Integer.class, 1));
        mapConfig.setTimeToLiveSeconds(env.getProperty("cache.timeToLiveSeconds", Integer.class, 3600));
        return mapConfig;
    }<% } %><% if (hibernateCache == 'hazelcast' || clusteredHttpSession == 'hazelcast') { %>
View Full Code Here

            for (Member member : members) {
                mcs.callOnMember(member, new UpdateMapConfigOperation(map, config));
            }
            dos.writeUTF("success");
        } else {
            MapConfig cfg = (MapConfig) mcs.callOnAddress(target, new GetMapConfigOperation(map));
            if (cfg != null) {
                dos.writeBoolean(true);
                new MapConfigAdapter(cfg).writeData(dos);
            } else {
                dos.writeBoolean(false);
View Full Code Here

            }
        }

        private void evictMap(MapContainer mapContainer) {
            final NodeEngine nodeEngine = mapService.getNodeEngine();
            final MapConfig mapConfig = mapContainer.getMapConfig();
            for (int i = 0; i < ExecutorConfig.DEFAULT_POOL_SIZE; i++) {
                final EvictRunner runner = new EvictRunner(mapConfig, i);
                nodeEngine.getExecutionService().execute(EXECUTOR_NAME, runner);
            }
        }
View Full Code Here

            this.mod = mode;
            this.mapConfig = mapConfig;
        }

        public void run() {
            final MapConfig mapConfig = this.mapConfig;
            final String mapName = mapConfig.getName();
            final MapService mapService = MapEvictionManager.this.mapService;
            final NodeEngine nodeEngine = mapService.getNodeEngine();
            Set<Data> keysGatheredForNearCacheEviction = Collections.emptySet();
            for (int i = 0; i < nodeEngine.getPartitionService().getPartitionCount(); i++) {
                if ((i % ExecutorConfig.DEFAULT_POOL_SIZE) != mod) {
View Full Code Here

        this.setPartitionId(partitionId).setReplicaIndex(replicaIndex);
        data = new HashMap<String, Set<RecordReplicationInfo>>(container.getMaps().size());
        for (Entry<String, RecordStore> entry : container.getMaps().entrySet()) {
            RecordStore recordStore = entry.getValue();
            MapContainer mapContainer = recordStore.getMapContainer();
            final MapConfig mapConfig = mapContainer.getMapConfig();
            if (mapConfig.getTotalBackupCount() < replicaIndex) {
                continue;
            }

            String name = entry.getKey();
            // now prepare data to migrate records
View Full Code Here

    }

    @Override
    public void run() throws Exception {
        MapService service = getService();
        MapConfig oldConfig = service.getMapContainer(mapName).getMapConfig();
        MapConfig newConfig = new MapConfig(oldConfig);
        newConfig.setTimeToLiveSeconds(mapConfig.getTimeToLiveSeconds());
        newConfig.setMaxIdleSeconds(mapConfig.getMaxIdleSeconds());
        newConfig.setEvictionPolicy(mapConfig.getEvictionPolicy());
        newConfig.setEvictionPercentage(mapConfig.getEvictionPercentage());
        newConfig.setReadBackupData(mapConfig.isReadBackupData());
        newConfig.setBackupCount(mapConfig.getBackupCount());
        newConfig.setAsyncBackupCount(mapConfig.getAsyncBackupCount());
        newConfig.setMaxSizeConfig(mapConfig.getMaxSizeConfig());
        service.getMapContainer(mapName).setMapConfig(newConfig.getAsReadOnly());
    }
View Full Code Here

        this.config = mapConfig;
    }

    @Override
    public void readData(ObjectDataInput in) throws IOException {
        config = new MapConfig();
        config.setName(in.readUTF());
        config.setInMemoryFormat(InMemoryFormat.valueOf(in.readUTF()));
        config.setBackupCount(in.readInt());
        config.setAsyncBackupCount(in.readInt());
        config.setEvictionPercentage(in.readInt());
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.