Java 类com.hazelcast.config.MapConfig.StorageType 实例源码

项目: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);
}