nak.setUpProtocol(new Protocol() {
public Object up(Event evt) {
if(evt.getType() == Event.MSG) {
delivered_msgs.incrementAndGet();
NakAckHeader2 hdr=(NakAckHeader2)((Message)evt.getArg()).getHeader(NAKACK_ID);
if(hdr != null)
delivered_msg_list.add(hdr.getSeqno());
if(delivered_msgs.get() >= num_msgs) {
lock.lock();
try {
all_msgs_delivered.signalAll();
}
finally {
lock.unlock();
}
}
}
return null;
}
public void up(MessageBatch batch) {
for(Message msg: batch) {
delivered_msgs.incrementAndGet();
NakAckHeader2 hdr=(NakAckHeader2)msg.getHeader(NAKACK_ID);
if(hdr != null)
delivered_msg_list.add(hdr.getSeqno());
if(delivered_msgs.get() >= num_msgs) {
lock.lock();
try {
all_msgs_delivered.signalAll();