/[classpath]/classpath/gnu/java/nio/SelectorImpl.java
ViewVC logotype

Diff of /classpath/gnu/java/nio/SelectorImpl.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5 by mkoch, Sat Nov 16 15:48:26 2002 UTC revision 1.6 by mkoch, Mon Nov 18 11:26:03 2002 UTC
# Line 37  exception statement from your version. * Line 37  exception statement from your version. *
37    
38  package gnu.java.nio;  package gnu.java.nio;
39    
40    import java.nio.channels.ClosedSelectorException;
41  import java.nio.channels.SelectableChannel;  import java.nio.channels.SelectableChannel;
42  import java.nio.channels.SelectionKey;  import java.nio.channels.SelectionKey;
43  import java.nio.channels.Selector;  import java.nio.channels.Selector;
# Line 49  import java.util.Set; Line 50  import java.util.Set;
50    
51  public class SelectorImpl extends AbstractSelector  public class SelectorImpl extends AbstractSelector
52  {  {
53      boolean closed = false;
54    Set keys, selected, canceled;    Set keys, selected, canceled;
55    
56    public SelectorImpl (SelectorProvider provider)    public SelectorImpl (SelectorProvider provider)
# Line 65  public class SelectorImpl extends Abstra Line 67  public class SelectorImpl extends Abstra
67    {    {
68      return select (1);      return select (1);
69    }    }
70    
71    public int select ()    public int select ()
72    {    {
73      return select (Long.MAX_VALUE);      return select (Long.MAX_VALUE);
# Line 81  public class SelectorImpl extends Abstra Line 84  public class SelectorImpl extends Abstra
84    
85    public int select (long timeout)    public int select (long timeout)
86    {    {
87        if (closed)
88          {
89            throw new ClosedSelectorException ();
90          }
91    
92      if (keys == null)      if (keys == null)
93              {              {
94          return 0;          return 0;
# Line 102  public class SelectorImpl extends Abstra Line 110  public class SelectorImpl extends Abstra
110              }              }
111    
112      int ret = java_do_select (read, write, except, timeout);      int ret = java_do_select (read, write, except, timeout);
113    
114        i = 0;
115      it = keys.iterator ();      it = keys.iterator ();
116    
117      while (it.hasNext ())      while (it.hasNext ())
# Line 149  public class SelectorImpl extends Abstra Line 159  public class SelectorImpl extends Abstra
159    
160    protected void implCloseSelector ()    protected void implCloseSelector ()
161    {    {
162        closed = true;
163    }    }
164            
165    protected SelectionKey register (SelectableChannel ch, int ops, Object att)    protected SelectionKey register (SelectableChannel ch, int ops, Object att)
# Line 173  public class SelectorImpl extends Abstra Line 184  public class SelectorImpl extends Abstra
184                    
185      if (ch instanceof SocketChannelImpl)      if (ch instanceof SocketChannelImpl)
186              {              {
187          SocketChannelImpl fc = (SocketChannelImpl) ch;          SocketChannelImpl sc = (SocketChannelImpl) ch;
188          SelectionKeyImpl impl = new SelectionKeyImpl (ch, this, fc.fd);          SelectionKeyImpl impl = new SelectionKeyImpl (ch, this, sc.fd);
189          add (impl);          add (impl);
190          return impl;          return impl;
191              }              }
192        else if (ch instanceof ServerSocketChannelImpl)
193          {
194            ServerSocketChannelImpl ssc = (ServerSocketChannelImpl) ch;
195            SelectionKeyImpl impl = new SelectionKeyImpl (ch, this, ssc.fd);
196            add (impl);
197            return impl;
198          }
199      else      else
200              {              {
201          System.err.println ("INTERNAL ERROR, no known channel type");          System.err.println ("INTERNAL ERROR, no known channel type");

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26