2004-02-26 Michael Koch <konqueror@gmx.de>

* gnu/java/nio/FileLockImpl.java
	(finalize): Made protected.
	* java/nio/channels/FileChannel.java
	(MapMode.READ_ONLY): Made final.
	(MapMode.READ_WRITE): Made final.
	(MapMode.PRIVATE): Made final.
	* java/nio/channels/SocketChannel.java
	(open): Simplified code.
	* java/nio/channels/spi/AbstractSelectableChannel.java
	(registered): Unused, removed.
	(keyFor): Check channel is open, only locate key
	and not add a new one.
	(register): Don't delete attachments.

From-SVN: r78519
This commit is contained in:
Michael Koch 2004-02-26 19:45:51 +00:00 committed by Michael Koch
parent 135d78c600
commit f57db409bc
5 changed files with 30 additions and 12 deletions

View File

@ -1,3 +1,19 @@
2004-02-26 Michael Koch <konqueror@gmx.de>
* gnu/java/nio/FileLockImpl.java
(finalize): Made protected.
* java/nio/channels/FileChannel.java
(MapMode.READ_ONLY): Made final.
(MapMode.READ_WRITE): Made final.
(MapMode.PRIVATE): Made final.
* java/nio/channels/SocketChannel.java
(open): Simplified code.
* java/nio/channels/spi/AbstractSelectableChannel.java
(registered): Unused, removed.
(keyFor): Check channel is open, only locate key
and not add a new one.
(register): Don't delete attachments.
2004-02-26 Michael Koch <konqueror@gmx.de>
* gnu/java/awt/ComponentDataBlitOp.java

View File

@ -68,7 +68,7 @@ public class FileLockImpl extends FileLock
this.fd = fd;
}
public void finalize()
protected void finalize()
{
try
{

View File

@ -53,9 +53,9 @@ public abstract class FileChannel extends AbstractInterruptibleChannel
{
int m;
public static MapMode READ_ONLY = new MapMode(0);
public static MapMode READ_WRITE = new MapMode(1);
public static MapMode PRIVATE = new MapMode(2);
public static final MapMode READ_ONLY = new MapMode(0);
public static final MapMode READ_WRITE = new MapMode(1);
public static final MapMode PRIVATE = new MapMode(2);
/**
* Initializes the MapMode.

View File

@ -87,11 +87,7 @@ abstract public class SocketChannel extends AbstractSelectableChannel
public static SocketChannel open (SocketAddress remote) throws IOException
{
SocketChannel ch = open ();
if (ch.connect (remote))
{
}
ch.connect(remote);
return ch;
}

View File

@ -48,7 +48,6 @@ import java.util.ListIterator;
public abstract class AbstractSelectableChannel extends SelectableChannel
{
private int registered;
private boolean blocking = true;
private Object LOCK = new Object();
private SelectorProvider provider;
@ -135,9 +134,15 @@ public abstract class AbstractSelectableChannel extends SelectableChannel
*/
public final SelectionKey keyFor(Selector selector)
{
if (! isOpen())
return null;
try
{
return register (selector, 0, null);
synchronized(blockingLock())
{
return locate (selector);
}
}
catch (Exception e)
{
@ -196,7 +201,8 @@ public abstract class AbstractSelectableChannel extends SelectableChannel
if (key != null)
{
key.attach (att);
if (att != null)
key.attach (att);
}
else
{