Java 类com.hazelcast.config.MaxSizeConfig 实例源码

项目:cas-5.1.0    文件:HazelcastTicketRegistryConfiguration.java   
private MapConfig createMapConfig(final TicketDefinition definition) {
    final HazelcastProperties hz = casProperties.getTicket().getRegistry().getHazelcast();
    final HazelcastProperties.Cluster cluster = hz.getCluster();
    final EvictionPolicy evictionPolicy = EvictionPolicy.valueOf(cluster.getEvictionPolicy());

    LOGGER.debug("Creating Hazelcast map configuration for [{}] with idle timeout [{}] second(s)",
            definition.getProperties().getStorageName(), definition.getProperties().getStorageTimeout());

    return new MapConfig()
            .setName(definition.getProperties().getStorageName())
            .setMaxIdleSeconds((int) definition.getProperties().getStorageTimeout())
            .setBackupCount(cluster.getBackupCount())
            .setAsyncBackupCount(cluster.getAsyncBackupCount())
            .setEvictionPolicy(evictionPolicy)
            .setMaxSizeConfig(new MaxSizeConfig()
                    .setMaxSizePolicy(MaxSizeConfig.MaxSizePolicy.valueOf(cluster.getMaxSizePolicy()))
                    .setSize(cluster.getMaxHeapSizePercentage()));
}
项目:sctalk    文件:HazelCastConfigration.java   
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(1);

    /*
     * Valid values are: NONE (no eviction), LRU (Least Recently Used), LFU (Least Frequently
     * Used). NONE is the default.
     */
    mapConfig.setEvictionPolicy(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));

    return mapConfig;
}
项目:reactive-data    文件:HazelcastInstanceProxy.java   
void addMapConfig(Class<?> c)
{
  if(!c.isAnnotationPresent(HzMapConfig.class))
    throw new IllegalArgumentException(c+" not annotated with @"+HzMapConfig.class.getSimpleName());

  HzMapConfig hc = c.getAnnotation(HzMapConfig.class);
   MapConfig mapC = new MapConfig(hc.name());
   if(hzConfig.getMapConfigs().containsKey(hc.name()))
   {
     mapC = hzConfig.getMapConfig(hc.name());
   }

   mapC.setAsyncBackupCount(hc.asyncBackupCount());
   mapC.setBackupCount(hc.backupCount());
   mapC.setEvictionPercentage(hc.evictPercentage());
   mapC.setEvictionPolicy(EvictionPolicy.valueOf(hc.evictPolicy()));
   mapC.setInMemoryFormat(InMemoryFormat.valueOf(hc.inMemoryFormat()));
   mapC.setMaxIdleSeconds(hc.idleSeconds());
   mapC.setMergePolicy(hc.evictPolicy());
   mapC.setMinEvictionCheckMillis(hc.evictCheckMillis());
   mapC.setTimeToLiveSeconds(hc.ttlSeconds());
   mapC.setMaxSizeConfig(new MaxSizeConfig(hc.maxSize(), MaxSizePolicy.valueOf(hc.maxSizePolicy())));
   mapC.setStatisticsEnabled(hc.statisticsOn());

   hzConfig.getMapConfigs().put(mapC.getName(), mapC);
}
项目:hazelcast-hibernate5    文件:HazelcastTimestampsRegionTest.java   
@Before
public void setUp() throws Exception {
    mapConfig = mock(MapConfig.class);
    when(mapConfig.getMaxSizeConfig()).thenReturn(new MaxSizeConfig(50, MaxSizeConfig.MaxSizePolicy.PER_NODE));
    when(mapConfig.getTimeToLiveSeconds()).thenReturn(timeout);

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

    Cluster cluster = mock(Cluster.class);
    when(cluster.getClusterTime()).thenAnswer(new Answer<Long>() {
        @Override
        public Long answer(InvocationOnMock invocation) throws Throwable {
            return System.currentTimeMillis();
        }
    });

    instance = mock(HazelcastInstance.class);
    when(instance.getConfig()).thenReturn(config);
    when(instance.getCluster()).thenReturn(cluster);

    cache = mock(RegionCache.class);

    region = new HazelcastTimestampsRegion<RegionCache>(instance, REGION_NAME, new Properties(), cache);
}
项目:hazelcast-hibernate5    文件:HazelcastQueryResultsRegionTest.java   
@Before
public void setUp() throws Exception {
    mapConfig = mock(MapConfig.class);
    when(mapConfig.getMaxSizeConfig()).thenReturn(new MaxSizeConfig(maxSize, MaxSizeConfig.MaxSizePolicy.PER_NODE));
    when(mapConfig.getTimeToLiveSeconds()).thenReturn(timeout);

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

    Cluster cluster = mock(Cluster.class);
    when(cluster.getClusterTime()).thenAnswer(new Answer<Long>() {
        @Override
        public Long answer(InvocationOnMock invocation) throws Throwable {
            return System.currentTimeMillis();
        }
    });

    instance = mock(HazelcastInstance.class);
    when(instance.getConfig()).thenReturn(config);
    when(instance.getCluster()).thenReturn(cluster);

    region = new HazelcastQueryResultsRegion(instance, REGION_NAME, new Properties());
}
项目:hazelcast-hibernate    文件:HazelcastTimestampsRegionTest.java   
@Before
public void setUp() throws Exception {
    mapConfig = mock(MapConfig.class);
    when(mapConfig.getMaxSizeConfig()).thenReturn(new MaxSizeConfig(50, MaxSizeConfig.MaxSizePolicy.PER_NODE));
    when(mapConfig.getTimeToLiveSeconds()).thenReturn(timeout);

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

    Cluster cluster = mock(Cluster.class);
    when(cluster.getClusterTime()).thenAnswer(new Answer<Long>() {
        @Override
        public Long answer(InvocationOnMock invocation) throws Throwable {
            return System.currentTimeMillis();
        }
    });

    instance = mock(HazelcastInstance.class);
    when(instance.getConfig()).thenReturn(config);
    when(instance.getCluster()).thenReturn(cluster);

    cache = mock(RegionCache.class);

    region = new HazelcastTimestampsRegion<RegionCache>(instance, REGION_NAME, new Properties(), cache);
}
项目:hazelcast-hibernate    文件:HazelcastQueryResultsRegionTest.java   
@Before
public void setUp() throws Exception {
    mapConfig = mock(MapConfig.class);
    when(mapConfig.getMaxSizeConfig()).thenReturn(new MaxSizeConfig(maxSize, MaxSizeConfig.MaxSizePolicy.PER_NODE));
    when(mapConfig.getTimeToLiveSeconds()).thenReturn(timeout);

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

    Cluster cluster = mock(Cluster.class);
    when(cluster.getClusterTime()).thenAnswer(new Answer<Long>() {
        @Override
        public Long answer(InvocationOnMock invocation) throws Throwable {
            return System.currentTimeMillis();
        }
    });

    instance = mock(HazelcastInstance.class);
    when(instance.getConfig()).thenReturn(config);
    when(instance.getCluster()).thenReturn(cluster);

    region = new HazelcastQueryResultsRegion(instance, REGION_NAME, new Properties());
}
项目:hazelcast-hibernate    文件:HazelcastTimestampsRegionTest.java   
@Before
public void setUp() throws Exception {
    mapConfig = mock(MapConfig.class);
    when(mapConfig.getMaxSizeConfig()).thenReturn(new MaxSizeConfig(50, MaxSizeConfig.MaxSizePolicy.PER_NODE));
    when(mapConfig.getTimeToLiveSeconds()).thenReturn(timeout);

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

    Cluster cluster = mock(Cluster.class);
    when(cluster.getClusterTime()).thenAnswer(new Answer<Long>() {
        @Override
        public Long answer(InvocationOnMock invocation) throws Throwable {
            return System.currentTimeMillis();
        }
    });

    instance = mock(HazelcastInstance.class);
    when(instance.getConfig()).thenReturn(config);
    when(instance.getCluster()).thenReturn(cluster);

    cache = mock(RegionCache.class);

    region = new HazelcastTimestampsRegion<RegionCache>(instance, REGION_NAME, new Properties(), cache);
}
项目:hazelcast-hibernate    文件:HazelcastQueryResultsRegionTest.java   
@Before
public void setUp() throws Exception {
    mapConfig = mock(MapConfig.class);
    when(mapConfig.getMaxSizeConfig()).thenReturn(new MaxSizeConfig(maxSize, MaxSizeConfig.MaxSizePolicy.PER_NODE));
    when(mapConfig.getTimeToLiveSeconds()).thenReturn(timeout);

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

    Cluster cluster = mock(Cluster.class);
    when(cluster.getClusterTime()).thenAnswer(new Answer<Long>() {
        @Override
        public Long answer(InvocationOnMock invocation) throws Throwable {
            return System.currentTimeMillis();
        }
    });

    instance = mock(HazelcastInstance.class);
    when(instance.getConfig()).thenReturn(config);
    when(instance.getCluster()).thenReturn(cluster);

    region = new HazelcastQueryResultsRegion(instance, REGION_NAME, new Properties());
}
项目:iticrawler    文件:DistMapConfig.java   
public DistMapConfig setup(Config cfg, String name, Object storeImplementation) {
    MapConfig mapConfig = new MapConfig();

    //TODO: Refactor the config options
    mapConfig.setName(name);
    mapConfig.setBackupCount(1);

    if (storeImplementation != null) {

        MaxSizeConfig maxSizeConfig = new MaxSizeConfig();
        //todo Refactor this to config
        maxSizeConfig.setSize(1000);

        MapStoreConfig store = new MapStoreConfig();
        store.setImplementation(storeImplementation);

        mapConfig.setMaxSizeConfig(maxSizeConfig);
        mapConfig.setMapStoreConfig(store);
    }

    cfg.addMapConfig(mapConfig);

    return this;
}
项目:Openfire    文件:ClusteredCacheFactory.java   
public Cache createCache(String name) {
    // Check if cluster is being started up
    while (state == State.starting) {
        // Wait until cluster is fully started (or failed)
        try {
            Thread.sleep(250);
        }
        catch (InterruptedException e) {
            // Ignore
        }
    }
    if (state == State.stopped) {
        throw new IllegalStateException("Cannot create clustered cache when not in a cluster");
    }
    // Determine the time to live. Note that in Hazelcast 0 means "forever", not -1
    final long openfireLifetimeInMilliseconds = CacheFactory.getMaxCacheLifetime(name);
    final int hazelcastLifetimeInSeconds = openfireLifetimeInMilliseconds < 0 ? 0 : (int) (openfireLifetimeInMilliseconds / 1000);
    // Determine the max cache size. Note that in Hazelcast the max cache size must be positive
    final long openfireMaxCacheSize = CacheFactory.getMaxCacheSize(name);
    final int hazelcastMaxCacheSize = openfireMaxCacheSize < 0 ? Integer.MAX_VALUE : (int) openfireMaxCacheSize;
    final MapConfig mapConfig = hazelcast.getConfig().getMapConfig(name);
    mapConfig.setTimeToLiveSeconds(hazelcastLifetimeInSeconds);
    mapConfig.setMaxSizeConfig(new MaxSizeConfig(hazelcastMaxCacheSize, MaxSizeConfig.MaxSizePolicy.USED_HEAP_SIZE));
    return new ClusteredCache(name, hazelcast.getMap(name), hazelcastLifetimeInSeconds);
}
项目:xm-uaa    文件:CacheConfiguration.java   
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(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));

    return mapConfig;
}
项目:jhipster-microservices-example    文件:CacheConfiguration.java   
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(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));

    return mapConfig;
}
项目:xm-ms-balance    文件:CacheConfiguration.java   
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(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));

    return mapConfig;
}
项目:Armory    文件:CacheConfiguration.java   
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(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));

    return mapConfig;
}
项目:Armory    文件:CacheConfiguration.java   
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(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));

    return mapConfig;
}
项目:xm-ms-dashboard    文件:CacheConfiguration.java   
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(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));

    return mapConfig;
}
项目:xm-gate    文件:CacheConfiguration.java   
private static 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(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));

    return mapConfig;
}
项目:xm-ms-entity    文件:CacheConfiguration.java   
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(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));

    return mapConfig;
}
项目:Code4Health-Platform    文件:CacheConfiguration.java   
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(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));

    return mapConfig;
}
项目:spring-io    文件:CacheConfiguration.java   
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(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));

    return mapConfig;
}
项目:spring-io    文件:CacheConfiguration.java   
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(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));

    return mapConfig;
}
项目:devoxxus-jhipster-microservices-demo    文件:CacheConfiguration.java   
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(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));

    return mapConfig;
}
项目:Microservices-with-JHipster-and-Spring-Boot    文件:CacheConfiguration.java   
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(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));

    return mapConfig;
}
项目:iotplatform    文件:ServiceCacheConfiguration.java   
private MapConfig createDeviceCredentialsCacheConfig() {
    MapConfig deviceCredentialsCacheConfig = new MapConfig(CacheConstants.DEVICE_CREDENTIALS_CACHE);
    deviceCredentialsCacheConfig.setTimeToLiveSeconds(cacheDeviceCredentialsTTL);
    deviceCredentialsCacheConfig.setEvictionPolicy(EvictionPolicy.LRU);
    deviceCredentialsCacheConfig.setMaxSizeConfig(
            new MaxSizeConfig(
                    cacheDeviceCredentialsMaxSizeSize,
                    MaxSizeConfig.MaxSizePolicy.valueOf(cacheDeviceCredentialsMaxSizePolicy))
    );
    return deviceCredentialsCacheConfig;
}
项目:jhipster-ribbon-hystrix    文件:_CacheConfiguration.java   
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(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;
}
项目:hazelcast-shell-spring-boot-starter    文件:HazelcastTestConfiguration.java   
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(1);

    /*
        Valid values are:
        NONE (no eviction),
        LRU (Least Recently Used),
        LFU (Least Frequently Used).
        NONE is the default.
     */
    mapConfig.setEvictionPolicy(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;
}
项目:Thesis-JHipster    文件:_CacheConfiguration.java   
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(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;
}
项目:hazelcast-rest    文件:HazelcastMapServlet.java   
public void createBucket(String map, int ttl, int backups, int mib)
        throws IOException
{
    if (bucketCreation.containsKey(map)) {
        throw new FileAlreadyExistsException(null, null,
                "Bucket already exists: " + map);
    }

    Map<String, MapConfig> mapConfigs = hazelcast.getConfig()
            .getMapConfigs();
    MapConfig config = new MapConfig(map);
    config.setTimeToLiveSeconds(ttl);
    config.setEvictionPolicy(EvictionPolicy.LRU);
    config.setInMemoryFormat(InMemoryFormat.BINARY);
    config.setBackupCount(backups);

    int nodes = hazelcast.getCluster().getMembers().size();
    MaxSizeConfig max = new MaxSizeConfig(mib / nodes,
            MaxSizeConfig.MaxSizePolicy.USED_HEAP_SIZE);
    config.setMaxSizeConfig(max);
    mapConfigs.put(map, config);

    // pre-fill local map configuration timestamp...
    bucketCreation.putIfAbsent(map, System.currentTimeMillis());

    // this should always be the first call to the map...
    hazelcast.getMap(map);
}
项目:eet.osslite.cz    文件:HazelcastConfiguration.java   
private void setCacheConfig(Config config, String name, int timeToLive) {
    HotRestartConfig hotRestart = new HotRestartConfig();
    hotRestart.setEnabled(true);
    config.getMapConfig(name)//
            .setTimeToLiveSeconds(timeToLive)//
            .setMaxIdleSeconds(timeToLive)//
            .setEvictionPolicy(EvictionPolicy.LRU)//
            .setMaxSizeConfig(new MaxSizeConfig(5000, MaxSizePolicy.PER_NODE))//
            .setBackupCount(1)//
            .setHotRestartConfig(hotRestart)//
            .setInMemoryFormat(InMemoryFormat.BINARY)//
            .setStatisticsEnabled(true)//
    // .setWanReplicationRef(null)//
    ;
}
项目:trivor    文件:CacheConfiguration.java   
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(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));

    return mapConfig;
}
项目:ithings-demo    文件:CacheConfiguration.java   
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;
}
项目:tesora-dve-pub    文件:HazelcastCoordinationServices.java   
private void startHazelcastServices(List<String> registeredServers) throws PEException {
    Config cfg = new Config();

    cfg.setInstanceName(HAZELCAST_INSTANCE_NAME);
    cfg.setProperty("hazelcast.logging.type", "log4j");

    GroupConfig group = cfg.getGroupConfig();
    group.setName(HAZELCAST_GROUP_NAME);
    group.setPassword(HAZELCAST_GROUP_PASSWORD);

    NetworkConfig network = cfg.getNetworkConfig();
    network.setPortAutoIncrement(false);
    network.setPublicAddress(ourClusterAddress.getAddress().getHostAddress());
    network.setPort(ourClusterAddress.getPort());
    Join join = network.getJoin();
    join.getMulticastConfig().setEnabled(false);

    for (String serverAddress : registeredServers) {
        join.getTcpIpConfig().addMember(serverAddress);
        logger.debug("Added member " + serverAddress);
    }
    join.getTcpIpConfig().setEnabled(true);

    MapConfig mc = new MapConfig(GLOBAL_SESS_VAR_MAP_NAME);
    mc.setStorageType(StorageType.HEAP);
    mc.setTimeToLiveSeconds(0);
    mc.setMaxIdleSeconds(0);
    MaxSizeConfig msc = new MaxSizeConfig();
    msc.setSize(0);
    msc.setMaxSizePolicy(MaxSizeConfig.POLICY_CLUSTER_WIDE_MAP_SIZE);
    mc.setMaxSizeConfig(msc);

    cfg.addMapConfig(mc);

    ourHazelcastInstance = Hazelcast.newHazelcastInstance(cfg);
}
项目:marmotta    文件:HazelcastCacheManager.java   
private void setupMapConfig(String name, int size) {
    MapConfig cfg = new MapConfig(NODE_CACHE);
    cfg.setMaxSizeConfig(new MaxSizeConfig(size, MaxSizeConfig.MaxSizePolicy.PER_PARTITION));
    cfg.setAsyncBackupCount(1);
    cfg.setBackupCount(0);
    cfg.setEvictionPolicy(MapConfig.EvictionPolicy.LRU);
    cfg.setMaxIdleSeconds(600);     // 10 minutes
    cfg.setTimeToLiveSeconds(3600); // 1 hour

    hcConfiguration.addMapConfig(cfg);
}
项目:hazelcast-simulator    文件:MapMaxSizeTest.java   
@Setup
public void setUp() {
    map = targetInstance.getMap(name);
    operationCounterList = targetInstance.getList(name + "OperationCounter");

    if (isMemberNode(targetInstance)) {
        MaxSizeConfig maxSizeConfig = targetInstance.getConfig().getMapConfig(name).getMaxSizeConfig();
        maxSizePerNode = maxSizeConfig.getSize();
        assertEqualsStringFormat("Expected MaxSizePolicy %s, but was %s", PER_NODE, maxSizeConfig.getMaxSizePolicy());
        assertTrue("Expected MaxSizePolicy.getSize() < Integer.MAX_VALUE", maxSizePerNode < Integer.MAX_VALUE);

        logger.info("MapSizeConfig of " + name + ": " + maxSizeConfig);
    }
}
项目:springboot-shiro-cas-mybatis    文件:HazelcastProperties.java   
public MaxSizeConfig.MaxSizePolicy getMaxSizePolicy() {
    return maxSizePolicy;
}
项目:cas-server-4.2.1    文件:HazelcastProperties.java   
public MaxSizeConfig.MaxSizePolicy getMaxSizePolicy() {
    return maxSizePolicy;
}
项目:hazelcast-archive    文件:MapMaxSizePolicy.java   
MaxSizeConfig getMaxSizeConfig();
项目:health-and-care-developer-network    文件:MapMaxSizePolicy.java   
MaxSizeConfig getMaxSizeConfig();