Search in sources :

Example 6 with MethodCall

use of org.jgroups.blocks.MethodCall in project JGroups by belaban.

the class MethodCallTest method testMarshalling.

public static void testMarshalling() throws Exception {
    MethodCall methodCall = new MethodCall("someMethod", new Object[] { "abc" }, new Class[] { String.class });
    System.out.println("methodCall: " + methodCall);
    MethodCall m = marshalAndUnmarshal(methodCall);
    System.out.println("m: " + m);
}
Also used : MethodCall(org.jgroups.blocks.MethodCall)

Example 7 with MethodCall

use of org.jgroups.blocks.MethodCall in project JGroups by belaban.

the class MethodCallTest method testSignature.

public void testSignature() throws Exception {
    MethodCall mc = new MethodCall("foo", new Object[] { 35, "Bela" }, new Class[] { int.class, String.class });
    Assert.assertEquals(mc.invoke(target), Boolean.TRUE);
}
Also used : MethodCall(org.jgroups.blocks.MethodCall)

Example 8 with MethodCall

use of org.jgroups.blocks.MethodCall in project JGroups by belaban.

the class MethodCallTest method testMethod2.

public void testMethod2() throws Exception {
    MethodCall call = new MethodCall(CALL, true, Boolean.FALSE, 322649, 3.24, (float) 54.345, new byte[] { 'b', 'e', 'l', 'a' }, new String[] { "Bela", "Michelle" });
    call.invoke(this);
}
Also used : MethodCall(org.jgroups.blocks.MethodCall)

Example 9 with MethodCall

use of org.jgroups.blocks.MethodCall in project JGroups by belaban.

the class MethodCallTest method testBufferSize.

public static void testBufferSize() throws Exception {
    MethodCall m = new MethodCall("foo", new Object[] { 10, "Bela" }, new Class[] { int.class, String.class });
    byte[] data = Util.objectToByteBuffer(m);
    MethodCall m2 = Util.objectFromByteBuffer(data);
    System.out.println(m2);
    Object[] args = m2.args();
    assert args.length == 2;
    assert args[0].equals(10);
    assert args[1].equals("Bela");
}
Also used : MethodCall(org.jgroups.blocks.MethodCall)

Example 10 with MethodCall

use of org.jgroups.blocks.MethodCall in project JGroups by belaban.

the class GraphPanel method start.

public void start(String name) {
    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, Integer.valueOf(xloc), Integer.valueOf(yloc) }, new Class[] { String.class, Address.class, int.class, int.class });
        wb.disp.callRemoteMethods(null, call, new RequestOptions(ResponseMode.GET_ALL, 0));
    } catch (Exception e) {
        log.error(e.toString());
    }
    repaint();
}
Also used : RequestOptions(org.jgroups.blocks.RequestOptions) MethodCall(org.jgroups.blocks.MethodCall)

Aggregations

MethodCall (org.jgroups.blocks.MethodCall)31 RequestOptions (org.jgroups.blocks.RequestOptions)9 Method (java.lang.reflect.Method)6 Address (org.jgroups.Address)5 RpcDispatcher (org.jgroups.blocks.RpcDispatcher)5 Rsp (org.jgroups.util.Rsp)3 SiteMaster (org.jgroups.protocols.relay.SiteMaster)2 RspList (org.jgroups.util.RspList)2 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 JChannel (org.jgroups.JChannel)1 AdditionalJmxObjects (org.jgroups.jmx.AdditionalJmxObjects)1 RELAY2 (org.jgroups.protocols.relay.RELAY2)1 Route (org.jgroups.protocols.relay.Route)1 Protocol (org.jgroups.stack.Protocol)1 Average (org.jgroups.util.Average)1 AfterMethod (org.testng.annotations.AfterMethod)1 BeforeMethod (org.testng.annotations.BeforeMethod)1 Test (org.testng.annotations.Test)1