Search in sources :

Example 11 with STABLE

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

the class NAKACK_RetransmitTest method testLargeRetransmission.

/**
 * Sends a number of messages, but discards every other message. The retransmission task in NAKACK2 is initially
 * disabled. Then starts the retransmission task, which should generate an XMIT-REQ which is larger than
 * TP.max_bundle_size, leading to endless retransmissions. With JGRP-1868 resolved, the receiver should get
 * all messages.
 * <p/>
 * https://issues.jboss.org/browse/JGRP-1868
 */
public void testLargeRetransmission() throws Exception {
    a.setReceiver(new MyReceiver());
    b.setReceiver(new MyReceiver());
    c.setReceiver(new MyReceiver());
    Queue<Integer> la = ((NAKACK_RetransmitTest.MyReceiver) a.getReceiver()).getList(), lb = ((NAKACK_RetransmitTest.MyReceiver) b.getReceiver()).getList(), lc = ((NAKACK_RetransmitTest.MyReceiver) c.getReceiver()).getList();
    stopRetransmission(a);
    insertDiscardProtocol(a);
    for (int i = 1; i <= NUM_MSGS; i++) a.send(null, i);
    removeDiscardProtocol(a);
    startRetransmission(a);
    for (int i = 0; i < 10; i++) {
        if (la.size() == NUM_MSGS && lb.size() == NUM_MSGS && lc.size() == NUM_MSGS)
            break;
        STABLE stable = a.getProtocolStack().findProtocol(STABLE.class);
        stable.gc();
        Util.sleep(1000);
    }
    System.out.println("A.size(): " + la.size() + "\nB.size(): " + lb.size() + "\nC.size(): " + lc.size());
    for (Queue<Integer> list : Arrays.asList(la, lb, lc)) {
        int expected = 1;
        for (int num : list) {
            assert expected == num;
            assert num <= NUM_MSGS;
            expected++;
        }
    }
}
Also used : STABLE(org.jgroups.protocols.pbcast.STABLE)

Example 12 with STABLE

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

the class SYM_ENCRYPT_Test method create.

@Override
protected JChannel create(String name, Consumer<List<Protocol>> c) throws Exception {
    // Verify that the SecureRandom instance can be customized
    SecureRandom secureRandom = SecureRandom.getInstance("SHA1PRNG");
    SYM_ENCRYPT encr;
    try {
        encr = new SYM_ENCRYPT().keystoreName("keystore/defaultStore.keystore").alias("myKey").storePassword(DEF_PWD).symAlgorithm(symAlgorithm()).symIvLength(symIvLength()).secureRandom(secureRandom);
    } catch (Throwable t) {
        encr = new SYM_ENCRYPT().keystoreName("defaultStore.keystore").alias("myKey").storePassword(DEF_PWD).symAlgorithm(symAlgorithm()).symIvLength(symIvLength()).secureRandom(secureRandom);
    }
    return new JChannel(new SHARED_LOOPBACK(), new SHARED_LOOPBACK_PING(), // omit MERGE3 from the stack -- nodes are leaving gracefully
    encr, new NAKACK2().useMcastXmit(false), new UNICAST3(), new STABLE(), new GMS().setJoinTimeout(2000)).name(name);
}
Also used : NAKACK2(org.jgroups.protocols.pbcast.NAKACK2) JChannel(org.jgroups.JChannel) SecureRandom(java.security.SecureRandom) STABLE(org.jgroups.protocols.pbcast.STABLE) GMS(org.jgroups.protocols.pbcast.GMS)

Example 13 with STABLE

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

the class ConcurrentStartupTest method create.

protected static JChannel create(Class<? extends TP> tp_cl, Class<? extends Discovery> discovery_cl, String name) throws Exception {
    TP tp = tp_cl.getDeclaredConstructor().newInstance().setBindAddress(Util.getLoopback());
    Protocol[] protocols = { tp, discovery_cl.getDeclaredConstructor().newInstance(), new NAKACK2(), new UNICAST3(), new STABLE(), new GMS().setJoinTimeout(1000).setLeaveTimeout(100) };
    return new JChannel(protocols).name(name);
}
Also used : NAKACK2(org.jgroups.protocols.pbcast.NAKACK2) STABLE(org.jgroups.protocols.pbcast.STABLE) Protocol(org.jgroups.stack.Protocol) GMS(org.jgroups.protocols.pbcast.GMS)

Example 14 with STABLE

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

the class SequencerMergeTest method create.

protected static JChannel create(String name, boolean insert_discard) throws Exception {
    JChannel ch = new JChannel(new SHARED_LOOPBACK(), new DISCARD().discardAll(insert_discard), new PING(), new NAKACK2().useMcastXmit(false).logDiscardMessages(false).logNotFoundMessages(false), new UNICAST3(), new STABLE().setMaxBytes(50000), // below GMS, to establish total order between views and messages
    new SEQUENCER(), new GMS().printLocalAddress(false).setJoinTimeout(100).setLeaveTimeout(100).logViewWarnings(false).setViewAckCollectionTimeout(50).logCollectMessages(false));
    ch.setName(name);
    return ch;
}
Also used : NAKACK2(org.jgroups.protocols.pbcast.NAKACK2) STABLE(org.jgroups.protocols.pbcast.STABLE) GMS(org.jgroups.protocols.pbcast.GMS)

Example 15 with STABLE

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

the class TCPGOSSIP_Test method createTcpgossipChannel.

protected JChannel createTcpgossipChannel(String name) throws Exception {
    TCPGOSSIP gossip = new TCPGOSSIP();
    List<InetSocketAddress> initial_hosts = new ArrayList<>();
    initial_hosts.add(new InetSocketAddress(bind_addr, gossip_router_port));
    gossip.setInitialHosts(initial_hosts);
    JChannel ch = new JChannel(new TCP().setSockConnTimeout(300).setBindAddress(bind_addr), gossip, new MERGE3().setMinInterval(1000).setMaxInterval(3000), new FD_ALL3().setTimeout(5000).setInterval(1500), new VERIFY_SUSPECT(), new NAKACK2().useMcastXmit(false), new UNICAST3(), new STABLE(), new GMS().setJoinTimeout(1000));
    if (name != null)
        ch.setName(name);
    return ch;
}
Also used : JChannel(org.jgroups.JChannel) InetSocketAddress(java.net.InetSocketAddress) ArrayList(java.util.ArrayList) GMS(org.jgroups.protocols.pbcast.GMS) NAKACK2(org.jgroups.protocols.pbcast.NAKACK2) 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