List r = new ArrayList();
List w = new ArrayList();
List e = new ArrayList();
for (Iterator i = selector.selectedKeys().iterator(); i.hasNext(); ) {
SelectionKey key = (SelectionKey) i.next();
if ((key.interestOps() & key.readyOps()
& (SelectionKey.OP_READ|SelectionKey.OP_ACCEPT|SelectionKey.OP_CONNECT)) != 0) {
r.add(key.attachment());
pending.remove(key.attachment());
}
if ((key.interestOps() & key.readyOps() & (SelectionKey.OP_WRITE)) != 0) {