This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: FYI: Patch: java.nio implementation
- From: Michael Koch <konqueror at gmx dot de>
- To: java-patches at gcc dot gnu dot org
- Date: Fri, 26 Sep 2003 17:04:00 +0200
- Subject: Re: FYI: Patch: java.nio implementation
- References: <200309252316.53946.konqueror@gmx.de>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Am Donnerstag, 25. September 2003 23:16 schrieb Michael Koch:
> I commited the attached patch to trunk to make java.nio more
> working. DatagramSocketChannels and SocketChannels should be usable
> in non-blocking mode now.
And here the (broken) patch I forgot to attach.
Michael
- --
Homepage: http://www.worldforge.org/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)
iD8DBQE/dFVkWSOgCCdjSDsRApJsAJ9/u4JAxzmkudUEnOdGyD2fgnPCxQCfUJp6
GiTZFf9l0XdwwTBTpOCaDdk=
=crHL
-----END PGP SIGNATURE-----
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/libjava/ChangeLog,v
retrieving revision 1.2189
diff -u -b -B -r1.2189 ChangeLog
--- ChangeLog 25 Sep 2003 20:46:13 -0000 1.2189
+++ ChangeLog 25 Sep 2003 21:09:57 -0000
@@ -1,5 +1,24 @@
2003-09-25 Michael Koch <konqueror@gmx.de>
+ * gnu/java/nio/DatagramChannelImpl.java
+ (getNativeFD): New method.
+ * gnu/java/nio/SelectionKeyImpl.java
+ (SelectionKeyImpl): Class made abstract.
+ (fd): Removed.
+ (SelectionKeyImpl): Remove fd argument.
+ (getNativeFD): New method.
+ * gnu/java/nio/SocketChannelImpl.java
+ (getNativeFD): New method.
+ gnu/java/nio/DatagramChannelSelectionKey.java,
+ * gnu/java/nio/SocketChannelSelectionKey.java:
+ New files.
+ * Makefile.am (ordinary_java_source_files):
+ Added new files gnu/java/nio/DatagramChannelSelectionKey.java and
+ gnu/java/nio/SocketChannelSelectionKey.java.
+ * Makefile.in: Regenerated.
+
+2003-09-25 Michael Koch <konqueror@gmx.de>
+
* java/lang/reflect/Proxy.java
(getProxyClass): Remove workaround for gcj 3.0.x.
Index: Makefile.am
===================================================================
RCS file: /cvs/gcc/gcc/libjava/Makefile.am,v
retrieving revision 1.327
diff -u -b -B -r1.327 Makefile.am
--- Makefile.am 25 Sep 2003 10:16:56 -0000 1.327
+++ Makefile.am 25 Sep 2003 21:09:57 -0000
@@ -2183,6 +2183,7 @@
gnu/java/net/PlainDatagramSocketImpl.java \
gnu/java/net/PlainSocketImpl.java \
gnu/java/nio/DatagramChannelImpl.java \
+gnu/java/nio/DatagramChannelSelectionKey.java \
gnu/java/nio/FileLockImpl.java \
gnu/java/nio/NIOConstants.java \
gnu/java/nio/NIODatagramSocket.java \
@@ -2193,6 +2194,7 @@
gnu/java/nio/SelectorProviderImpl.java \
gnu/java/nio/ServerSocketChannelImpl.java \
gnu/java/nio/SocketChannelImpl.java \
+gnu/java/nio/SocketChannelSelectionKey.java \
gnu/java/nio/charset/ISO_8859_1.java \
gnu/java/nio/charset/Provider.java \
gnu/java/nio/charset/US_ASCII.java \
Index: Makefile.in
===================================================================
RCS file: /cvs/gcc/gcc/libjava/Makefile.in,v
retrieving revision 1.351
diff -u -b -B -r1.351 Makefile.in
--- Makefile.in 25 Sep 2003 10:16:56 -0000 1.351
+++ Makefile.in 25 Sep 2003 21:10:03 -0000
@@ -1901,6 +1901,7 @@
gnu/java/net/PlainDatagramSocketImpl.java \
gnu/java/net/PlainSocketImpl.java \
gnu/java/nio/DatagramChannelImpl.java \
+gnu/java/nio/DatagramChannelSelectionKey.java \
gnu/java/nio/FileLockImpl.java \
gnu/java/nio/NIOConstants.java \
gnu/java/nio/NIODatagramSocket.java \
@@ -1911,6 +1912,7 @@
gnu/java/nio/SelectorProviderImpl.java \
gnu/java/nio/ServerSocketChannelImpl.java \
gnu/java/nio/SocketChannelImpl.java \
+gnu/java/nio/SocketChannelSelectionKey.java \
gnu/java/nio/charset/ISO_8859_1.java \
gnu/java/nio/charset/Provider.java \
gnu/java/nio/charset/US_ASCII.java \
@@ -3026,6 +3028,7 @@
.deps/gnu/java/net/natPlainDatagramSocketImpl.P \
.deps/gnu/java/net/natPlainSocketImpl.P \
.deps/gnu/java/nio/DatagramChannelImpl.P \
+.deps/gnu/java/nio/DatagramChannelSelectionKey.P \
.deps/gnu/java/nio/FileLockImpl.P .deps/gnu/java/nio/NIOConstants.P \
.deps/gnu/java/nio/NIODatagramSocket.P .deps/gnu/java/nio/NIOSocket.P \
.deps/gnu/java/nio/PipeImpl.P .deps/gnu/java/nio/SelectionKeyImpl.P \
@@ -3033,6 +3036,7 @@
.deps/gnu/java/nio/SelectorProviderImpl.P \
.deps/gnu/java/nio/ServerSocketChannelImpl.P \
.deps/gnu/java/nio/SocketChannelImpl.P \
+.deps/gnu/java/nio/SocketChannelSelectionKey.P \
.deps/gnu/java/nio/charset/ISO_8859_1.P \
.deps/gnu/java/nio/charset/Provider.P \
.deps/gnu/java/nio/charset/US_ASCII.P \
Index: gnu/java/nio/DatagramChannelImpl.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/java/nio/DatagramChannelImpl.java,v
retrieving revision 1.4
diff -u -b -B -r1.4 DatagramChannelImpl.java
--- gnu/java/nio/DatagramChannelImpl.java 25 Sep 2003 10:16:59 -0000 1.4
+++ gnu/java/nio/DatagramChannelImpl.java 25 Sep 2003 21:10:03 -0000
@@ -64,6 +64,11 @@
super (provider);
socket = new NIODatagramSocket (new PlainDatagramSocketImpl(), this);
}
+
+ public int getNativeFD()
+ {
+ return socket.getImpl().getNativeFD();
+ }
public DatagramSocket socket ()
{
Index: gnu/java/nio/SelectionKeyImpl.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/java/nio/SelectionKeyImpl.java,v
retrieving revision 1.4
diff -u -b -B -r1.4 SelectionKeyImpl.java
--- gnu/java/nio/SelectionKeyImpl.java 25 Sep 2003 10:16:59 -0000 1.4
+++ gnu/java/nio/SelectionKeyImpl.java 25 Sep 2003 21:10:03 -0000
@@ -43,19 +43,17 @@
import java.nio.channels.Selector;
import java.nio.channels.spi.AbstractSelectionKey;
-public class SelectionKeyImpl extends AbstractSelectionKey
+public abstract class SelectionKeyImpl extends AbstractSelectionKey
{
- int fd;
private int readyOps;
private int interestOps;
private SelectorImpl impl;
private SelectableChannel ch;
- public SelectionKeyImpl (SelectableChannel ch, SelectorImpl impl, int fd)
+ public SelectionKeyImpl (SelectableChannel ch, SelectorImpl impl)
{
this.ch = ch;
this.impl = impl;
- this.fd = fd;
}
public SelectableChannel channel ()
@@ -101,4 +99,6 @@
{
return impl;
}
+
+ public abstract int getNativeFD();
}
Index: gnu/java/nio/SocketChannelImpl.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/java/nio/SocketChannelImpl.java,v
retrieving revision 1.8
diff -u -b -B -r1.8 SocketChannelImpl.java
--- gnu/java/nio/SocketChannelImpl.java 25 Sep 2003 10:16:59 -0000 1.8
+++ gnu/java/nio/SocketChannelImpl.java 25 Sep 2003 21:10:03 -0000
@@ -98,6 +98,11 @@
}
}
+ int getNativeFD()
+ {
+ return socket.getImpl().getNativeFD();
+ }
+
protected void implCloseSelectableChannel () throws IOException
{
connected = false;
Index: gnu/java/nio/DatagramChannelSelectionKey.java
===================================================================
RCS file: gnu/java/nio/DatagramChannelSelectionKey.java
diff -N gnu/java/nio/DatagramChannelSelectionKey.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/java/nio/DatagramChannelSelectionKey.java 25 Sep 2003 21:10:03 -0000
@@ -0,0 +1,59 @@
+/* DatagramChannelSelectionKey.java --
+ Copyright (C) 2003 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.java.nio;
+
+import java.nio.channels.spi.AbstractSelectableChannel;
+
+/**
+ * @author Michael Koch
+ */
+public final class DatagramChannelSelectionKey
+ extends SelectionKeyImpl
+{
+ public DatagramChannelSelectionKey (AbstractSelectableChannel channel,
+ SelectorImpl selector)
+ {
+ super (channel, selector);
+ }
+
+ public int getNativeFD()
+ {
+ return ((DatagramChannelImpl) ch).getNativeFD();
+ }
+}
Index: gnu/java/nio/SocketChannelSelectionKey.java
===================================================================
RCS file: gnu/java/nio/SocketChannelSelectionKey.java
diff -N gnu/java/nio/SocketChannelSelectionKey.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/java/nio/SocketChannelSelectionKey.java 25 Sep 2003 21:10:03 -0000
@@ -0,0 +1,56 @@
+/* SocketChannelSelectionKey.java --
+ Copyright (C) 2003 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.java.nio;
+
+import java.nio.channels.spi.AbstractSelectableChannel;
+
+public final class SocketChannelSelectionKey
+ extends SelectionKeyImpl
+{
+ public SocketChannelSelectionKey (AbstractSelectableChannel channel,
+ SelectorImpl selector)
+ {
+ super (channel, selector);
+ }
+
+ public int getNativeFD()
+ {
+ return ((SocketChannelImpl) ch).getNativeFD();
+ }
+}