Search in sources :

Example 1 with MergeView

use of org.jgroups.MergeView in project wildfly by wildfly.

the class ChannelCommandDispatcherFactory method viewAccepted.

@Override
public void viewAccepted(View view) {
    View oldView = this.view.getAndSet(view);
    if (oldView != null) {
        List<Node> oldNodes = this.getNodes(oldView);
        List<Node> newNodes = this.getNodes(view);
        List<Address> leftMembers = View.leftMembers(oldView, view);
        if (leftMembers != null) {
            this.nodeFactory.invalidate(leftMembers);
        }
        for (Map.Entry<Listener, ExecutorService> entry : this.listeners.entrySet()) {
            try {
                Listener listener = entry.getKey();
                ExecutorService executor = entry.getValue();
                executor.submit(() -> {
                    try {
                        listener.membershipChanged(oldNodes, newNodes, view instanceof MergeView);
                    } catch (Throwable e) {
                        ClusteringLogger.ROOT_LOGGER.warn(e.getLocalizedMessage(), e);
                    }
                });
            } catch (RejectedExecutionException e) {
            // Executor was shutdown
            }
        }
    }
}
Also used : MergeView(org.jgroups.MergeView) MembershipListener(org.jgroups.MembershipListener) Address(org.jgroups.Address) Node(org.wildfly.clustering.group.Node) ExecutorService(java.util.concurrent.ExecutorService) MergeView(org.jgroups.MergeView) View(org.jgroups.View) Map(java.util.Map) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) RejectedExecutionException(java.util.concurrent.RejectedExecutionException)

Aggregations

Map (java.util.Map)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 ExecutorService (java.util.concurrent.ExecutorService)1 RejectedExecutionException (java.util.concurrent.RejectedExecutionException)1 Address (org.jgroups.Address)1 MembershipListener (org.jgroups.MembershipListener)1 MergeView (org.jgroups.MergeView)1 View (org.jgroups.View)1 Node (org.wildfly.clustering.group.Node)1