long start, stop;
int num_expected_msgs=num_threads * num_msgs * buddies;
int num_total_msgs=num_channels * num_threads * num_msgs; // over all channels
for(int i=0; i < channels.length; i++) {
channels[i]=new JChannel(props);
receivers[i]=new Receiver(terminate_barrier, bytes_received, msgs_received, num_expected_msgs, num_total_msgs);
dispatchers[i]=new RpcDispatcher(channels[i], null, null, receivers[i]);
channels[i].connect("x");
}
// start the senders
for(int i=0; i < channels.length; i++) {
JChannel channel=channels[i];
View view=channel.getView();
Vector<Address> members=view.getMembers();
if(members.size() != num_channels) {
throw new Exception("cluster has not formed correctly, expected " + num_channels + " channels, found" +
" only " + members.size() + " (view: " + view + ")");
}
Vector<Address> tmp=pickBuddies(members, channel.getAddress());
for(int j=0; j < num_threads; j++) {
Sender sender=new Sender(start_barrier, msg_size, num_msgs, dispatchers[i], channel.getAddress(), tmp);
sender.start(); // will wait on barrier
}
}
System.out.println("sending " + num_total_msgs + " msgs with " + num_threads + " threads over " + num_channels + " channels");