log.error("Timeout receiving from the channel. " + receivedCnt +
System.err.println("Timeout receiving from the channel. " + receivedCnt +
            public void run() {                try {                    while(true) {                        if(channel == null)                            return;                        Object o=channel.receive(10000);                        if(o instanceof Message) {                            receivedCnt++;                            if(receivedCnt % 5000 == 0)                                System.out.println("-- received " + receivedCnt);                            if(receivedCnt == msgCount) {                                // let the main thread know I got all msgs                                promise.setResult(new Object());                                return;                            }                        }                    }                }                catch(TimeoutException e) {                    log.error("Timeout receiving from the channel. " + receivedCnt +                            " msgs received so far.");                }                catch(Exception e) {                    log.error("Error receiving data");                    e.printStackTrace();                }            }