Giriş
Şu satırı dahil ederiz
import com.hazelcast.config.TcpIpConfig;
setConnectionTimeoutSeconds
Örnek
Şöyle yaparız
private NetworkConfig getHazelcastNetworkConfig(){ 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("127.0.0.1:5900"); tcpIpConfig.setMembers(memberList); joinConfig.setTcpIpConfig(tcpIpConfig); networkConfig.setJoin(joinConfig); return networkConfig; }
Örnek
Şöyle yaparız
@Bean("hazelcastInstanceTest") public HazelcastInstance hazelcastInstance() { Config config = new Config(); config.getNetworkConfig().addOutboundPort(0); JoinConfig joinConfig = config.getNetworkConfig().getJoin(); joinConfig.getMulticastConfig() .setEnabled(false); List<String> members = Arrays.asList("MEMBER1:5701","MEMBER2:5701"); joinConfig.getTcpIpConfig() .setMembers(members) .setEnabled(true); return Hazelcast.newHazelcastInstance(config); }
Hiç yorum yok:
Yorum Gönder