Şu satırı dahil ederiz
import com.hazelcast.cluster.Cluster;
constructor
addMembershipListener metoduÖrnek
Şöyle yaparız
import com.hazelcast.cluster.MembershipEvent;import com.hazelcast.cluster.MembershipListener;import com.hazelcast.cluster.Cluster;public class ApplicationMembershipListener implements MembershipListener {@Overridepublic void memberAdded(MembershipEvent membershipEvent) {logger.info("New member added to cluster {} ",membershipEvent);}@Overridepublic void memberRemoved(MembershipEvent membershipEvent) {logger.info("A member removed from cluster {} ",membershipEvent);}}HazelcastInstance hazelcastInstance = ...;Cluster cluster = hazelcastInstance.getCluster();ApplicationMembershipListener membershipListener = new ApplicationMembershipListener();cluster.addMembershipListener(membershipListener);
getLocalMember metodu
Şöyle yaparız. Kendi Member nesnemi döner
HazelcastInstance hazelcastInstance = ...Member localMember = hazelcastInstance.getCluster().getLocalMember();
getMembers metodu
İmzası şöyle. Member seti döner
Set<Member> getMembers();
Hiç yorum yok:
Yorum Gönder