Search in sources :

Example 1 with RpcDispatcher

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

the class RpcDispatcherBlocking method start.

public void start() throws Exception {
    int c;
    RspList rsps;
    // default props
    channel = new JChannel();
    disp = new RpcDispatcher(channel, this).setReceiver(this);
    channel.connect("rpc-test");
    while (true) {
        System.out.println("[x]: exit [s]: send sync group RPC");
        System.out.flush();
        c = System.in.read();
        switch(c) {
            case 'x':
                channel.close();
                disp.stop();
                return;
            case 's':
                rsps = sendGroupRpc();
                System.out.println("responses:\n" + rsps);
                break;
        }
        System.in.skip(System.in.available());
    }
}
Also used : RpcDispatcher(org.jgroups.blocks.RpcDispatcher) RspList(org.jgroups.util.RspList)

Example 2 with RpcDispatcher

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

the class UnicastTestRpc method init.

public void init(String props, final String name, String cluster_name) throws Exception {
    if (cluster_name != null)
        groupname = cluster_name;
    channel = new JChannel(props);
    if (name != null)
        channel.setName(name);
    disp = new RpcDispatcher(channel, this).setMethodLookup(id -> METHODS[id]).setReceiver(this);
    channel.connect(groupname);
    local_addr = channel.getAddress();
    try {
        MBeanServer server = Util.getMBeanServer();
        JmxConfigurator.registerChannel(channel, server, "jgroups", channel.getClusterName(), true);
    } catch (Throwable ex) {
        System.err.println("registering the channel in JMX failed: " + ex);
    }
}
Also used : RpcDispatcher(org.jgroups.blocks.RpcDispatcher) MBeanServer(javax.management.MBeanServer)

Example 3 with RpcDispatcher

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

the class FlowControlUnitTest method setup.

@BeforeMethod
protected void setup() throws Exception {
    a = create("A");
    b = create("B");
    da = new RpcDispatcher(a, this);
    db = new RpcDispatcher(b, this);
    a.connect("FlowControlUnitTest");
    b.connect("FlowControlUnitTest");
    received_msgs.reset();
}
Also used : RpcDispatcher(org.jgroups.blocks.RpcDispatcher) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 4 with RpcDispatcher

use of org.jgroups.blocks.RpcDispatcher in project wildfly by wildfly.

the class ForkChannelTransport method createRpcDispatcher.

@Override
protected RpcDispatcher createRpcDispatcher() {
    RpcDispatcher dispatcher = super.createRpcDispatcher();
    dispatcher.setResponseMarshaller(this);
    return dispatcher;
}
Also used : RpcDispatcher(org.jgroups.blocks.RpcDispatcher)

Example 5 with RpcDispatcher

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

the class QuoteServer method start.

public void start() {
    try {
        channel = new JChannel(props);
        disp = (RpcDispatcher) new RpcDispatcher(channel, this).setMembershipListener(this).setStateListener(this);
        channel.connect(channel_name);
        System.out.println("\nQuote Server started at " + new Date());
        System.out.println("Joined channel '" + channel_name + "' (" + channel.getView().size() + " members)");
        channel.getState(null, 0);
        System.out.println("Ready to serve requests");
    } catch (Exception e) {
        log.error("QuoteServer.start() : " + e);
        System.exit(-1);
    }
}
Also used : RpcDispatcher(org.jgroups.blocks.RpcDispatcher) JChannel(org.jgroups.JChannel)

Aggregations

RpcDispatcher (org.jgroups.blocks.RpcDispatcher)13 MethodCall (org.jgroups.blocks.MethodCall)7 RequestOptions (org.jgroups.blocks.RequestOptions)7 Method (java.lang.reflect.Method)3 MBeanServer (javax.management.MBeanServer)3 Rsp (org.jgroups.util.Rsp)3 RspList (org.jgroups.util.RspList)3 org.jgroups (org.jgroups)2 ResponseMode (org.jgroups.blocks.ResponseMode)2 JmxConfigurator (org.jgroups.jmx.JmxConfigurator)2 BeforeMethod (org.testng.annotations.BeforeMethod)2 IOException (java.io.IOException)1 Field (java.lang.reflect.Field)1 java.util (java.util)1 ArrayList (java.util.ArrayList)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 LongAdder (java.util.concurrent.atomic.LongAdder)1 JChannel (org.jgroups.JChannel)1 Property (org.jgroups.annotations.Property)1