1 |
/* SelectorImpl.java -- |
/* SelectorImpl.java -- |
2 |
Copyright (C) 2002, 2003 Free Software Foundation, Inc. |
Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. |
3 |
|
|
4 |
This file is part of GNU Classpath. |
This file is part of GNU Classpath. |
5 |
|
|
35 |
obligated to do so. If you do not wish to do so, delete this |
obligated to do so. If you do not wish to do so, delete this |
36 |
exception statement from your version. */ |
exception statement from your version. */ |
37 |
|
|
38 |
|
|
39 |
package gnu.java.nio; |
package gnu.java.nio; |
40 |
|
|
41 |
|
import gnu.classpath.Configuration; |
42 |
|
|
43 |
import java.io.IOException; |
import java.io.IOException; |
44 |
import java.nio.channels.ClosedSelectorException; |
import java.nio.channels.ClosedSelectorException; |
45 |
import java.nio.channels.SelectableChannel; |
import java.nio.channels.SelectableChannel; |
52 |
import java.util.HashSet; |
import java.util.HashSet; |
53 |
import java.util.Iterator; |
import java.util.Iterator; |
54 |
import java.util.Set; |
import java.util.Set; |
|
import gnu.classpath.Configuration; |
|
55 |
|
|
56 |
public class SelectorImpl extends AbstractSelector |
public class SelectorImpl extends AbstractSelector |
57 |
{ |
{ |
|
|
|
58 |
private Set keys; |
private Set keys; |
59 |
private Set selected; |
private Set selected; |
60 |
|
|
376 |
SelectionKeyImpl result; |
SelectionKeyImpl result; |
377 |
|
|
378 |
if (ch instanceof SocketChannelImpl) |
if (ch instanceof SocketChannelImpl) |
379 |
{ |
result = new SocketChannelSelectionKey (ch, this); |
|
SocketChannelImpl sc = (SocketChannelImpl) ch; |
|
|
result = new SocketChannelSelectionKey (ch, this); |
|
|
} |
|
380 |
else if (ch instanceof DatagramChannelImpl) |
else if (ch instanceof DatagramChannelImpl) |
381 |
{ |
result = new DatagramChannelSelectionKey (ch, this); |
|
DatagramChannelImpl dc = (DatagramChannelImpl) ch; |
|
|
result = new DatagramChannelSelectionKey (ch, this); |
|
|
} |
|
382 |
else if (ch instanceof ServerSocketChannelImpl) |
else if (ch instanceof ServerSocketChannelImpl) |
383 |
{ |
result = new ServerSocketChannelSelectionKey (ch, this); |
|
ServerSocketChannelImpl ssc = (ServerSocketChannelImpl) ch; |
|
|
result = new ServerSocketChannelSelectionKey (ch, this); |
|
|
} |
|
384 |
else |
else |
385 |
{ |
throw new InternalError ("No known channel type"); |
|
throw new InternalError ("No known channel type"); |
|
|
} |
|
386 |
|
|
387 |
synchronized (keys) |
synchronized (keys) |
388 |
{ |
{ |