This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

FYI: Patch: java.nio


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi list,


I commited the attached patch to trunk to clean java.nio up a bit.


Michael
- -- 
Homepage: http://www.worldforge.org/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+6w1jWSOgCCdjSDsRAlLTAJ0WGgIWEAudSoL8xchE8mLXehJi0gCgmwpm
NLxPw4R353eIIxI9pB/cwIs=
=e7uj
-----END PGP SIGNATURE-----
Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/libjava/ChangeLog,v
retrieving revision 1.1946
diff -u -b -B -r1.1946 ChangeLog
--- ChangeLog	14 Jun 2003 05:45:12 -0000	1.1946
+++ ChangeLog	14 Jun 2003 11:51:48 -0000
@@ -1,5 +1,19 @@
 2003-06-14  Michael Koch  <konqueror@gmx.de>
 
+	* gnu/java/nio/FileChannelImpl.java
+        (map_address): Removed incorrect comment.        
+	* gnu/java/nio/SelectorImpl.java
+        (register): Remove code duplication and code for file channel handling.        
+	* gnu/java/nio/ServerSocketChannelImpl.java
+        (serverSocket): Renamed from sock_object.
+        (ServerSocketChannel): Initialize serverSocket.
+        (socket): Return serverSocket.
+	* gnu/java/nio/SocketChannelImpl.java
+        (socket): Renamed from sock_object.
+        (isConnectionPenging): Simplified.
+        (socket): Return socket.
+2003-06-14  Michael Koch  <konqueror@gmx.de>
+
 	* java/security/BasicPermission.java:
 	New version from classpath.
 
Index: gnu/java/nio/FileChannelImpl.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/java/nio/FileChannelImpl.java,v
retrieving revision 1.5
diff -u -b -B -r1.5 FileChannelImpl.java
--- gnu/java/nio/FileChannelImpl.java	2 May 2003 05:35:57 -0000	1.5
+++ gnu/java/nio/FileChannelImpl.java	14 Jun 2003 11:51:48 -0000
@@ -64,8 +65,6 @@
 
 public class FileChannelImpl extends FileChannel
 {
-  // GCJ LOCAL: This variable stores a pointer to the memory
-  // where the file is mapped.
   RawData map_address;
   
   int length;
Index: gnu/java/nio/SelectorImpl.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/java/nio/SelectorImpl.java,v
retrieving revision 1.3
diff -u -b -B -r1.3 SelectorImpl.java
--- gnu/java/nio/SelectorImpl.java	14 May 2003 06:37:59 -0000	1.3
+++ gnu/java/nio/SelectorImpl.java	14 Jun 2003 11:51:48 -0000
@@ -250,50 +250,31 @@
   protected SelectionKey register (AbstractSelectableChannel ch, int ops,
                                    Object att)
   {
-// 	  // filechannel is not selectable ?
-//     if (ch instanceof FileChannelImpl)
-//       {
-//         FileChannelImpl fc = (FileChannelImpl) ch;
-//         SelectionKeyImpl impl = new SelectionKeyImpl (ch, this, fc.fd);
-//         keys.add (impl);
-//         impl.interestOps (ops);
-//         impl.attach (att);
-//         return impl;
-//       }
-//     else
+    SelectionKeyImpl result;
 
     if (ch instanceof SocketChannelImpl)
       {
         SocketChannelImpl sc = (SocketChannelImpl) ch;
-        SelectionKeyImpl impl = new SelectionKeyImpl (ch, this, sc.fd);
-        add (impl);
-        impl.interestOps (ops);
-        impl.attach (att);
-        return impl;
+        result = new SelectionKeyImpl (ch, this, sc.fd);
       }
     else if (ch instanceof DatagramChannelImpl)
       {
         DatagramChannelImpl dc = (DatagramChannelImpl) ch;
-        SelectionKeyImpl impl = new SelectionKeyImpl (ch, this, dc.fd);
-        add (impl);
-        impl.interestOps (ops);
-        impl.attach (att);
-        return impl;
+        result = new SelectionKeyImpl (ch, this, dc.fd);
       }
     else if (ch instanceof ServerSocketChannelImpl)
       {
         ServerSocketChannelImpl ssc = (ServerSocketChannelImpl) ch;
-        SelectionKeyImpl impl = new SelectionKeyImpl (ch, this, ssc.fd);
-        add (impl);
-        impl.interestOps (ops);
-        impl.attach (att);
-        return impl;
+        result = new SelectionKeyImpl (ch, this, ssc.fd);
       }
     else
       {
-        System.err.println ("INTERNAL ERROR, no known channel type");
+        throw new InternalError ("No known channel type");
       }
 
-    return null;
+    add (result);
+    result.interestOps (ops);
+    result.attach (att);
+    return result;
   }
 }
Index: gnu/java/nio/ServerSocketChannelImpl.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/java/nio/ServerSocketChannelImpl.java,v
retrieving revision 1.5
diff -u -b -B -r1.5 ServerSocketChannelImpl.java
--- gnu/java/nio/ServerSocketChannelImpl.java	14 May 2003 06:37:59 -0000	1.5
+++ gnu/java/nio/ServerSocketChannelImpl.java	14 Jun 2003 11:51:48 -0000
@@ -47,7 +47,7 @@
 
 class ServerSocketChannelImpl extends ServerSocketChannel
 {
-  ServerSocket sock_object;
+  ServerSocket serverSocket;
   int fd;
 //   int local_port;
   boolean blocking = true;
@@ -62,7 +62,7 @@
 
     try
       {
-        sock_object = new ServerSocket ();
+        serverSocket = new ServerSocket ();
       }
     catch (IOException e)
       {
@@ -106,6 +106,6 @@
 
   public ServerSocket socket ()
   {
-    return sock_object;
+    return serverSocket;
   }
 }
Index: gnu/java/nio/SocketChannelImpl.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/java/nio/SocketChannelImpl.java,v
retrieving revision 1.4
diff -u -b -B -r1.4 SocketChannelImpl.java
--- gnu/java/nio/SocketChannelImpl.java	20 May 2003 08:58:31 -0000	1.4
+++ gnu/java/nio/SocketChannelImpl.java	14 Jun 2003 11:51:48 -0000
@@ -50,7 +51,7 @@
 
 public class SocketChannelImpl extends SocketChannel
 {
-  Socket sock_object;
+  Socket socket;
   int fd;
   int local_port;
   boolean blocking = true;
@@ -141,20 +142,17 @@
     
   public boolean isConnectionPending ()
   {
-    if (blocking)
-	    return true;
-
-    return false;
+    return blocking ? true : false;
   }
     
   public Socket socket ()
   {
-    if (sock_object != null)
+    if (socket != null)
 	    {
-        //sock_object.ch = this;
+        //socket.ch = this;
 	    }
 
-    return sock_object;
+    return socket;
   }
 
   public int read (ByteBuffer dst) throws IOException

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]