org.jgroups.protocols.SHARED_LOOPBACK_PING Maven / Gradle / Ivy
Go to download
This artifact provides a single jar that contains all classes required to use remote EJB and JMS, including
all dependencies. It is intended for use by those not using maven, maven users should just import the EJB and
JMS 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;
import org.jgroups.Address;
import org.jgroups.Event;
import org.jgroups.util.Responses;
import java.util.List;
/**
* Discovery protocol running over {@link SHARED_LOOPBACK} only. Doesn't send discovery requests and responses, but
* fetches discovery information directly from SHARED_LOOPBACK. Used mainly by unit test.
* @author Bela Ban
* @since 3.5
*/
public class SHARED_LOOPBACK_PING extends Discovery {
public void init() throws Exception {
super.init();
TP tmp=getTransport();
if(!(tmp instanceof SHARED_LOOPBACK))
throw new IllegalStateException("the transport must be " + SHARED_LOOPBACK.class.getSimpleName());
}
public boolean isDynamic() {
return true;
}
@Override
public void findMembers(List members, boolean initial_discovery, Responses responses) {
num_discovery_requests++;
List retval=(List)down_prot.down(new Event(Event.GET_PING_DATA, cluster_name));
if(retval != null)
retval.forEach(data -> responses.addResponse(data, false));
}
}