Search in sources :

Example 6 with UNICAST3

use of org.jgroups.protocols.UNICAST3 in project geode by apache.

the class InterceptUDP method handleMessage.

private void handleMessage(Message msg) {
    if (collectMessages) {
        collectedMessages.add(msg);
    }
    Object o = msg.getHeader(nakackHeaderId);
    if (o != null) {
        mcastSentDataMessages++;
    } else {
        o = msg.getHeader(unicastHeaderId);
        if (o != null) {
            UNICAST3.Header hdr = (UNICAST3.Header) o;
            switch(hdr.type()) {
                case UNICAST3.Header.DATA:
                    unicastSentDataMessages++;
                    Message response = new Message(uuid, msg.getDest(), null);
                    response.putHeader(unicastHeaderId, UNICAST3.Header.createAckHeader(hdr.seqno(), hdr.connId(), System.currentTimeMillis()));
                    up_prot.up(new Event(Event.MSG, response));
                    break;
            }
        }
    }
}
Also used : Message(org.jgroups.Message) Event(org.jgroups.Event) UNICAST3(org.jgroups.protocols.UNICAST3)

Example 7 with UNICAST3

use of org.jgroups.protocols.UNICAST3 in project JGroups by belaban.

the class MergeTest2 method createChannel.

protected JChannel createChannel(String name) throws Exception {
    SHARED_LOOPBACK shared_loopback = new SHARED_LOOPBACK();
    shared_loopback.setDiagnosticsHandler(handler);
    JChannel retval = new JChannel(shared_loopback, new DISCARD().setValue("discard_all", true), new SHARED_LOOPBACK_PING(), new NAKACK2().setValue("use_mcast_xmit", false).setValue("log_discard_msgs", false).setValue("log_not_found_msgs", false), new UNICAST3(), new STABLE().setValue("max_bytes", 50000), new GMS().setValue("print_local_addr", false).setValue("leave_timeout", 100).setValue("merge_timeout", 3000).setValue("log_view_warnings", false).setValue("view_ack_collection_timeout", 50).setValue("log_collect_msgs", false));
    retval.setName(name);
    JmxConfigurator.registerChannel(retval, Util.getMBeanServer(), name, retval.getClusterName(), true);
    retval.connect("MergeTest2");
    return retval;
}
Also used : SHARED_LOOPBACK(org.jgroups.protocols.SHARED_LOOPBACK) NAKACK2(org.jgroups.protocols.pbcast.NAKACK2) DISCARD(org.jgroups.protocols.DISCARD) SHARED_LOOPBACK_PING(org.jgroups.protocols.SHARED_LOOPBACK_PING) STABLE(org.jgroups.protocols.pbcast.STABLE) GMS(org.jgroups.protocols.pbcast.GMS) UNICAST3(org.jgroups.protocols.UNICAST3)

Example 8 with UNICAST3

use of org.jgroups.protocols.UNICAST3 in project JGroups by belaban.

the class RpcDispatcherAsyncInvocationTest method createChannel.

protected static JChannel createChannel(String name) throws Exception {
    SHARED_LOOPBACK sl = new SHARED_LOOPBACK();
    sl.getThreadPool().setMinThreads(10).setMaxThreads(20);
    return new JChannel(sl, new SHARED_LOOPBACK_PING(), new NAKACK2(), new UNICAST3(), new GMS()).name(name);
}
Also used : SHARED_LOOPBACK(org.jgroups.protocols.SHARED_LOOPBACK) NAKACK2(org.jgroups.protocols.pbcast.NAKACK2) JChannel(org.jgroups.JChannel) SHARED_LOOPBACK_PING(org.jgroups.protocols.SHARED_LOOPBACK_PING) GMS(org.jgroups.protocols.pbcast.GMS) UNICAST3(org.jgroups.protocols.UNICAST3)

Example 9 with UNICAST3

use of org.jgroups.protocols.UNICAST3 in project JGroups by belaban.

the class TUNNELDeadLockTest method createTunnelChannel.

protected JChannel createTunnelChannel(String name) throws Exception {
    TUNNEL tunnel = new TUNNEL().setBindAddress(InetAddress.getByName(bind_addr));
    tunnel.setGossipRouterHosts(gossip_router_hosts);
    JChannel ch = new JChannel(tunnel, new PING(), new NAKACK2(), new UNICAST3(), new STABLE(), new GMS().setJoinTimeout(1000)).name(name);
    if (name != null)
        ch.setName(name);
    return ch;
}
Also used : TUNNEL(org.jgroups.protocols.TUNNEL) NAKACK2(org.jgroups.protocols.pbcast.NAKACK2) PING(org.jgroups.protocols.PING) STABLE(org.jgroups.protocols.pbcast.STABLE) GMS(org.jgroups.protocols.pbcast.GMS) UNICAST3(org.jgroups.protocols.UNICAST3)

Example 10 with UNICAST3

use of org.jgroups.protocols.UNICAST3 in project JGroups by belaban.

the class DNSDiscoveryTester method runTestAndCheckIfViewWasReceived.

public boolean runTestAndCheckIfViewWasReceived(String dnsQuery, String recordType) throws Exception {
    List<JChannel> channels = new ArrayList<>();
    CountDownLatch waitForViewToForm = new CountDownLatch(1);
    for (int i = 0; i < numberOfTestedInstances; ++i) {
        DNS_PING ping = new DNS_PING();
        ping.dns_resolver = dnsResolverBuilder.build();
        ping.dns_query = dnsQuery;
        ping.dns_record_type = recordType;
        ping.dns_address = "fake.com";
        Protocol[] protocols = { new TCP().setBindAddress(InetAddress.getLoopbackAddress()).setBindPort(portStart).setPortRange(1), ping, new NAKACK2(), new UNICAST3(), new STABLE(), new GMS().setJoinTimeout(timeout) };
        JChannel c = new JChannel(protocols).name(String.valueOf(i + 1));
        channels.add(c);
        c.setReceiver(new Receiver() {

            @Override
            public void viewAccepted(View view) {
                if (view.getMembers().size() == numberOfTestedInstances) {
                    waitForViewToForm.countDown();
                }
            }
        });
        c.connect("TEST");
    }
    boolean viewReceived = waitForViewToForm.await(timeout, unit);
    channels.forEach(JChannel::close);
    return viewReceived;
}
Also used : TCP(org.jgroups.protocols.TCP) JChannel(org.jgroups.JChannel) ArrayList(java.util.ArrayList) Receiver(org.jgroups.Receiver) CountDownLatch(java.util.concurrent.CountDownLatch) GMS(org.jgroups.protocols.pbcast.GMS) View(org.jgroups.View) UNICAST3(org.jgroups.protocols.UNICAST3) NAKACK2(org.jgroups.protocols.pbcast.NAKACK2) STABLE(org.jgroups.protocols.pbcast.STABLE) Protocol(org.jgroups.stack.Protocol)

Aggregations

UNICAST3 (org.jgroups.protocols.UNICAST3)14 GMS (org.jgroups.protocols.pbcast.GMS)9 NAKACK2 (org.jgroups.protocols.pbcast.NAKACK2)9 SHARED_LOOPBACK (org.jgroups.protocols.SHARED_LOOPBACK)6 STABLE (org.jgroups.protocols.pbcast.STABLE)6 JChannel (org.jgroups.JChannel)4 SHARED_LOOPBACK_PING (org.jgroups.protocols.SHARED_LOOPBACK_PING)4 Message (org.jgroups.Message)3 Protocol (org.jgroups.stack.Protocol)3 ArrayList (java.util.ArrayList)2 Event (org.jgroups.Event)2 DISCARD (org.jgroups.protocols.DISCARD)2 PING (org.jgroups.protocols.PING)2 TCP (org.jgroups.protocols.TCP)2 ByteBuffer (java.nio.ByteBuffer)1 Collection (java.util.Collection)1 ArrayBlockingQueue (java.util.concurrent.ArrayBlockingQueue)1 BlockingQueue (java.util.concurrent.BlockingQueue)1 ConcurrentLinkedQueue (java.util.concurrent.ConcurrentLinkedQueue)1 CountDownLatch (java.util.concurrent.CountDownLatch)1