Пример #1
0
  public void testRegularAndOOBMulticasts() throws Exception {
    DISCARD discard = new DISCARD();
    ProtocolStack stack = c1.getProtocolStack();
    stack.insertProtocol(discard, ProtocolStack.BELOW, NAKACK.class);
    c1.setOpt(Channel.LOCAL, false);

    Address dest = null; // send to all
    Message m1 = new Message(dest, null, 1);
    Message m2 = new Message(dest, null, 2);
    m2.setFlag(Message.OOB);
    Message m3 = new Message(dest, null, 3);

    MyReceiver receiver = new MyReceiver("C2");
    c2.setReceiver(receiver);
    c1.send(m1);
    discard.setDropDownMulticasts(1);
    c1.send(m2);
    c1.send(m3);

    Util.sleep(500);
    Collection<Integer> list = receiver.getMsgs();
    for (int i = 0; i < 10; i++) {
      log.info("list = " + list);
      if (list.size() == 3) break;
      Util.sleep(1000); // give the asynchronous msgs some time to be received
      sendStableMessages(c1, c2);
    }
    assert list.size() == 3 : "list is " + list;
    assert list.contains(1) && list.contains(2) && list.contains(3);
  }
Пример #2
0
 private static void changeProperties(JChannel ch) {
   ch.setOpt(Channel.AUTO_RECONNECT, true);
   ProtocolStack stack = ch.getProtocolStack();
   GMS gms = (GMS) stack.findProtocol("GMS");
   if (gms != null) {
     gms.setViewBundling(true);
     gms.setMaxBundlingTime(300);
     gms.setPrintLocalAddr(false);
   }
   MERGE2 merge = (MERGE2) stack.findProtocol("MERGE2");
   if (merge != null) {
     merge.setMinInterval(2000);
     merge.setMaxInterval(5000);
   }
   VIEW_SYNC sync = (VIEW_SYNC) stack.findProtocol(VIEW_SYNC.class);
   if (sync != null) sync.setAverageSendInterval(5000);
   NAKACK nakack = (NAKACK) stack.findProtocol(NAKACK.class);
   if (nakack != null) nakack.setLogDiscardMsgs(false);
 }