log.error("receiver: " + ex);
System.err.println("receiver: " + ex);
        public void run() {            int num_received=0;            int number;            DatagramPacket packet;            Object obj;            Message msg;            byte[] msg_data=null;            long total_time;            double msgs_per_sec=0;            ByteBuffer rb=ByteBuffer.allocate(16);            rb.mark();            packet=new DatagramPacket(buf, buf.length);            while(num_received <= num_msgs) {                try {                    if(jg) {                        obj=channel.receive(0);                        if(obj instanceof Message) {                            msg=(Message)obj;                            msg_data=msg.getBuffer();                        }                        else {                            System.out.println("received non-msg: " + obj.getClass());                            continue;                        }                    }                    else {                        sock.receive(packet);                        msg_data=packet.getData();                    }                    rb.rewind();                    rb.put(msg_data);                    rb.rewind();                    number=rb.getInt();                    matrix[number][1]=1;                    // System.out.println("#set " + number);                    num_received++;                    if(num_received % 1000 == 0)                        System.out.println("received " + num_received + " packets");                    if(num_received >= num_msgs)                        break;                }                catch(Exception ex) {                    log.error("receiver: " + ex);                }            }            stop=System.currentTimeMillis();            total_time=stop - start;            msgs_per_sec=(num_received / (total_time / 1000.0));            System.out.println("\n** Sending and receiving " + num_received + " took " +                    total_time + " msecs (" + msgs_per_sec + " msgs/sec) **");            System.exit(1);        }