com.hazelcast.core.LifecycleEvent Java Examples

The following examples show how to use com.hazelcast.core.LifecycleEvent. 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 stateChanged(LifecycleEvent lifecycleEvent) {
  if (!active) {
    return;
  }
  // Safeguard to make sure members list is OK after a partition merge
  if (lifecycleEvent.getState() == LifecycleEvent.LifecycleState.MERGED) {
    final List<String> currentNodes = getNodes();
    Set<String> newNodes = new HashSet<>(currentNodes);
    newNodes.removeAll(nodeIds);
    Set<String> removedMembers = new HashSet<>(nodeIds);
    removedMembers.removeAll(currentNodes);
    for (String nodeId : newNodes) {
      nodeListener.nodeAdded(nodeId);
    }
    membersRemoved(removedMembers);
    nodeIds.retainAll(currentNodes);
  }
}
 
Example #2
Source File: HazelcastManager.java    From lumongo with Apache License 2.0 4 votes vote down vote up
@Override
public void stateChanged(LifecycleEvent event) {
	log.info("Hazelcast has new state: " + event);
}