本文整理了Java中com.hazelcast.config.Config.getNetworkConfig()
方法的一些代码示例,展示了Config.getNetworkConfig()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Config.getNetworkConfig()
方法的具体详情如下:
包路径:com.hazelcast.config.Config
类名称:Config
方法名:getNetworkConfig
[英]Returns the network configuration for this hazelcast instance. The network configuration defines how a member will interact with other members or clients.
[中]返回此hazelcast实例的网络配置。网络配置定义了成员将如何与其他成员或客户端交互。
代码示例来源:origin: SonarSource/sonarqube
NetworkConfig netConfig = config.getNetworkConfig();
netConfig
.setPort(port)
代码示例来源:origin: hazelcast/hazelcast-jet
DefaultAddressPicker(Config config, ILogger logger) {
super(config.getNetworkConfig(), logger);
this.config = config;
this.hazelcastProperties = new HazelcastProperties(config);
}
代码示例来源:origin: hazelcast/hazelcast-jet
public static Collection<String> getConfigurationMembers(Config config) {
final TcpIpConfig tcpIpConfig = config.getNetworkConfig().getJoin().getTcpIpConfig();
final Collection<String> configMembers = tcpIpConfig.getMembers();
final Set<String> possibleMembers = new HashSet<String>();
for (String member : configMembers) {
// split members defined in tcp-ip configuration by comma(,) semi-colon(;) space( ).
String[] members = member.split("[,; ]");
Collections.addAll(possibleMembers, members);
}
return possibleMembers;
}
代码示例来源:origin: kloiasoft/eventapis
@Override
public Config configure(Config config) {
config.getNetworkConfig().getJoin().setMulticastConfig(this);
return config;
}
}
代码示例来源:origin: hazelcast/hazelcast-jet
private void handleSocketInterceptorConfig(Node node) {
SocketInterceptorConfig socketInterceptorConfig = parseSocketInterceptorConfig(node);
config.getNetworkConfig().setSocketInterceptorConfig(socketInterceptorConfig);
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
/**
* Create a Hazelcast instance for testing, a server instance not connected to others, so turn off discovery.
*
* @return A standalone server instance, auto-closeable
*/
@Bean
public HazelcastInstance hazelcastInstance() {
Config config = new Config();
config.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(false);
return Hazelcast.newHazelcastInstance(config);
}
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
public static void main(String[] args) {
Config config1 = createConfig();
Config config2 = createConfig();
// each member will be given an id via SocketInterceptorConfig property
config1.getNetworkConfig().getSocketInterceptorConfig().setProperty("member-id", "firstMember");
config2.getNetworkConfig().getSocketInterceptorConfig().setProperty("member-id", "secondMember");
Hazelcast.newHazelcastInstance(config1);
Hazelcast.newHazelcastInstance(config2);
}
代码示例来源:origin: hazelcast/hazelcast-jet
@ManagedAnnotation("port")
@ManagedDescription("Network Port")
public int getPort() {
return config.getNetworkConfig().getPort();
}
代码示例来源:origin: hazelcast/hazelcast-jet
private void handleMemberList(Node node) {
JoinConfig join = config.getNetworkConfig().getJoin();
TcpIpConfig tcpIpConfig = join.getTcpIpConfig();
for (Node n : childElements(node)) {
String nodeName = cleanNodeName(n);
if ("member".equals(nodeName)) {
String value = getTextContent(n).trim();
tcpIpConfig.addMember(value);
}
}
}
代码示例来源:origin: hazelcast/hazelcast-jet
@Override
public Collection<Integer> getOutboundPorts() {
final NetworkConfig networkConfig = node.getConfig().getNetworkConfig();
final Collection<Integer> outboundPorts = networkConfig.getOutboundPorts();
final Collection<String> outboundPortDefinitions = networkConfig.getOutboundPortDefinitions();
return AddressUtil.getOutboundPorts(outboundPorts, outboundPortDefinitions);
}
代码示例来源:origin: com.hazelcast/hazelcast-aws
public TcpIpJoinerOverAWS(Node node) {
super(node);
logger = node.getLogger(getClass());
AwsConfig awsConfig = fromDeprecatedAwsConfig(node.getConfig().getNetworkConfig().getJoin().getAwsConfig());
aws = new AWSClient(awsConfig);
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
@Bean
public Config hazelcastConfig() {
Config config = new Config();
JoinConfig joinConfig = config.getNetworkConfig().getJoin();
joinConfig.getMulticastConfig().setEnabled(false);
joinConfig.getKubernetesConfig().setEnabled(true);
return config;
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
private static Config createConfig() {
Config config = new Config();
config.setLicenseKey(ENTERPRISE_LICENSE_KEY);
config.setProperty("hazelcast.wait.seconds.before.join", "0");
SocketInterceptorConfig interceptorConfig = new SocketInterceptorConfig();
interceptorConfig.setEnabled(true).setClassName(MySocketInterceptor.class.getName());
config.getNetworkConfig().setSocketInterceptorConfig(interceptorConfig);
return config;
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
private static Config createConfig() {
Config config = new Config();
config.setLicenseKey(ENTERPRISE_LICENSE_KEY);
config.setProperty("hazelcast.wait.seconds.before.join", "0");
SocketInterceptorConfig interceptorConfig = new SocketInterceptorConfig();
interceptorConfig.setEnabled(true).setClassName(MySocketInterceptor.class.getName());
config.getNetworkConfig().setSocketInterceptorConfig(interceptorConfig);
return config;
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
private static HazelcastInstance newHazelcastInstance(int port) {
Config config = new Config();
config.setLicenseKey(ENTERPRISE_LICENSE_KEY);
config.getNetworkConfig().setPort(port).setPortAutoIncrement(false);
JoinConfig join = config.getNetworkConfig().getJoin();
join.getMulticastConfig().setEnabled(false);
join.getTcpIpConfig().setEnabled(true).clear()
.addMember("127.0.0.1:5701")
.addMember("127.0.0.1:5702");
HotRestartPersistenceConfig hotRestartConfig = config.getHotRestartPersistenceConfig();
hotRestartConfig.setEnabled(true).setBaseDir(new File(HOT_RESTART_ROOT_DIR + port));
return Hazelcast.newHazelcastInstance(config);
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
private Config getConfigClusterB() {
Config config = new Config();
config.setLicenseKey(ENTERPRISE_LICENSE_KEY);
config.getGroupConfig().setName("clusterB").setPassword("clusterB-pass");
config.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(false);
config.getNetworkConfig().getJoin().getTcpIpConfig().setEnabled(true).addMember("127.0.0.1:5702");
config.setInstanceName("clusterB");
config.getNetworkConfig().setPort(5702);
config.setClassLoader(createCacheManagerClassLoader());
return config;
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
private static HazelcastInstance buildCluster(int memberCount) {
Config config = new Config();
NetworkConfig networkConfig = config.getNetworkConfig();
networkConfig.getJoin().getMulticastConfig().setEnabled(false);
networkConfig.getJoin().getTcpIpConfig().setEnabled(true);
networkConfig.getJoin().getTcpIpConfig().setMembers(singletonList("127.0.0.1"));
HazelcastInstance[] hazelcastInstances = new HazelcastInstance[memberCount];
for (int i = 0; i < memberCount; i++) {
hazelcastInstances[i] = Hazelcast.newHazelcastInstance(config);
}
return hazelcastInstances[0];
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
private static Config getConfigClusterB() {
Config config = new Config();
config.setLicenseKey(ENTERPRISE_LICENSE_KEY);
config.getGroupConfig().setName("clusterB").setPassword("clusterB-pass");
config.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(false);
config.getNetworkConfig().getJoin().getTcpIpConfig().setEnabled(true).addMember("127.0.0.1:5702");
return config;
}
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
protected Config createConfig() {
Config config = new Config();
JoinConfig joinConfig = config.getNetworkConfig().getJoin();
joinConfig.getAwsConfig().setEnabled(false);
joinConfig.getMulticastConfig().setEnabled(false);
joinConfig.getTcpIpConfig().setEnabled(false);
return config;
}
代码示例来源:origin: hazelcast/hazelcast-code-samples
private static Config createConfig() {
Config config = new Config();
JoinConfig joinConfig = config.getNetworkConfig().getJoin();
joinConfig.getAwsConfig().setEnabled(false);
joinConfig.getMulticastConfig().setEnabled(false);
joinConfig.getTcpIpConfig().setEnabled(false);
return config;
}
内容来源于网络,如有侵权,请联系作者删除!