21 Mart 2021 Pazar

Hazelcast NetworkConfig Sınıfı

Giriş
Bu sınıf Config nesnesine atanır.

getJoin metodu
Örnek
Şöyle yaparız
Config config = new Config().setClusterName("Sample Hz Cluster");
NetworkConfig network = config.getNetworkConfig();
network.setPortAutoIncrement(true);

JoinConfig join = network.getJoin();
join.getMulticastConfig().setEnabled(true);
join.getTcpConfig().setEnabled(true)
  .addMember("192.168.0.107");
setJoin metodu - JoinConfig 
join configuration tanımı yapılabilir

Örnek
Şöyle yaparız
NetworkConfig networkConfig = new NetworkConfig()
  .setPort(5900)  
  .setPortAutoIncrement(false);

JoinConfig joinConfig = new JoinConfig();
TcpIpConfig tcpIpConfig = new TcpIpConfig();
tcpIpConfig.setConnectionTimeoutSeconds(30); 
tcpIpConfig.setEnabled(true);
    
List<String> memberList = new ArrayList<>();
memberList.add("machine1");
tcpIpConfig.setMembers(memberList);

joinConfig.setTcpIpConfig(tcpIpConfig);

networkConfig.setJoin(joinConfig);

Config config = new Config();
config.setNetworkConfig(networkConfig);

Hiç yorum yok:

Yorum Gönder