Package org.jgroups.blocks

Examples of org.jgroups.blocks.MethodCall


        }
    }

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


        }
    }

    public void testWithNull() {
        try {
            MethodCall mc=new MethodCall("foobar", null, (Class[])null);
            System.out.println("mc: " + mc);
            mc.invoke(this);
        }
        catch(Throwable t) {
            fail(t.toString());
        }
    }
View Full Code Here

        }
    }

    public void testOldWithNull() {
        try {
            MethodCall mc=new MethodCall("bar", new Object[]{new String[]{"one", "two", "three"}, null});
            mc.invoke(this);
        }
        catch(Throwable t) {
            fail(t.toString());
        }
    }
View Full Code Here

        }
    }

    public void testOldWithNull2() {
        try {
            MethodCall mc=new MethodCall("bar", new Object[]{null, "Bela"});
            mc.invoke(this);
        }
        catch(Throwable t) {
            fail(t.toString());
        }
    }
View Full Code Here

        }
    }

    public void testOldWithNull3() {
        try {
            MethodCall mc=new MethodCall("foobar", null);
            mc.invoke(this);
        }
        catch(Throwable t) {
            fail(t.toString());
        }
    }
View Full Code Here

        }
    }

    public void testOldWithNull4() {
        try {
            MethodCall mc=new MethodCall("foobar", new Object[0]);
            mc.invoke(this);
        }
        catch(Throwable t) {
            fail(t.toString());
        }
    }
View Full Code Here

    public void testMethod() {
        Method m;
        try {
            m=cl.getMethod("foo", new Class[]{int.class, String.class});
            MethodCall mc=new MethodCall(m, new Object[]{new Integer(22), "Bela"});
            assertEquals(mc.invoke(this), Boolean.TRUE);
        }
        catch(Throwable t) {
            fail(t.toString());
        }
    }
View Full Code Here

            fail(t.toString());
        }
    }

    public void testTypes() {
        MethodCall mc;
        mc=new MethodCall("foo", new Object[]{new Integer(35), "Bela"}, new Class[]{int.class, String.class});
        try {
            assertEquals(mc.invoke(this), Boolean.TRUE);
        }
        catch(Throwable t) {
            fail(t.toString());
        }
    }
View Full Code Here

        }
    }


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

    void invokeRpcs(int num, int mode) throws Exception {
        long    start, stop;
        int     show=num/10;
        Method measure_method=getClass().getMethod("measure", EMPTY_CLASS_ARRAY);
        MethodCall measure_method_call=new MethodCall(measure_method, EMPTY_OBJECT_ARRAY);

        if(show <=0) show=1;
        start=System.currentTimeMillis();
        switch(mode) {
        case OLD:
            System.out.println("-- invoking " + num + " methods using mode=OLD");
            for(int i=1; i <= num; i++) {
                disp.callRemoteMethods(null,
                                       "measure",
                                       EMPTY_OBJECT_ARRAY,
                                       EMPTY_CLASS_ARRAY,
                                       GroupRequest.GET_ALL, TIMEOUT);
                if(i % show == 0)
                    System.out.println(i);
            }
            break;

        case METHOD:
            System.out.println("-- invoking " + num + " methods using mode=METHOD");
            for(int i=1; i <= num; i++) {
                disp.callRemoteMethods(null, measure_method_call, GroupRequest.GET_ALL, TIMEOUT);
                if(i % show == 0)
                    System.out.println(i);
            }
            break;

        case TYPES:
            System.out.println("-- invoking " + num + " methods using mode=TYPES");
            for(int i=1; i <= num; i++) {
                disp.callRemoteMethods(null, "measure",
                                       EMPTY_OBJECT_ARRAY,
                                       EMPTY_CLASS_ARRAY,
                                       GroupRequest.GET_ALL,
                                       TIMEOUT);
                if(i % show == 0)
                    System.out.println(i);
            }
            break;

        case SIGNATURE:
            System.out.println("-- invoking " + num + " methods using mode=SIGNATURE");
            for(int i=1; i <= num; i++) {
                disp.callRemoteMethods(null, "measure",
                                       EMPTY_OBJECT_ARRAY,
                                       EMPTY_STRING_ARRAY,
                                       GroupRequest.GET_ALL,
                                       TIMEOUT);
                if(i % show == 0)
                    System.out.println(i);
            }
            break;
        case ID:
            System.out.println("-- invoking " + num + " methods using mode=ID");
            measure_method_call=new MethodCall((short)0, null);
            for(int i=1; i <= num; i++) {
                disp.callRemoteMethods(null, measure_method_call, GroupRequest.GET_ALL, TIMEOUT);
                if(i % show == 0)
                    System.out.println(i);
            }
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.