Package org.jgroups.protocols

Examples of org.jgroups.protocols.PingRsp


    private List<PingRsp> findInitialMembers(Promise<JoinRsp> promise) {
        List<PingRsp> responses=(List<PingRsp>)gms.getDownProtocol().down(new Event(Event.FIND_INITIAL_MBRS, promise));
        if(responses != null) {
            for(Iterator<PingRsp> iter=responses.iterator(); iter.hasNext();) {
                PingRsp response=iter.next();
                if(response.own_addr != null && response.own_addr.equals(gms.local_addr))
                    iter.remove();
            }
        }
        return responses;
View Full Code Here


    public void testHeaders() throws Exception {
        Address dest, src;
        dest=new IpAddress("228.1.2.3", 5555);
        src=new IpAddress("127.0.0.1", 6666);
        Message msg=new Message(dest, src, "Hello world".getBytes());
        PingHeader hdr=new PingHeader(PingHeader.GET_MBRS_REQ, new PingRsp(src, src, true));
        msg.putHeader("ping-header", hdr);
        UdpHeader udp_hdr=new UdpHeader("bla");
        msg.putHeader("udp-header", udp_hdr);
        stream(msg);
    }
View Full Code Here

        dest=new IpAddress("228.1.2.3", 5555);
        dest.setAdditionalData("foo".getBytes());
        src=new IpAddress("127.0.0.1", 6666);
        src.setAdditionalData("foobar".getBytes());
        Message msg=new Message(dest, src, "Hello world".getBytes());
        PingHeader hdr=new PingHeader(PingHeader.GET_MBRS_REQ, new PingRsp(src, src, false));
        msg.putHeader("ping-header", hdr);
        UdpHeader udp_hdr=new UdpHeader("bla");
        msg.putHeader("udp-header", udp_hdr);
        stream(msg);
    }
View Full Code Here

    private List<PingRsp> findInitialMembers(Promise<JoinRsp> promise) {
        List<PingRsp> responses=(List<PingRsp>)gms.getDownProtocol().down(new Event(Event.FIND_INITIAL_MBRS, promise));
        if(responses != null) {
            for(Iterator<PingRsp> iter=responses.iterator(); iter.hasNext();) {
                PingRsp response=iter.next();
                if(response.own_addr != null && response.own_addr.equals(gms.local_addr))
                    iter.remove();
            }
        }
        return responses;
View Full Code Here

                // so the member to become singleton member (and thus coord) is the first of all clients
                Set clients=new TreeSet(); // sorted
                clients.add(mbr); // add myself again (was removed by findInitialMembers())
                for(int i=0; i < initial_mbrs.size(); i++) {
                    PingRsp pingRsp=(PingRsp)initial_mbrs.elementAt(i);
                    Address client_addr=pingRsp.getAddress();
                    if(client_addr != null)
                        clients.add(client_addr);
                }
                if(log.isTraceEnabled())
                    log.trace("clients to choose new coord from are: " + clients);
View Full Code Here

    /**
     * Pings initial members. Removes self before returning vector of initial members.
     * Uses IP multicast or gossiping, depending on parameters.
     */
    void findInitialMembers() {
        PingRsp ping_rsp;

        synchronized(initial_mbrs) {
            initial_mbrs.removeAllElements();
            initial_mbrs_received=false;
            gms.passDown(new Event(Event.FIND_INITIAL_MBRS));
View Full Code Here

    /**
     The coordinator is determined by a majority vote. If there are an equal number of votes for
     more than 1 candidate, we determine the winner randomly.
     */
    private Address determineCoord(Vector mbrs) {
        PingRsp mbr;
        Hashtable votes;
        int count, most_votes;
        Address winner=null, tmp;

        if(mbrs == null || mbrs.size() < 1)
View Full Code Here

TOP

Related Classes of org.jgroups.protocols.PingRsp

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.