Commit 26067b8b by Michael Koch Committed by Michael Koch

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
parent 89e4eb2a
2004-01-07 Michael Koch <konqueror@gmx.de> 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. * java/net/ServerSocket.java (isBound): Fixed documentation.
2004-01-07 Sascha Brawer <brawer@dandelis.ch> 2004-01-07 Sascha Brawer <brawer@dandelis.ch>
......
...@@ -56,13 +56,13 @@ import java.nio.channels.spi.SelectorProvider; ...@@ -56,13 +56,13 @@ import java.nio.channels.spi.SelectorProvider;
public final class DatagramChannelImpl extends DatagramChannel public final class DatagramChannelImpl extends DatagramChannel
{ {
private NIODatagramSocket socket; private NIODatagramSocket socket;
private boolean blocking = true;
protected DatagramChannelImpl (SelectorProvider provider) protected DatagramChannelImpl (SelectorProvider provider)
throws IOException throws IOException
{ {
super (provider); super (provider);
socket = new NIODatagramSocket (new PlainDatagramSocketImpl(), this); socket = new NIODatagramSocket (new PlainDatagramSocketImpl(), this);
configureBlocking(true);
} }
public int getNativeFD() public int getNativeFD()
...@@ -85,7 +85,6 @@ public final class DatagramChannelImpl extends DatagramChannel ...@@ -85,7 +85,6 @@ public final class DatagramChannelImpl extends DatagramChannel
throws IOException throws IOException
{ {
socket.setSoTimeout (blocking ? 0 : NIOConstants.DEFAULT_TIMEOUT); socket.setSoTimeout (blocking ? 0 : NIOConstants.DEFAULT_TIMEOUT);
this.blocking = blocking;
} }
public DatagramChannel connect (SocketAddress remote) public DatagramChannel connect (SocketAddress remote)
......
...@@ -55,7 +55,6 @@ import java.nio.channels.spi.SelectorProvider; ...@@ -55,7 +55,6 @@ import java.nio.channels.spi.SelectorProvider;
public final class ServerSocketChannelImpl extends ServerSocketChannel public final class ServerSocketChannelImpl extends ServerSocketChannel
{ {
private NIOServerSocket serverSocket; private NIOServerSocket serverSocket;
private boolean blocking = true;
private boolean connected; private boolean connected;
protected ServerSocketChannelImpl (SelectorProvider provider) protected ServerSocketChannelImpl (SelectorProvider provider)
...@@ -63,6 +62,7 @@ public final class ServerSocketChannelImpl extends ServerSocketChannel ...@@ -63,6 +62,7 @@ public final class ServerSocketChannelImpl extends ServerSocketChannel
{ {
super (provider); super (provider);
serverSocket = new NIOServerSocket (this); serverSocket = new NIOServerSocket (this);
configureBlocking(true);
} }
public int getNativeFD() public int getNativeFD()
...@@ -93,7 +93,6 @@ public final class ServerSocketChannelImpl extends ServerSocketChannel ...@@ -93,7 +93,6 @@ public final class ServerSocketChannelImpl extends ServerSocketChannel
protected void implConfigureBlocking (boolean blocking) throws IOException protected void implConfigureBlocking (boolean blocking) throws IOException
{ {
serverSocket.setSoTimeout (blocking ? 0 : NIOConstants.DEFAULT_TIMEOUT); serverSocket.setSoTimeout (blocking ? 0 : NIOConstants.DEFAULT_TIMEOUT);
this.blocking = blocking;
} }
public SocketChannel accept () throws IOException public SocketChannel accept () throws IOException
......
...@@ -65,7 +65,6 @@ public final class SocketChannelImpl extends SocketChannel ...@@ -65,7 +65,6 @@ public final class SocketChannelImpl extends SocketChannel
{ {
private PlainSocketImpl impl; private PlainSocketImpl impl;
private NIOSocket socket; private NIOSocket socket;
private boolean blocking = true;
private boolean connectionPending; private boolean connectionPending;
SocketChannelImpl (SelectorProvider provider) SocketChannelImpl (SelectorProvider provider)
...@@ -74,6 +73,7 @@ public final class SocketChannelImpl extends SocketChannel ...@@ -74,6 +73,7 @@ public final class SocketChannelImpl extends SocketChannel
super (provider); super (provider);
impl = new PlainSocketImpl(); impl = new PlainSocketImpl();
socket = new NIOSocket (impl, this); socket = new NIOSocket (impl, this);
configureBlocking(true);
} }
SocketChannelImpl (SelectorProvider provider, SocketChannelImpl (SelectorProvider provider,
...@@ -117,7 +117,6 @@ public final class SocketChannelImpl extends SocketChannel ...@@ -117,7 +117,6 @@ public final class SocketChannelImpl extends SocketChannel
protected void implConfigureBlocking (boolean blocking) throws IOException protected void implConfigureBlocking (boolean blocking) throws IOException
{ {
socket.setSoTimeout (blocking ? 0 : NIOConstants.DEFAULT_TIMEOUT); socket.setSoTimeout (blocking ? 0 : NIOConstants.DEFAULT_TIMEOUT);
this.blocking = blocking;
} }
public boolean connect (SocketAddress remote) throws IOException public boolean connect (SocketAddress remote) throws IOException
...@@ -137,7 +136,7 @@ public final class SocketChannelImpl extends SocketChannel ...@@ -137,7 +136,7 @@ public final class SocketChannelImpl extends SocketChannel
if (((InetSocketAddress) remote).isUnresolved()) if (((InetSocketAddress) remote).isUnresolved())
throw new UnresolvedAddressException(); throw new UnresolvedAddressException();
if (blocking) if (isBlocking())
{ {
// Do blocking connect. // Do blocking connect.
socket.connect (remote); socket.connect (remote);
......
...@@ -75,13 +75,13 @@ public abstract class AbstractSelectableChannel extends SelectableChannel ...@@ -75,13 +75,13 @@ public abstract class AbstractSelectableChannel extends SelectableChannel
/** /**
* Adjusts this channel's blocking mode. * Adjusts this channel's blocking mode.
*/ */
public final SelectableChannel configureBlocking (boolean block) public final SelectableChannel configureBlocking (boolean blocking)
throws IOException throws IOException
{ {
synchronized (LOCK) synchronized (blockingLock())
{ {
blocking = true; implConfigureBlocking(blocking);
implConfigureBlocking (block); this.blocking = blocking;
} }
return this; return this;
...@@ -187,7 +187,7 @@ public abstract class AbstractSelectableChannel extends SelectableChannel ...@@ -187,7 +187,7 @@ public abstract class AbstractSelectableChannel extends SelectableChannel
SelectionKey key = null; SelectionKey key = null;
AbstractSelector selector = (AbstractSelector) selin; AbstractSelector selector = (AbstractSelector) selin;
synchronized (LOCK) synchronized (blockingLock())
{ {
key = locate (selector); key = locate (selector);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment