Search in sources :

Example 16 with STABLE

use of org.jgroups.protocols.pbcast.STABLE in project JGroups by belaban.

the class RemoteGetStressTest method createChannel.

protected static JChannel createChannel(String name) throws Exception {
    SHARED_LOOPBACK sl = new SHARED_LOOPBACK();
    sl.getThreadPool().setMinThreads(1).setMaxThreads(5);
    Protocol[] protocols = { sl, new SHARED_LOOPBACK_PING(), new NAKACK2(), new UNICAST3(), new STABLE(), new GMS(), new UFC(), new MFC().setMaxCredits(2000000).setMinThreshold(0.4), new FRAG2().setFragSize(8000) };
    return new JChannel(protocols).name(name);
}
Also used : NAKACK2(org.jgroups.protocols.pbcast.NAKACK2) JChannel(org.jgroups.JChannel) STABLE(org.jgroups.protocols.pbcast.STABLE) Protocol(org.jgroups.stack.Protocol) GMS(org.jgroups.protocols.pbcast.GMS)

Example 17 with STABLE

use of org.jgroups.protocols.pbcast.STABLE in project JGroups by belaban.

the class GossipRouterTest method createTunnelChannel.

protected JChannel createTunnelChannel(String name, boolean include_failure_detection) throws Exception {
    TUNNEL tunnel = new TUNNEL().setValue("bind_addr", bind_addr).setValue("reconnect_interval", 1000);
    tunnel.setGossipRouterHosts(gossip_router_hosts);
    List<Protocol> protocols = new ArrayList<>();
    protocols.addAll(Arrays.asList(tunnel, new PING(), new MERGE3().setValue("min_interval", 1000).setValue("max_interval", 3000)));
    if (include_failure_detection) {
        List<Protocol> tmp = new ArrayList<>(2);
        tmp.add(new FD().setValue("timeout", 2000).setValue("max_tries", 2));
        tmp.add(new VERIFY_SUSPECT());
        protocols.addAll(tmp);
    }
    protocols.addAll(Arrays.asList(new NAKACK2().setValue("use_mcast_xmit", false), new UNICAST3(), new STABLE(), new GMS().joinTimeout(10)));
    JChannel ch = new JChannel(protocols);
    if (name != null)
        ch.setName(name);
    return ch;
}
Also used : JChannel(org.jgroups.JChannel) ArrayList(java.util.ArrayList) GMS(org.jgroups.protocols.pbcast.GMS) NAKACK2(org.jgroups.protocols.pbcast.NAKACK2) STABLE(org.jgroups.protocols.pbcast.STABLE) Protocol(org.jgroups.stack.Protocol)

Example 18 with STABLE

use of org.jgroups.protocols.pbcast.STABLE 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 19 with STABLE

use of org.jgroups.protocols.pbcast.STABLE in project JGroups by belaban.

the class OOBTest method testOOBMessageLoss.

/**
 * Tests https://jira.jboss.org/jira/browse/JGRP-1079
 */
public void testOOBMessageLoss() throws Exception {
    // we only need 1 channel
    Util.close(b);
    MyReceiver receiver = new MySleepingReceiver("A", 1000);
    a.setReceiver(receiver);
    final int NUM = 10;
    for (int i = 1; i <= NUM; i++) a.send(new BytesMessage(null, i).setFlag(Message.Flag.OOB));
    STABLE stable = a.getProtocolStack().findProtocol(STABLE.class);
    if (stable != null)
        stable.gc();
    Collection<Integer> msgs = receiver.getMsgs();
    for (int i = 0; i < 20; i++) {
        if (msgs.size() == NUM)
            break;
        Util.sleep(1000);
        sendStableMessages(a, b);
    }
    System.out.println("msgs = " + Util.print(msgs));
    assert msgs.size() == NUM : "expected " + NUM + " messages but got " + msgs.size() + ", msgs=" + Util.print(msgs);
    for (int i = 1; i <= NUM; i++) assert msgs.contains(i);
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) STABLE(org.jgroups.protocols.pbcast.STABLE)

Example 20 with STABLE

use of org.jgroups.protocols.pbcast.STABLE in project JGroups by belaban.

the class OOBTest method setStableGossip.

private static void setStableGossip(JChannel... channels) {
    for (JChannel channel : channels) {
        ProtocolStack stack = channel.getProtocolStack();
        STABLE stable = stack.findProtocol(STABLE.class);
        stable.setDesiredAverageGossip(2000);
    }
}
Also used : ProtocolStack(org.jgroups.stack.ProtocolStack) STABLE(org.jgroups.protocols.pbcast.STABLE)

Aggregations

STABLE (org.jgroups.protocols.pbcast.STABLE)34 NAKACK2 (org.jgroups.protocols.pbcast.NAKACK2)29 GMS (org.jgroups.protocols.pbcast.GMS)27 JChannel (org.jgroups.JChannel)15 Protocol (org.jgroups.stack.Protocol)13 UNICAST3 (org.jgroups.protocols.UNICAST3)6 ArrayList (java.util.ArrayList)4 SHARED_LOOPBACK (org.jgroups.protocols.SHARED_LOOPBACK)3 DISCARD (org.jgroups.protocols.DISCARD)2 SHARED_LOOPBACK_PING (org.jgroups.protocols.SHARED_LOOPBACK_PING)2 TCP (org.jgroups.protocols.TCP)2 BeforeMethod (org.testng.annotations.BeforeMethod)2 Test (org.testng.annotations.Test)2 InetAddress (java.net.InetAddress)1 InetSocketAddress (java.net.InetSocketAddress)1 SecureRandom (java.security.SecureRandom)1 List (java.util.List)1 Properties (java.util.Properties)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1