public void run() {
List<MessageBatch> batches=new ArrayList<MessageBatch>();
synchronized(oob_map_mcast) {
for(Map.Entry<Address,List<Message>> entry: oob_map_mcast.entrySet()) {
MessageBatch batch=new MessageBatch(null, entry.getKey(), cluster_name, true, entry.getValue()).mode(MessageBatch.Mode.OOB);
batches.add(batch);
}
oob_map_mcast.clear();
}
synchronized(oob_map_ucast) {
for(Map.Entry<Address,List<Message>> entry: oob_map_ucast.entrySet()) {
MessageBatch batch=new MessageBatch(local_addr, entry.getKey(), cluster_name, false, entry.getValue()).mode(MessageBatch.Mode.OOB);
batches.add(batch);
}
oob_map_ucast.clear();
}
synchronized(reg_map_mcast) {
for(Map.Entry<Address,List<Message>> entry: reg_map_mcast.entrySet()) {
MessageBatch batch=new MessageBatch(null, entry.getKey(), cluster_name, true, entry.getValue()).mode(MessageBatch.Mode.REG);
batches.add(batch);
}
reg_map_mcast.clear();
}
synchronized(reg_map_ucast) {
for(Map.Entry<Address,List<Message>> entry: reg_map_ucast.entrySet()) {
MessageBatch batch=new MessageBatch(local_addr, entry.getKey(), cluster_name, false, entry.getValue()).mode(MessageBatch.Mode.REG);
batches.add(batch);
}
reg_map_ucast.clear();
}
for(MessageBatch batch: batches) {
if(!batch.isEmpty()) {
// if(UUID.get(batch.sender()).equals("A"))
// System.out.println("**** sending up batch " + batch + ", hdrs: " + batch.printHeaders());
up_prot.up(batch);
}
}