Package com.hazelcast.config

Examples of com.hazelcast.config.MaxSizeConfig


            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
View Full Code Here


            }
        }

        private boolean evictionPolicyConfigured(MapContainer mapContainer){
            final MapConfig.EvictionPolicy evictionPolicy = mapContainer.getMapConfig().getEvictionPolicy();
            final MaxSizeConfig maxSizeConfig = mapContainer.getMapConfig().getMaxSizeConfig();
            return !MapConfig.EvictionPolicy.NONE.equals(evictionPolicy) && maxSizeConfig.getSize() > 0;
        }
View Full Code Here

            final MaxSizeConfig maxSizeConfig = mapContainer.getMapConfig().getMaxSizeConfig();
            return !MapConfig.EvictionPolicy.NONE.equals(evictionPolicy) && maxSizeConfig.getSize() > 0;
        }

        private boolean evictable(MapContainer mapContainer) {
            final MaxSizeConfig maxSizeConfig = mapContainer.getMapConfig().getMaxSizeConfig();
            final MaxSizeConfig.MaxSizePolicy maxSizePolicy = maxSizeConfig.getMaxSizePolicy();
            boolean result;
            switch (maxSizePolicy) {
                case PER_NODE:
                    result = isEvictablePerNode(mapContainer);
                    break;
View Full Code Here

        }

        private boolean isEvictablePerNode(MapContainer mapContainer) {
            int nodeTotalSize = 0;
            final MapService mapService = MapEvictionManager.this.mapService;
            final MaxSizeConfig maxSizeConfig = mapContainer.getMapConfig().getMaxSizeConfig();
            final int maxSize = getApproximateMaxSize(maxSizeConfig.getSize());
            final String mapName = mapContainer.getName();
            final NodeEngine nodeEngine = mapService.getNodeEngine();
            final InternalPartitionService partitionService = nodeEngine.getPartitionService();
            final int partitionCount = partitionService.getPartitionCount();
            for (int i = 0; i < partitionCount; i++) {
View Full Code Here

            return maxSizeFromConfig * 95 / 100;
        }

        private boolean isEvictablePerPartition(final MapContainer mapContainer) {
            final MapService mapService = MapEvictionManager.this.mapService;
            final MaxSizeConfig maxSizeConfig = mapContainer.getMapConfig().getMaxSizeConfig();
            final int maxSize = getApproximateMaxSize(maxSizeConfig.getSize());
            final String mapName = mapContainer.getName();
            final NodeEngine nodeEngine = mapService.getNodeEngine();
            final InternalPartitionService partitionService = nodeEngine.getPartitionService();
            for (int i = 0; i < partitionService.getPartitionCount(); i++) {
                final Address owner = partitionService.getPartitionOwner(i);
View Full Code Here

        private boolean isEvictableHeapSize(final MapContainer mapContainer) {
            final long usedHeapSize = getUsedHeapSize(mapContainer);
            if (usedHeapSize == -1L) {
                return false;
            }
            final MaxSizeConfig maxSizeConfig = mapContainer.getMapConfig().getMaxSizeConfig();
            final int maxSize = getApproximateMaxSize(maxSizeConfig.getSize());
            return maxSize < (usedHeapSize / 1024 / 1024);
        }
View Full Code Here

        private boolean isEvictableHeapPercentage(final MapContainer mapContainer) {
            final long usedHeapSize = getUsedHeapSize(mapContainer);
            if (usedHeapSize == -1L) {
                return false;
            }
            final MaxSizeConfig maxSizeConfig = mapContainer.getMapConfig().getMaxSizeConfig();
            final int maxSize = getApproximateMaxSize(maxSizeConfig.getSize());
            final long total = Runtime.getRuntime().totalMemory();
            final boolean result = maxSize < (100d * usedHeapSize / total);
            return result;
        }
View Full Code Here

        config.setBackupCount(in.readInt());
        config.setAsyncBackupCount(in.readInt());
        config.setEvictionPercentage(in.readInt());
        config.setTimeToLiveSeconds(in.readInt());
        config.setMaxIdleSeconds(in.readInt());
        config.setMaxSizeConfig(new MaxSizeConfig().setSize(in.readInt())
                .setMaxSizePolicy(MaxSizeConfig.MaxSizePolicy.valueOf(in.readUTF())));
        config.setReadBackupData(in.readBoolean());
        config.setEvictionPolicy(MapConfig.EvictionPolicy.valueOf(in.readUTF()));
        config.setMergePolicy(in.readUTF());
    }
View Full Code Here

        config.setBackupCount(getInt(json, "backupCount"));
        config.setAsyncBackupCount(getInt(json, "asyncBackupCount"));
        config.setEvictionPercentage(getInt(json, "evictionPercentage"));
        config.setTimeToLiveSeconds(getInt(json, "ttl"));
        config.setMaxIdleSeconds(getInt(json, "maxIdle"));
        config.setMaxSizeConfig(new MaxSizeConfig().setSize(getInt(json, "maxSize"))
                .setMaxSizePolicy(MaxSizeConfig.MaxSizePolicy.valueOf(getString(json, "maxSizePolicy"))));
        config.setReadBackupData(getBoolean(json, "readBackupData"));
        config.setEvictionPolicy(MapConfig.EvictionPolicy.valueOf(getString(json, "evictionPolicy")));
        config.setMergePolicy(getString(json, "mergePolicy"));
    }
View Full Code Here

        config.setBackupCount(in.readInt());
        config.setAsyncBackupCount(in.readInt());
        config.setEvictionPercentage(in.readInt());
        config.setTimeToLiveSeconds(in.readInt());
        config.setMaxIdleSeconds(in.readInt());
        config.setMaxSizeConfig(new MaxSizeConfig().setSize(in.readInt())
                .setMaxSizePolicy(MaxSizeConfig.MaxSizePolicy.valueOf(in.readUTF())));
        config.setReadBackupData(in.readBoolean());
        config.setEvictionPolicy(MapConfig.EvictionPolicy.valueOf(in.readUTF()));
        config.setMergePolicy(in.readUTF());
    }
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.