Index: gnu/java/nio/DatagramChannelImpl.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/nio/DatagramChannelImpl.java,v retrieving revision 1.9 diff -u -b -B -r1.9 DatagramChannelImpl.java --- gnu/java/nio/DatagramChannelImpl.java 26 Nov 2003 20:47:06 -0000 1.9 +++ gnu/java/nio/DatagramChannelImpl.java 8 Jan 2004 08:38:55 -0000 @@ -56,13 +56,13 @@ public final class DatagramChannelImpl extends DatagramChannel { private NIODatagramSocket socket; - private boolean blocking = false; protected DatagramChannelImpl (SelectorProvider provider) throws IOException { super (provider); socket = new NIODatagramSocket (new PlainDatagramSocketImpl(), this); + configureBlocking(true); } public int getNativeFD() @@ -85,7 +85,6 @@ throws IOException { socket.setSoTimeout (blocking ? 0 : NIOConstants.DEFAULT_TIMEOUT); - this.blocking = blocking; } public DatagramChannel connect (SocketAddress remote) Index: gnu/java/nio/PipeImpl.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/nio/PipeImpl.java,v retrieving revision 1.5 diff -u -b -B -r1.5 PipeImpl.java --- gnu/java/nio/PipeImpl.java 20 Oct 2003 15:41:47 -0000 1.5 +++ gnu/java/nio/PipeImpl.java 8 Jan 2004 08:38:55 -0000 @@ -38,24 +38,126 @@ package gnu.java.nio; import java.io.IOException; +import java.nio.ByteBuffer; import java.nio.channels.Pipe; import java.nio.channels.spi.SelectorProvider; class PipeImpl extends Pipe { + public final class SourceChannelImpl extends Pipe.SourceChannel + { + private int native_fd; + + public SourceChannelImpl (SelectorProvider selectorProvider, + int native_fd) + { + super (selectorProvider); + this.native_fd = native_fd; + } + + protected final void implCloseSelectableChannel() + throws IOException + { + throw new Error ("Not implemented"); + } + + protected void implConfigureBlocking (boolean blocking) + throws IOException + { + throw new Error ("Not implemented"); + } + + public final int read (ByteBuffer src) + throws IOException + { + throw new Error ("Not implemented"); + } + + public final long read (ByteBuffer[] srcs) + throws IOException + { + return read (srcs, 0, srcs.length); + } + + public final long read (ByteBuffer[] srcs, int offset, int len) + throws IOException + { + throw new Error ("Not implemented"); + } + + public final int getNativeFD() + { + return native_fd; + } + } + + public final class SinkChannelImpl extends Pipe.SinkChannel + { + private int native_fd; + + public SinkChannelImpl (SelectorProvider selectorProvider, + int native_fd) + { + super (selectorProvider); + this.native_fd = native_fd; + } + + protected final void implCloseSelectableChannel() + throws IOException + { + throw new Error ("Not implemented"); + } + + protected final void implConfigureBlocking (boolean blocking) + throws IOException + { + throw new Error ("Not implemented"); + } + + public final int write (ByteBuffer dst) + throws IOException + { + throw new Error ("Not implemented"); + } + + public final long write (ByteBuffer[] dsts) + throws IOException + { + return write (dsts, 0, dsts.length); + } + + public final long write (ByteBuffer[] dsts, int offset, int len) + throws IOException + { + throw new Error ("Not implemented"); + } + + public final int getNativeFD() + { + return native_fd; + } + } + + private SinkChannelImpl sink; + private SourceChannelImpl source; + public PipeImpl (SelectorProvider provider) throws IOException { super(); + nativeInit (provider); } + private native void nativeInit (SelectorProvider provider) + throws IOException; + public Pipe.SinkChannel sink() { - return null; + return sink; } public Pipe.SourceChannel source() { - return null; + return source; } } Index: gnu/java/nio/ServerSocketChannelImpl.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/nio/ServerSocketChannelImpl.java,v retrieving revision 1.9 diff -u -b -B -r1.9 ServerSocketChannelImpl.java --- gnu/java/nio/ServerSocketChannelImpl.java 15 Oct 2003 12:51:31 -0000 1.9 +++ gnu/java/nio/ServerSocketChannelImpl.java 8 Jan 2004 08:38:55 -0000 @@ -54,15 +54,15 @@ public final class ServerSocketChannelImpl extends ServerSocketChannel { - NIOServerSocket serverSocket; - boolean blocking = true; - boolean connected = false; + private NIOServerSocket serverSocket; + private boolean connected; protected ServerSocketChannelImpl (SelectorProvider provider) throws IOException { super (provider); serverSocket = new NIOServerSocket (this); + configureBlocking(true); } public int getNativeFD() @@ -93,7 +93,6 @@ protected void implConfigureBlocking (boolean blocking) throws IOException { serverSocket.setSoTimeout (blocking ? 0 : NIOConstants.DEFAULT_TIMEOUT); - this.blocking = blocking; } public SocketChannel accept () throws IOException Index: gnu/java/nio/SocketChannelImpl.java =================================================================== RCS file: /cvsroot/classpath/classpath/gnu/java/nio/SocketChannelImpl.java,v retrieving revision 1.20 diff -u -b -B -r1.20 SocketChannelImpl.java --- gnu/java/nio/SocketChannelImpl.java 26 Nov 2003 20:47:06 -0000 1.20 +++ gnu/java/nio/SocketChannelImpl.java 8 Jan 2004 08:38:55 -0000 @@ -65,8 +65,7 @@ { private PlainSocketImpl impl; private NIOSocket socket; - private boolean blocking = true; - private boolean connectionPending = false; + private boolean connectionPending; SocketChannelImpl (SelectorProvider provider) throws IOException @@ -74,6 +73,7 @@ super (provider); impl = new PlainSocketImpl(); socket = new NIOSocket (impl, this); + configureBlocking(true); } SocketChannelImpl (SelectorProvider provider, @@ -117,7 +117,6 @@ protected void implConfigureBlocking (boolean blocking) throws IOException { socket.setSoTimeout (blocking ? 0 : NIOConstants.DEFAULT_TIMEOUT); - this.blocking = blocking; } public boolean connect (SocketAddress remote) throws IOException @@ -137,7 +136,7 @@ if (((InetSocketAddress) remote).isUnresolved()) throw new UnresolvedAddressException(); - if (blocking) + if (isBlocking()) { // Do blocking connect. socket.connect (remote); @@ -301,8 +300,6 @@ data = src.array(); } - System.out.println ("INTERNAL: writing to socket outputstream"); - OutputStream output = socket.getOutputStream(); output.write (data, offset, len); Index: java/nio/channels/spi/AbstractSelectableChannel.java =================================================================== RCS file: /cvsroot/classpath/classpath/java/nio/channels/spi/AbstractSelectableChannel.java,v retrieving revision 1.10 diff -u -b -B -r1.10 AbstractSelectableChannel.java --- java/nio/channels/spi/AbstractSelectableChannel.java 12 Oct 2003 16:56:00 -0000 1.10 +++ java/nio/channels/spi/AbstractSelectableChannel.java 8 Jan 2004 08:38:55 -0000 @@ -75,13 +75,13 @@ /** * Adjusts this channel's blocking mode. */ - public final SelectableChannel configureBlocking (boolean block) + public final SelectableChannel configureBlocking (boolean blocking) throws IOException { - synchronized (LOCK) + synchronized (blockingLock()) { - blocking = true; - implConfigureBlocking (block); + implConfigureBlocking(blocking); + this.blocking = blocking; } return this; @@ -187,7 +187,7 @@ SelectionKey key = null; AbstractSelector selector = (AbstractSelector) selin; - synchronized (LOCK) + synchronized (blockingLock()) { key = locate (selector);