Example #1
0
 private static void setStableGossip(JChannel... channels) {
   for (Channel channel : channels) {
     ProtocolStack stack = channel.getProtocolStack();
     STABLE stable = (STABLE) stack.findProtocol(STABLE.class);
     stable.setDesiredAverageGossip(2000);
   }
 }
Example #2
0
  /** Tests https://jira.jboss.org/jira/browse/JGRP-1079 */
  public void testOOBMessageLoss() throws Exception {
    Util.close(b); // we only need 1 channel
    MyReceiver receiver = new MySleepingReceiver("C1", 1000);
    a.setReceiver(receiver);

    TP transport = a.getProtocolStack().getTransport();
    transport.setOOBRejectionPolicy("discard");

    final int NUM = 10;

    for (int i = 1; i <= NUM; i++) {
      Message msg = new Message(null, null, i);
      msg.setFlag(Message.OOB);
      a.send(msg);
    }
    STABLE stable = (STABLE) a.getProtocolStack().findProtocol(STABLE.class);
    if (stable != null) stable.runMessageGarbageCollection();
    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);
    }
  }
Example #3
0
 private static void sendStableMessages(JChannel... channels) {
   for (JChannel ch : channels) {
     STABLE stable = (STABLE) ch.getProtocolStack().findProtocol(STABLE.class);
     if (stable != null) stable.runMessageGarbageCollection();
     UNICAST2 uni = (UNICAST2) ch.getProtocolStack().findProtocol(UNICAST2.class);
     if (uni != null) uni.sendStableMessages();
   }
 }