Package org.jgroups.util

Examples of org.jgroups.util.Rsp


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

    public void testElementAt() {
        Rsp rsp;
        Set s=new HashSet();
        for(int i=0; i < rl.size(); i++) {
            rsp=(Rsp)rl.elementAt(i);
            s.add(rsp.getSender());
        }
        System.out.println("-- set is " + s);
        assertEquals(rl.size(), s.size());
    }
View Full Code Here


        RspList rsps=disp1.callRemoteMethods(members, "foo", null, (Class[])null, GroupRequest.GET_ALL, timeout);
       
        // all responses
        System.out.println("responses:\n" + rsps);
        for(Map.Entry<Address,Rsp> entry: rsps.entrySet()) {
            Rsp rsp=entry.getValue();
            assertTrue("response from " + entry.getKey() + " was not received", rsp.wasReceived());
            assertFalse(rsp.wasSuspected());
        }
    }
View Full Code Here

    private void checkResults(RspList rsps, int num, boolean received) {
        assertEquals("responses: " + rsps, num, rsps.size());
        Map.Entry entry;
        for(Iterator it=rsps.entrySet().iterator(); it.hasNext();) {
            entry=(Map.Entry)it.next();
            Rsp rsp=(Rsp)entry.getValue();
            assertEquals("rsp: " + rsp, rsp.wasReceived(), received);
        }
    }
View Full Code Here

        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("response value is " + rsp.getValue(), rsp.getValue() instanceof NoSuchMethodException);
        }
    }
View Full Code Here

        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

      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

            targets=new Vector<Address>(members);
            req_id=getRequestId();
            // reset(null); // clear 'responses' array

            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

        lock.lock();
        try {
            if(mbrs != null) {
                requests.clear();
                for(Address mbr: mbrs) {
                    requests.put(mbr, new Rsp(mbr));
                }
                // maintain local membership
                this.members.clear();
                this.members.addAll(mbrs);
            }
View Full Code Here

                }
                return;
            }


            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 StringBuilder("received response for request ").append(req_id).append(", sender=").
                                append(sender).append(", val=").append(response_value));
                    if(rsp_filter != null && !rsp_filter.needMoreResponses())
                        done=true;
View Full Code Here

            return;

        lock.lock();
        try {
            addSuspect(suspected_member);
            Rsp rsp=requests.get(suspected_member);
            if(rsp != null) {
                rsp.setSuspected(true);
                rsp.setValue(null);
                completed.signalAll();
            }
        }
        finally {
            lock.unlock();
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.