org.jgroups.protocols.pbcast.Merger2 Maven / Gradle / Ivy
Go to download
This artifact provides a single jar that contains all classes required to use remote Jakarta Enterprise Beans and Jakarta Messaging, including
all dependencies. It is intended for use by those not using maven, maven users should just import the Jakarta Enterprise Beans and
Jakarta Messaging BOM's instead (shaded JAR's cause lots of problems with maven, as it is very easy to inadvertently end up
with different versions on classes on the class path).
package org.jgroups.protocols.pbcast;
import org.jgroups.Address;
import org.jgroups.View;
import org.jgroups.util.Util;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
/**
* Implements different merge policy (https://issues.jboss.org/browse/JGRP-1910). Might get merged with Merger
* @author Bela Ban
* @since 3.6.3
*/
public class Merger2 extends Merger {
public Merger2(GMS gms) {
super(gms);
}
/**
* Grabs the view coordinators
*/
@Override
protected Map> determineMergeCoords(Map views) {
Map> retval=new HashMap<>();
for(View view: views.values()) {
Address coord=view.getCreator();
Collection members=retval.get(coord);
if(members == null)
retval.put(coord, members=new ArrayList<>());
for(Address mbr: view.getMembersRaw())
if(!members.contains(mbr))
members.add(mbr);
}
// For the merge participants which are not coordinator, we simply add them, and the associated
// membership list consists only of themselves
Collection merge_participants=Util.determineMergeParticipants(views);
merge_participants.removeAll(retval.keySet());
for(Address merge_participant: merge_participants) {
if(!retval.containsKey(merge_participant)) {
Collection tmp=new ArrayList<>();
tmp.add(merge_participant);
retval.put(merge_participant, tmp);
}
}
return retval;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy