// get an iterator over the set of selected keys
Iterator it = selector.selectedKeys().iterator();
// look at each key in the selected set
- while (it.hasNext()) {
+ while (it.hasNext() && selector!=null) {
SelectionKey key = (SelectionKey) it.next();
// Is a new connection coming in?
if (key.isAcceptable()) {
}
// remove key from selected set, it's been handled
- it.remove();
+ if (selector!=null) it.remove();
}
} catch (java.nio.channels.ClosedSelectorException cse) {
// ignore is normal at shutdown or stop listen socket
try {\r
long start = System.currentTimeMillis();\r
for (int i = 0; i < msgCount; i++) {\r
- int cnt = counter.addAndGet(1);\r
+ int cnt = counter.getAndAdd(1);\r
channel1.send(new Member[] {channel2.getLocalMember(false)}, Data.createRandomData(1024,cnt),Channel.SEND_OPTIONS_UDP);\r
- Thread.currentThread().sleep(10);\r
+ //Thread.currentThread().sleep(10);\r
}\r
System.out.println("Thread["+this.getName()+"] sent "+msgCount+" messages in "+(System.currentTimeMillis()-start)+" ms.");\r
}catch ( Exception x ) {\r