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

项目:hazelcast-archive    文件:Node.java   
Joiner createJoiner() {
    Join join = config.getNetworkConfig().getJoin();
    if (join.getMulticastConfig().isEnabled() && multicastService != null) {
        systemLogService.logJoin("Created MulticastJoiner");
        return new MulticastJoiner(this);
    } else if (join.getTcpIpConfig().isEnabled()) {
        systemLogService.logJoin("Created TcpIpJoiner");
        return new TcpIpJoiner(this);
    } else if (join.getAwsConfig().isEnabled()) {
        try {
            Class clazz = Class.forName("com.hazelcast.impl.TcpIpJoinerOverAWS");
            Constructor constructor = clazz.getConstructor(Node.class);
            systemLogService.logJoin("Created AWSJoiner");
            return (Joiner) constructor.newInstance(this);
        } catch (Exception e) {
            logger.log(Level.WARNING, e.getMessage());
            return null;
        }
    }
    return null;
}
项目:spino    文件:SpinoHazelcastImpl.java   
void start(String... seeds) {
    handler = this.new HazelcastListener();
    Config hzConfig = new Config();

    if (seeds != null) {
        NetworkConfig networkConfig = hzConfig.getNetworkConfig();
        Join join = networkConfig.getJoin();
        join.getMulticastConfig().setEnabled(false);
        for(String address : seeds) {
            join.getTcpIpConfig().addMember(address);
        }
        join.getTcpIpConfig().setEnabled(true);
    }

    hzConfig.getGroupConfig().setName(GROUP_NAME);
    this.hz = Hazelcast.newHazelcastInstance(hzConfig);
    this.cluster = hz.getCluster();
    cluster.addMembershipListener(handler);
    getServicesMap().addEntryListener(handler, true);
    syncServiceMap(cluster);
}
项目: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);
}
项目:synergynet3.1    文件:SynergyNetApp.java   
/**
 * Establishes the values of variables used throughout the app.
 **/
private void initiateDefaultVariables()
{
    networkFlickEnabled = false;

    this.stage = MultiplicityEnvironment.get().getLocalStages().get(0);
    this.behaviourMaker = this.stage.getBehaviourMaker();
    this.contentFactory = this.stage.getContentFactory();

    if (NETWORKING)
    {

        WebConfigPrefsItem webconfig = new WebConfigPrefsItem();
        Config cfg = new Config();
        NetworkConfig network = cfg.getNetworkConfig();

        String clusterInterface = webconfig.getClusterInterface();
        if (!clusterInterface.equals(""))
        {
            network.getInterfaces().setEnabled(true).addInterface(clusterInterface);
            Hazelcast.init(cfg);
        }

        //Check if webconfig has TCP/IP enabled 
        if (!webconfig.getJoinModeMulticasting())
        {

            //Disable multicasting
            Join join = network.getJoin();
            join.getMulticastConfig().setEnabled( false );

            //Add IPs of members to look for, collected from the config
            join.getTcpIpConfig().addMember(webconfig.getTcpIPs()).setEnabled( true );

            //Increase waiting time to a minute
            join.getTcpIpConfig().setConnectionTimeoutSeconds(60);

        }

        localDevicePosition = SynergyNetPositioning.getLocalDeviceLocationFull();
    }

    AdditionalItemUtilities.loadAdditionalItems(stage);
}
项目:hazelcast-archive    文件:TcpIpJoiner.java   
protected List<String> getMembers(Config config) {
    Join join = config.getNetworkConfig().getJoin();
    return join.getTcpIpConfig().getMembers();
}