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

项目:hazelcast-simulator    文件:Runner.java   
private String createConfig() {
    Config memberConfig = options.memberConfig;
    if (memberConfig == null) {
        return null;
    }

    memberConfig.getGroupConfig().setName("workers");

    memberConfig.setProperty("hazelcast.phone.home.enabled", "false");

    NetworkConfig networkConfig = memberConfig.getNetworkConfig();
    networkConfig.setPortAutoIncrement(true);
    networkConfig.setPort(PORT);
    networkConfig.setPortCount(PORT_COUNT);
    networkConfig.getJoin().getMulticastConfig().setEnabled(false);
    networkConfig.getJoin().getTcpIpConfig().setEnabled(true);

    ConfigXmlGenerator generator = new ConfigXmlGenerator(true);

    String configString = generator.generate(memberConfig);

    if (networkConfig.getJoin().getTcpIpConfig().getMembers().isEmpty()) {
        configString = configString.replace("<member-list/>", "<!--MEMBERS-->");
    }

    configString = fixGroup(configString);

    System.out.println("HZ Configuration:\n" + configString);
    return configString;
}
项目:health-and-care-developer-network    文件:MemberConfigRequest.java   
public void writeResponse(ManagementCenterService mcs, DataOutput dos) throws Exception {
    String clusterXml;
    clusterXml = new ConfigXmlGenerator(true).generate(mcs.getHazelcastInstance().getConfig());
    dos.writeUTF(clusterXml);
}