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. From-SVN: r75507
This commit is contained in:
committed by
Michael Koch
parent
89e4eb2a34
commit
26067b8be8
@@ -56,13 +56,13 @@ import java.nio.channels.spi.SelectorProvider;
|
||||
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()
|
||||
@@ -85,7 +85,6 @@ public final class DatagramChannelImpl extends DatagramChannel
|
||||
throws IOException
|
||||
{
|
||||
socket.setSoTimeout (blocking ? 0 : NIOConstants.DEFAULT_TIMEOUT);
|
||||
this.blocking = blocking;
|
||||
}
|
||||
|
||||
public DatagramChannel connect (SocketAddress remote)
|
||||
|
||||
@@ -55,7 +55,6 @@ import java.nio.channels.spi.SelectorProvider;
|
||||
public final class ServerSocketChannelImpl extends ServerSocketChannel
|
||||
{
|
||||
private NIOServerSocket serverSocket;
|
||||
private boolean blocking = true;
|
||||
private boolean connected;
|
||||
|
||||
protected ServerSocketChannelImpl (SelectorProvider provider)
|
||||
@@ -63,6 +62,7 @@ public final class ServerSocketChannelImpl extends ServerSocketChannel
|
||||
{
|
||||
super (provider);
|
||||
serverSocket = new NIOServerSocket (this);
|
||||
configureBlocking(true);
|
||||
}
|
||||
|
||||
public int getNativeFD()
|
||||
@@ -93,7 +93,6 @@ public final class ServerSocketChannelImpl extends ServerSocketChannel
|
||||
protected void implConfigureBlocking (boolean blocking) throws IOException
|
||||
{
|
||||
serverSocket.setSoTimeout (blocking ? 0 : NIOConstants.DEFAULT_TIMEOUT);
|
||||
this.blocking = blocking;
|
||||
}
|
||||
|
||||
public SocketChannel accept () throws IOException
|
||||
|
||||
@@ -65,7 +65,6 @@ public final class SocketChannelImpl extends SocketChannel
|
||||
{
|
||||
private PlainSocketImpl impl;
|
||||
private NIOSocket socket;
|
||||
private boolean blocking = true;
|
||||
private boolean connectionPending;
|
||||
|
||||
SocketChannelImpl (SelectorProvider provider)
|
||||
@@ -74,6 +73,7 @@ public final class SocketChannelImpl extends SocketChannel
|
||||
super (provider);
|
||||
impl = new PlainSocketImpl();
|
||||
socket = new NIOSocket (impl, this);
|
||||
configureBlocking(true);
|
||||
}
|
||||
|
||||
SocketChannelImpl (SelectorProvider provider,
|
||||
@@ -117,7 +117,6 @@ public final class SocketChannelImpl extends SocketChannel
|
||||
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 @@ public final class SocketChannelImpl extends SocketChannel
|
||||
if (((InetSocketAddress) remote).isUnresolved())
|
||||
throw new UnresolvedAddressException();
|
||||
|
||||
if (blocking)
|
||||
if (isBlocking())
|
||||
{
|
||||
// Do blocking connect.
|
||||
socket.connect (remote);
|
||||
|
||||
Reference in New Issue
Block a user