42 import java.nio.channels.*;
54 class Dispatcher1
implements Dispatcher {
58 Dispatcher1() throws IOException {
59 sel = Selector.open();
67 }
catch (IOException x) {
73 private void dispatch() throws IOException {
75 for (Iterator i = sel.selectedKeys().iterator(); i.hasNext(); ) {
76 SelectionKey sk = (SelectionKey)i.next();
78 Handler h = (Handler)sk.attachment();
83 public void register(SelectableChannel ch,
int ops, Handler h)
85 ch.register(sel, ops, h);