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

org.apache.activemq.artemis.shaded.org.jgroups.protocols.SHARED_LOOPBACK_PING Maven / Gradle / Ivy

There is a newer version: 2.33.0
Show newest version
package org.apache.activemq.artemis.shaded.org.jgroups.protocols;

import org.apache.activemq.artemis.shaded.org.jgroups.Address;
import org.apache.activemq.artemis.shaded.org.jgroups.Event;
import org.apache.activemq.artemis.shaded.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)); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy