当前位置: 首页>>代码示例>>Java>>正文


Java GroupConfig.setName方法代码示例

本文整理汇总了Java中com.hazelcast.config.GroupConfig.setName方法的典型用法代码示例。如果您正苦于以下问题:Java GroupConfig.setName方法的具体用法?Java GroupConfig.setName怎么用?Java GroupConfig.setName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.hazelcast.config.GroupConfig的用法示例。


在下文中一共展示了GroupConfig.setName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: Config

import com.hazelcast.config.GroupConfig; //导入方法依赖的package包/类
@Test
public void testAuthenticate
        () {
    String grName = "dev";
    String grPass = "pass";
    Config conf = new Config();
    conf.setProperty(GroupProperties.PROP_WAIT_SECONDS_BEFORE_JOIN, "1");
    GroupConfig gc = new GroupConfig();
    gc.setName(grName);
    gc.setPassword(grPass);
    conf.setGroupConfig(gc);
    HazelcastInstance h = Hazelcast.newHazelcastInstance(conf);
    client = newHazelcastClient(grName, grPass, h);
    Map map = client.getMap("aasd");
    client.shutdown();
    h.shutdown();
}
 
开发者ID:mdogan,项目名称:hazelcast-archive,代码行数:18,代码来源:DynamicClusterTest.java

示例2: startHazelcastServices

import com.hazelcast.config.GroupConfig; //导入方法依赖的package包/类
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);
}
 
开发者ID:Tesora,项目名称:tesora-dve-pub,代码行数:37,代码来源:HazelcastCoordinationServices.java

示例3: setGroup

import com.hazelcast.config.GroupConfig; //导入方法依赖的package包/类
private void setGroup(GroupConfig group) {
	group.setName("eetlite");
	group.setPassword("eetlite-pass");
}
 
开发者ID:eetlite,项目名称:eet.osslite.cz,代码行数:5,代码来源:HazelcastConfiguration.java

示例4: newInstance

import com.hazelcast.config.GroupConfig; //导入方法依赖的package包/类
public HazelcastInstance newInstance() {
    String name = NAME.get();
    String password = PASS.get();

    if (StringUtils.isBlank(name)) {
        name = hazelcastDao.getGroupName();
    }

    if (StringUtils.isBlank(password)) {
        password = hazelcastDao.getGroupPassword();
    }

    Config config = new Config();
    if (JMX.get()) {
        config.setProperty("hazelcast.jmx", "true");
    }

    config.setProperty("hazelcast.logging.type", LOGGING.get());
    config.setProperty("hazelcast.discovery.enabled", "true");


    GroupConfig groupConfig = new GroupConfig();
    groupConfig.setName(name);
    groupConfig.setPassword(password);
    config.setGroupConfig(groupConfig);

    DiscoveryStrategyConfig dsc = new DiscoveryStrategyConfig(dbDiscoveryFactory);

    DiscoveryConfig dc = new DiscoveryConfig();
    dc.setDiscoveryStrategyConfigs(Arrays.asList(dsc));

    JoinConfig joinConfig = new JoinConfig();
    joinConfig.setDiscoveryConfig(dc);
    joinConfig.getTcpIpConfig().setEnabled(false);
    joinConfig.getMulticastConfig().setEnabled(false);
    joinConfig.getAwsConfig().setEnabled(false);

    NetworkConfig nc = new NetworkConfig();
    nc.setPort(DBDiscovery.DEFAULT_PORT.get());
    nc.setJoin(joinConfig);
    nc.setPublicAddress(dbDiscovery.getLocalConfig().getAdvertiseAddress());

    config.setNetworkConfig(nc);

    HazelcastInstance hi = Hazelcast.newHazelcastInstance(config);
    while (!hi.getPartitionService().isClusterSafe()) {
        log.info("Waiting for cluster to be in a steady state");
        try {
            Thread.sleep(2000L);
        } catch (InterruptedException e) {
            throw new IllegalStateException("Waiting for cluster to be in a steady state", e);
        }
    }

    return hi;
}
 
开发者ID:rancher,项目名称:cattle,代码行数:57,代码来源:HazelcastFactory.java

示例5: HazelcastCache

import com.hazelcast.config.GroupConfig; //导入方法依赖的package包/类
private HazelcastCache() {
    final AppConfig config = AppConfig.getInstance();
    final Map<String, MapConfig> mapconfigs = new HashMap<>();
    GroupConfig groupconfig = new GroupConfig();
    groupconfig.setName(config.getString("cluster.name", "gw2live"));
    groupconfig.setPassword(config.getString("cluster.password", "gw2live"));
    final MapConfig mapconfig = new MapConfig();
    mapconfig.getMaxSizeConfig().setMaxSizePolicy(MaxSizePolicy.PER_PARTITION);
    mapconfig.getMaxSizeConfig().setSize(0);
    mapconfig.setEvictionPolicy(MapConfig.DEFAULT_EVICTION_POLICY);
    mapconfig.setBackupCount(1);
    mapconfigs.put("*-cache", mapconfig);
    final NetworkConfig nwconfig = new NetworkConfig();
    if(config.containsKey("cluster.interface")) {
        final InterfacesConfig interfaces = new InterfacesConfig();
        interfaces.addInterface(config.getString("cluster.interface"));
        interfaces.setEnabled(true);
        nwconfig.setInterfaces(interfaces);
    }
    nwconfig.setPort(config.getInteger("cluster.port", 5801));
    nwconfig.setPortAutoIncrement(true);
    final MulticastConfig mcconfig = new MulticastConfig();
    mcconfig.setEnabled(true);
    mcconfig.setMulticastGroup(config.getString("cluster.multicast.group", "224.2.2.3"));
    mcconfig.setMulticastPort(config.getInteger("cluster.multicast.port", 58011));
    mcconfig.setMulticastTimeToLive(MulticastConfig.DEFAULT_MULTICAST_TTL);
    mcconfig.setMulticastTimeoutSeconds(MulticastConfig.DEFAULT_MULTICAST_TIMEOUT_SECONDS);
    final JoinConfig join = new JoinConfig();
    join.setMulticastConfig(mcconfig);
    nwconfig.setJoin(join);
    final ExecutorConfig execconfig = new ExecutorConfig();
    execconfig.setName("default");
    execconfig.setPoolSize(4);
    execconfig.setQueueCapacity(100);
    final Map<String, ExecutorConfig> execmap = new HashMap<>();
    execmap.put("default", execconfig);
    final Config hconfig = new Config();
    hconfig.setInstanceName("gw2live");
    hconfig.setGroupConfig(groupconfig);
    hconfig.setMapConfigs(mapconfigs);
    hconfig.setNetworkConfig(nwconfig);
    hconfig.setExecutorConfigs(execmap);
    hconfig.setProperty("hazelcast.shutdownhook.enabled", "false");
    hconfig.setProperty("hazelcast.wait.seconds.before.join", "0");
    hconfig.setProperty("hazelcast.rest.enabled", "false");
    hconfig.setProperty("hazelcast.memcache.enabled", "false");
    hconfig.setProperty("hazelcast.mancenter.enabled", "false");
    hconfig.setProperty("hazelcast.logging.type", "none");
    cache = Hazelcast.newHazelcastInstance(hconfig);

    LOG.debug("Hazelcast initialized");
}
 
开发者ID:zyclonite,项目名称:gw2live,代码行数:53,代码来源:HazelcastCache.java


注:本文中的com.hazelcast.config.GroupConfig.setName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。