Examples of Rsp


Examples of org.jgroups.util.Rsp

        reset(null); // clear 'responses' array

        synchronized(requests) {
            for(int i=0; i < suspects.size(); i++) {  // mark all suspects in 'received' array
                suspect=(Address)suspects.elementAt(i);
                Rsp rsp=(Rsp)requests.get(suspect);
                if(rsp != null) {
                    rsp.setSuspected(true);
                    break; // we can break here because we ensure there are no duplicate members
                }
            }
        }
View Full Code Here

Examples of org.jgroups.util.Rsp

    private boolean responsesComplete() {
        int num_received=0, num_not_received=0, num_suspected=0;
        final int num_total=requests.size();

        Rsp rsp;
        for(Iterator it=requests.values().iterator(); it.hasNext();) {
            rsp=(Rsp)it.next();
            if(rsp.wasReceived()) {
                num_received++;
            }
            else {
                if(rsp.wasSuspected()) {
                    num_suspected++;
                }
                else {
                    num_not_received++;
                }
View Full Code Here

Examples of org.jgroups.util.Rsp

        if(requests.size() == 0)
            return;

        Map.Entry entry;
        Address mbr;
        Rsp rsp;
        for(Iterator it=requests.entrySet().iterator(); it.hasNext();) {
            entry=(Map.Entry)it.next();
            mbr=(Address)entry.getKey();
            if((!this.members.contains(mbr)) || suspects.contains(mbr)) {
                addSuspect(mbr);
                rsp=(Rsp)entry.getValue();
                rsp.setValue(null);
                rsp.setSuspected(true);
            }
        }
    }
View Full Code Here

Examples of org.jgroups.util.Rsp

    byte[] getStateFromSingle(Address target) throws Throwable {
        Vector dests=new Vector(11);
        Message msg;
        StateTransferRequest r=new StateTransferRequest(StateTransferRequest.RETURN_STATE, local_addr);
        RspList rsp_list;
        Rsp rsp;
        Address dest;
        GroupRequest req;
        int num_tries=0;


        try {
            msg=new Message(null, null, Util.objectToByteBuffer(r));
        }
        catch(Exception e) {
            if(log.isErrorEnabled()) log.error("exception=" + e);
            return null;
        }

        while(members.size() > 1 && num_tries++ < 3) {  // excluding myself
            dest=target != null? target : determineCoordinator();
            if(dest == null)
                return null;
            msg.setDest(dest);
            dests.removeAllElements();
            dests.addElement(dest);
            req=new GroupRequest(msg, corr, dests, GroupRequest.GET_FIRST, timeout_return_state, 0);
            req.execute();
            rsp_list=req.getResults();
            for(int i=0; i < rsp_list.size(); i++) {  // get the first non-suspected result
                rsp=(Rsp)rsp_list.elementAt(i);
                if(rsp.wasReceived())
                    return (byte[])rsp.getValue();
            }
            Util.sleep(1000);
        }

        return null;
View Full Code Here

Examples of org.jgroups.util.Rsp

        RspList rsps=disp.callRemoteMethods(members, "foo", null, new Class[]{String.class, String.class},
                                            GroupRequest.GET_ALL, 8000);
        System.out.println("responses:\n" + rsps + ", channel.view: " + channel.getView() + ", channel2.view: " + channel2.getView());
        assertEquals(members.size(), rsps.size());
        for(int i=0; i < rsps.size(); i++) {
            Rsp rsp=(Rsp)rsps.elementAt(i);
            assertTrue(rsp.getValue() instanceof NoSuchMethodException);
        }
    }
View Full Code Here

Examples of org.jgroups.util.Rsp

        rsps=disp.callRemoteMethods(null, "methodA", new Object[]{Boolean.TRUE, new Long(322649)},
                                    new Class[]{boolean.class, long.class},
                                    GroupRequest.GET_ALL, 0);
        assertEquals(2, rsps.size());
        for(Iterator it=rsps.values().iterator(); it.hasNext();) {
            Rsp rsp=(Rsp)it.next();
            assertNull(rsp.getValue());
            assertTrue(rsp.wasReceived());
            assertFalse(rsp.wasSuspected());
        }

        rsps=disp.callRemoteMethods(null, "methodB", null, (Class[])null, GroupRequest.GET_ALL, 0);
        assertEquals(2, rsps.size());
        for(Iterator it=rsps.values().iterator(); it.hasNext();) {
            Rsp rsp=(Rsp)it.next();
            assertNotNull(rsp.getValue());
            assertEquals(Boolean.TRUE, rsp.getValue());
            assertTrue(rsp.wasReceived());
            assertFalse(rsp.wasSuspected());
        }


        rsps=disp.callRemoteMethods(null, "methodC", null, (Class[])null, GroupRequest.GET_ALL, 0);
        assertEquals(2, rsps.size());
        for(Iterator it=rsps.values().iterator(); it.hasNext();) {
            Rsp rsp=(Rsp)it.next();
            assertNotNull(rsp.getValue());
            assertTrue(rsp.getValue() instanceof Throwable);
            assertTrue(rsp.wasReceived());
            assertFalse(rsp.wasSuspected());
        }

        disp.setRequestMarshaller(null);
        disp.setResponseMarshaller(null);
        disp2.setRequestMarshaller(null);
View Full Code Here

Examples of org.jgroups.util.Rsp

      RspList rsps=d.callRemoteMethods(v, "doSomething", new Object[]{}, new Class[]{}, GroupRequest.GET_ALL, 10000, useAnycast);
      Map.Entry entry;
       for(Iterator it=rsps.entrySet().iterator(); it.hasNext();) {
           entry=(Map.Entry)it.next();
           Address member=(Address)entry.getKey();
           Rsp rsp=(Rsp)entry.getValue();
           if(!rsp.wasReceived())
               throw new RuntimeException("response from " + member + " was not received, rsp=" + rsp);
       }

   }
View Full Code Here

Examples of org.jgroups.util.Rsp

        int totalPositiveVotes = 0;
        int totalNegativeVotes = 0;

        for (int i = 0; i < responses.size(); i++) {
            Rsp response = (Rsp) responses.elementAt(i);

            switch (checkResponse(response)) {
                case PROCESS_SKIP:
                    continue;
                case PROCESS_BREAK:
                    return false;
            }

            VoteResult result = (VoteResult) response.getValue();

            totalPositiveVotes += result.getPositiveVotes();
            totalNegativeVotes += result.getNegativeVotes();
        }
View Full Code Here

Examples of org.jgroups.util.Rsp

        this.req_id=getRequestId();       
        this.timeout=timeout;
        this.expected_mbrs=expected_mbrs;
        if(mbrs != null) {           
            for(Address mbr: mbrs) {
                requests.put(mbr, new Rsp(mbr));
            }           
            this.members.clear();
            this.members.addAll(mbrs);
        }
    }
View Full Code Here

Examples of org.jgroups.util.Rsp

        Vector<Address> targets=null;
        lock.lock();
        try {
            targets=new Vector<Address>(members);          
            for(Address suspect: suspects) { // mark all suspects in 'received' array
                Rsp rsp=requests.get(suspect);
                if(rsp != null) {
                    rsp.setSuspected(true);
                    break; // we can break here because we ensure there are no duplicate members
                }
            }
        }
        finally {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.