2004-01-07 Michael Koch <konqueror@gmx.de>
+ * gnu/java/nio/DatagramChannelImpl.java
+ (blocking): Removed.
+ (DatagramChannelImpl): Call configureBlocking().
+ (implConfigureBlocking): Dont initialize blocking.
+ * gnu/java/nio/ServerSocketChannelImpl.java
+ (blocking): Removed.
+ (ServerSocketChannelImpl): Call configureBlocking().
+ (implConfigureBlocking): Dont initialize blocking.
+ * gnu/java/nio/SocketChannelImpl.java
+ (blocking): Removed.
+ (SocketChannelImpl): Call configureBlocking().
+ (implConfigureBlocking): Dont initialize blocking.
+ (connect): Use isBlocking().
+ * java/nio/channels/spi/AbstractSelectableChannel.java
+ (configureBlocking): Use blockingLock() instead of LOCK.
+ Set blocking after successfully called implConfigureBlocking().
+ (register): Use blockingLock() instead of LOCK.
+
+2004-01-07 Michael Koch <konqueror@gmx.de>
+
* java/net/ServerSocket.java (isBound): Fixed documentation.
2004-01-07 Sascha Brawer <brawer@dandelis.ch>
public final class DatagramChannelImpl extends DatagramChannel
{
private NIODatagramSocket socket;
- private boolean blocking = true;
protected DatagramChannelImpl (SelectorProvider provider)
throws IOException
{
super (provider);
socket = new NIODatagramSocket (new PlainDatagramSocketImpl(), this);
+ configureBlocking(true);
}
public int getNativeFD()
throws IOException
{
socket.setSoTimeout (blocking ? 0 : NIOConstants.DEFAULT_TIMEOUT);
- this.blocking = blocking;
}
public DatagramChannel connect (SocketAddress remote)
public final class ServerSocketChannelImpl extends ServerSocketChannel
{
private NIOServerSocket serverSocket;
- private boolean blocking = true;
private boolean connected;
protected ServerSocketChannelImpl (SelectorProvider provider)
{
super (provider);
serverSocket = new NIOServerSocket (this);
+ configureBlocking(true);
}
public int getNativeFD()
protected void implConfigureBlocking (boolean blocking) throws IOException
{
serverSocket.setSoTimeout (blocking ? 0 : NIOConstants.DEFAULT_TIMEOUT);
- this.blocking = blocking;
}
public SocketChannel accept () throws IOException
{
private PlainSocketImpl impl;
private NIOSocket socket;
- private boolean blocking = true;
private boolean connectionPending;
SocketChannelImpl (SelectorProvider provider)
super (provider);
impl = new PlainSocketImpl();
socket = new NIOSocket (impl, this);
+ configureBlocking(true);
}
SocketChannelImpl (SelectorProvider provider,
protected void implConfigureBlocking (boolean blocking) throws IOException
{
socket.setSoTimeout (blocking ? 0 : NIOConstants.DEFAULT_TIMEOUT);
- this.blocking = blocking;
}
public boolean connect (SocketAddress remote) throws IOException
if (((InetSocketAddress) remote).isUnresolved())
throw new UnresolvedAddressException();
- if (blocking)
+ if (isBlocking())
{
// Do blocking connect.
socket.connect (remote);
/**
* 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;
SelectionKey key = null;
AbstractSelector selector = (AbstractSelector) selin;
- synchronized (LOCK)
+ synchronized (blockingLock())
{
key = locate (selector);