All Downloads are FREE. Search and download functionalities are using the official Maven repository.

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).

There is a newer version: 33.0.2.Final
Show newest version
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());
        if(tmp.isSingleton())
            throw new IllegalStateException("shared transports are not supported by " + SHARED_LOOPBACK_PING.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) for(PingData data: retval) { if(!data.getAddress().equals(local_addr)) responses.addResponse(data, false); } responses.done(); // so waitFor() doesn't block at all } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy