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++;
}
}
}
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);
}
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);
}
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;
}
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;
}
Aggregations