com.hazelcast.cluster.MembershipEvent Java Examples

The following examples show how to use com.hazelcast.cluster.MembershipEvent. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HazelcastClusterManager.java    From vertx-hazelcast with Apache License 2.0 6 votes vote down vote up
@Override
public synchronized void memberAdded(MembershipEvent membershipEvent) {
  if (!active) {
    return;
  }
  Member member = membershipEvent.getMember();
  String nid = member.getUuid().toString();
  try {
    if (nodeListener != null) {
      nodeIds.add(nid);
      nodeListener.nodeAdded(nid);
    }
  } catch (Throwable t) {
    log.error("Failed to handle memberAdded", t);
  }
}
 
Example #2
Source File: HazelcastClusterManager.java    From vertx-hazelcast with Apache License 2.0 5 votes vote down vote up
@Override
public synchronized void memberRemoved(MembershipEvent membershipEvent) {
  if (!active) {
    return;
  }
  Member member = membershipEvent.getMember();
  String nid = member.getUuid().toString();
  try {
    membersRemoved(Collections.singleton(nid));
  } catch (Throwable t) {
    log.error("Failed to handle memberRemoved", t);
  }
}
 
Example #3
Source File: ClusterListener.java    From mercury with Apache License 2.0 4 votes vote down vote up
@Override
public void memberAdded(MembershipEvent event) {
    String now = Utility.getInstance().date2str(new Date());
    nodes.put(event.getMember().getUuid().toString(), event.getMember().getAddress().toString()+", "+now);
    log.info("Added {}", event.getMember());
}
 
Example #4
Source File: ClusterListener.java    From mercury with Apache License 2.0 4 votes vote down vote up
@Override
public void memberRemoved(MembershipEvent event) {
    nodes.remove(event.getMember().getUuid().toString());
    log.info("Removed {}", event.getMember());
}