Package org.jgroups.util

Examples of org.jgroups.util.Rsp


        Assert.assertEquals(6, rl.size());
    }


    public void testRemove() {
        Rsp rsp;
        rsp=rl.remove(Util.createRandomAddress());
        assert rsp == null;
        rsp=rl.remove(a2);
        Assert.assertEquals(rsp, rsp2);
        Assert.assertEquals(4, rl.size());
View Full Code Here


    public void testAddRsp() {
        Address tmp=Util.createRandomAddress();
        rl.addRsp(tmp, new Integer(322649));
        Assert.assertEquals(6, rl.size());
        Rsp rsp=rl.get(tmp);
        assert rsp != null;
        assert rsp.wasReceived();
        assert !(rsp.wasSuspected());
        Assert.assertEquals(new Integer(322649), rsp.getValue());
    }
View Full Code Here


    public void testAddRsp2() {
        rl.addRsp(a1, new Integer(322649));
        Assert.assertEquals(5, rl.size());
        Rsp rsp=rl.get(a1);
        assert rsp != null;
        assert rsp.wasReceived();
        assert !(rsp.wasSuspected());
        Assert.assertEquals(new Integer(322649), rsp.getValue());
    }
View Full Code Here

        Assert.assertEquals(2, v.size());
    }


    public void testElementAt() {
        Rsp rsp;
        Set<Address> s=new HashSet<Address>();
        s.addAll(rl.keySet());
//        for(int i=0; i < rl.size(); i++) {
//            rsp=(Rsp)rl.elementAt(i);
//            s.add(rsp.getSender());
View Full Code Here

  /* Process all the responses (Digest): compute a range of messages (min and max seqno) for each
     member that has to be re-broadcast; FlushRsp contains those messages. They will be re-braodcast
     by the cordinator (in the GMS protocol). */
  for(int i=0; i < rsp_list.size(); i++) {
      Rsp rsp=(Rsp)rsp_list.elementAt(i);
      if(rsp.wasReceived()) {
    digest=(Digest)rsp.getValue();
    if(digest != null) {
        for(int j=0; j < digest.highest_seqnos.length && j < min.length; j++) {
      min[j]=Math.min(min[j], digest.highest_seqnos[j]);
      max[j]=Math.max(max[j], digest.highest_seqnos[j]);
        }
View Full Code Here

            Address mbr;
            synchronized(requests) {
                requests.clear();
                for(int i=0; i < mbrs.size(); i++) {
                    mbr=(Address)mbrs.elementAt(i);
                    requests.put(mbr, new Rsp(mbr));
                }
            }
            // maintain local membership
            synchronized(this.members) {
                this.members.clear();
                this.members.addAll(mbrs);
            }
        }
        else {
            synchronized(requests) {
                Rsp rsp;
                for(Iterator it=requests.values().iterator(); it.hasNext();) {
                    rsp=(Rsp)it.next();
                    rsp.setReceived(false);
                    rsp.setValue(null);
                }
            }
        }
    }
View Full Code Here

            if(log.isWarnEnabled()) log.warn("received response from suspected member " + sender + "; discarding");
            return;
        }

        synchronized(requests) {
            Rsp rsp=(Rsp)requests.get(sender);
            if(rsp != null) {
                if(rsp.wasReceived() == false) {
                    rsp.setValue(response_value);
                    rsp.setReceived(true);
                    if(log.isTraceEnabled())
                        log.trace(new StringBuffer("received response for request ").append(req_id).append(", sender=").
                                  append(sender).append(", val=").append(response_value));
                    requests.notifyAll(); // wakes up execute()
                }
View Full Code Here

     * Report to <code>GroupRequest</code> that a member is reported as faulty (suspected).
     * This method would probably be called when getting a suspect message from a failure detector
     * (where available). It is used to exclude faulty members from the response list.
     */
    public void suspect(Address suspected_member) {
        Rsp rsp;

        if(suspected_member == null)
            return;

        addSuspect(suspected_member);

        synchronized(requests) {
            rsp=(Rsp)requests.get(suspected_member);
            if(rsp != null) {
                rsp.setSuspected(true);
                rsp.setValue(null);
                requests.notifyAll();
            }
        }
    }
View Full Code Here

            this.members.clear();
            this.members.addAll(mbrs);
        }

        Map.Entry entry;
        Rsp rsp;
        boolean modified=false;
        synchronized(requests) {
            for(Iterator it=requests.entrySet().iterator(); it.hasNext();) {
                entry=(Map.Entry)it.next();
                mbr=(Address)entry.getKey();
                if(!mbrs.contains(mbr)) {
                    addSuspect(mbr);
                    rsp=(Rsp)entry.getValue();
                    rsp.setValue(null);
                    rsp.setSuspected(true);
                    modified=true;
                }
            }
            if(modified)
                requests.notifyAll();
View Full Code Here

        if(caller != null)
            ret.append("caller=").append(caller).append("\n");

        Map.Entry entry;
        Address mbr;
        Rsp rsp;
        synchronized(requests) {
            for(Iterator it=requests.entrySet().iterator(); it.hasNext();) {
                entry=(Map.Entry)it.next();
                mbr=(Address)entry.getKey();
                rsp=(Rsp)entry.getValue();
View Full Code Here

TOP

Related Classes of org.jgroups.util.Rsp

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.