Package org.jgroups.blocks

Examples of org.jgroups.blocks.MethodCall


        serverObject.setRpcDispatcher(disp);
        c1.connect(name);
        Address localAddress = c1.getAddress();

        // call the nested group method on itself
        MethodCall call = new MethodCall("outerMethod", new Object[0], new Class[0]);
        log("calling outerMethod() on all members");
        RspList rspList = disp.callRemoteMethods(null, call, GroupRequest.GET_ALL, 0);
        log("results of outerMethod(): " + rspList);

        Assert.assertEquals(1, rspList.size());
View Full Code Here


        obj2.setRpcDispatcher(disp2);
        c2.connect(name);
        Address localAddress2 = c2.getAddress();

        // call a point-to-point method on Member 2 that triggers a nested distributed RPC
        MethodCall call = new MethodCall("outerMethod", new Object[0], new Class[0]);
        log("calling outerMethod() on " + localAddress2);
        Object retval = disp1.callRemoteMethod(localAddress2, call, GroupRequest.GET_ALL, 0);
        log("results of outerMethod(): " + retval);
    }
View Full Code Here

        Vector<Address> dests=new Vector<Address>();
        dests.add(c1.getAddress());
        dests.add(c2.getAddress());

        // call a point-to-point method on Member 2 that triggers a nested distributed RPC
        MethodCall call = new MethodCall("outerMethod", new Object[0], new Class[0]);
        log("calling outerMethod() on all members");
        RspList rsps = disp1.callRemoteMethods(dests, call, GroupRequest.GET_ALL, 0);
        log("results of outerMethod():\n" + rsps);
        Assert.assertEquals(2, rsps.size());
    }
View Full Code Here

            this.disp = rpcDispatcher;
        }

        public String outerMethod() {
            log("**** outerMethod() received, calling innerMethod() on all members");
            MethodCall call = new MethodCall("innerMethod", new Object[0], new Class[0]);
            // RspList rspList = disp.callRemoteMethods(null, call, GroupRequest.GET_ALL, 5000);
            RequestOptions opts=new RequestOptions(GroupRequest.GET_ALL, 0, false, null, (byte)0);
            opts.setFlags(Message.OOB);
            RspList rspList = disp.callRemoteMethods(null, call, opts);
            Vector results = rspList.getResults();
View Full Code Here

  pick.y = p.y;
  pick.fixed = pickfixed;


  try {
    MethodCall call = new MethodCall("moveNode", new Object[] {pick}, new String[] {Node.class.getName()});
      wb.disp.callRemoteMethods(null, call, GroupRequest.GET_ALL, 0);
  }
  catch(Exception ex) {
      log.error(ex.toString());
  }
View Full Code Here

  myname=name;
  int xloc = (int)(10 + 250*Math.random());
  int yloc = (int)(10 + 250*Math.random());

  try {
      MethodCall call=new MethodCall("addNode",
          new Object[] {name, my_addr, new Integer(xloc), new Integer(yloc)},
          new String[] {String.class.getName(), Address.class.getName(), int.class.getName(), int.class.getName()});
      wb.disp.callRemoteMethods(null, call, GroupRequest.GET_ALL, 0);
  }
  catch(Exception e) {
View Full Code Here

      dispose();
      return;
  }

  try {
    MethodCall call = new MethodCall("displayMessage", new Object[] {sender, retval},
      new String[] {String.class.getName(), String.class.getName()});
      if(command.equals("Send"))
      disp.callRemoteMethod(dest.addr, call, GroupRequest.GET_FIRST, 0);
      else if(command.equals("Send to all"))
      disp.callRemoteMethods(null, call, GroupRequest.GET_ALL, 0);
View Full Code Here

    proxyEventDistributor = (EventDistributor) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class[] {EventDistributor.class}, new InvocationHandler() {
     
      @Override
      public Object invoke(Object proxy, Method method, Object[] args)
          throws Throwable {
        rpcDispatcher.callRemoteMethods(members, new MethodCall(method, args), GroupRequest.GET_NONE, 0);
        return null;
      }
    });
    //wrap the local in a proxy to prevent unintended methods from being called
    rpcDispatcher = new RpcDispatcher(channel, this, this, Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), new Class[] {EventDistributor.class}, new InvocationHandler() {
View Full Code Here

    final TargetClass target=new TargetClass();


    public void testOld() {
        try {
            MethodCall mc=new MethodCall("foo", new Object[]{new Integer(22), "Bela"}, new Class[]{int.class,String.class});
            Assert.assertEquals(mc.invoke(target), Boolean.TRUE);
        }
        catch(Throwable t) {
            assert false : t.toString();
        }
    }
View Full Code Here

    }


    public void testOld2() {
        try {
            MethodCall mc=new MethodCall("bar", new Object[]{new String[]{"one", "two", "three"}, "Bela"},
                                         new Class[]{String[].class, String.class});
            mc.invoke(target);
        }
        catch(Throwable t) {
            assert false : t.toString();
        }
    }
View Full Code Here

TOP

Related Classes of org.jgroups.blocks.MethodCall

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.