}
return null;
}
});
unicast.down(new Event(Event.SET_LOCAL_ADDRESS, local_addr));
unicast.setMaxMessageBatchSize(max_msg_batch_size);
// send the first message manually, to initialize the AckReceiverWindow tables
Message msg=createMessage(local_addr, sender, 1L, oob, true);
unicast.up(new Event(Event.MSG, msg));
Util.sleep(500);
final CountDownLatch latch=new CountDownLatch(1);
Adder[] adders=new Adder[num_threads];
for(int i=0; i < adders.length; i++) {
adders[i]=new Adder(unicast, latch, counter, seqno, oob, local_addr, sender);
adders[i].start();
}
long start=System.currentTimeMillis();
latch.countDown(); // starts all adders
lock.lock();
try {
while(delivered_msgs.get() < num_msgs) {
try {
all_msgs_delivered.await(1000, TimeUnit.MILLISECONDS);
System.out.println("received " + delivered_msgs.get() + " msgs");
// send a spurious message to trigger removal of pending messages in AckReceiverWindow
msg=createMessage(local_addr, sender, 1L, oob, false);
unicast.up(new Event(Event.MSG, msg));
}
catch(InterruptedException e) {
e.printStackTrace();
}
}