6863667: (ch) Several tests in java/nio/channels/* need to be updated after 6638712
authoralanb
Mon, 27 Jul 2009 18:46:50 +0100
changeset 3327 82e069ae54ab
parent 3326 31a5302fe6d4
child 3328 c7e12ed68f87
6863667: (ch) Several tests in java/nio/channels/* need to be updated after 6638712 Reviewed-by: mcimadamore
jdk/test/java/nio/channels/AsynchronousChannelGroup/GroupOfOne.java
jdk/test/java/nio/channels/AsynchronousChannelGroup/Identity.java
jdk/test/java/nio/channels/AsynchronousChannelGroup/Restart.java
jdk/test/java/nio/channels/AsynchronousChannelGroup/Unbounded.java
jdk/test/java/nio/channels/AsynchronousDatagramChannel/Basic.java
jdk/test/java/nio/channels/AsynchronousFileChannel/Basic.java
jdk/test/java/nio/channels/AsynchronousServerSocketChannel/Basic.java
jdk/test/java/nio/channels/AsynchronousSocketChannel/Basic.java
jdk/test/java/nio/channels/AsynchronousSocketChannel/StressLoopback.java
--- a/jdk/test/java/nio/channels/AsynchronousChannelGroup/GroupOfOne.java	Mon Jul 27 18:44:42 2009 +0100
+++ b/jdk/test/java/nio/channels/AsynchronousChannelGroup/GroupOfOne.java	Mon Jul 27 18:46:50 2009 +0100
@@ -44,9 +44,9 @@
         final AsynchronousServerSocketChannel listener =
             AsynchronousServerSocketChannel.open()
                 .bind(new InetSocketAddress(0));
-        listener.accept(null, new CompletionHandler<AsynchronousSocketChannel,Void>() {
+        listener.accept((Void)null, new CompletionHandler<AsynchronousSocketChannel,Void>() {
             public void completed(AsynchronousSocketChannel ch, Void att) {
-                listener.accept(null, this);
+                listener.accept((Void)null, this);
             }
             public void failed(Throwable exc, Void att) {
             }
@@ -81,13 +81,13 @@
         // 2. the close/shutdown completes
         final CountDownLatch latch = new CountDownLatch(2);
 
-        ch.connect(sa, null, new CompletionHandler<Void,Void>() {
+        ch.connect(sa, (Void)null, new CompletionHandler<Void,Void>() {
             public void completed(Void result, Void att)  {
                 System.out.println("Connected");
 
                 // initiate I/O operation that does not complete (successfully)
                 ByteBuffer buf = ByteBuffer.allocate(100);
-                ch.read(buf, null, new CompletionHandler<Integer,Void>() {
+                ch.read(buf, (Void)null, new CompletionHandler<Integer,Void>() {
                     public void completed(Integer bytesRead, Void att)  {
                         throw new RuntimeException();
                     }
--- a/jdk/test/java/nio/channels/AsynchronousChannelGroup/Identity.java	Mon Jul 27 18:44:42 2009 +0100
+++ b/jdk/test/java/nio/channels/AsynchronousChannelGroup/Identity.java	Mon Jul 27 18:46:50 2009 +0100
@@ -78,15 +78,15 @@
         final AsynchronousServerSocketChannel listener =
             AsynchronousServerSocketChannel.open()
                 .bind(new InetSocketAddress(0));
-        listener.accept(null, new CompletionHandler<AsynchronousSocketChannel,Void>() {
+        listener.accept((Void)null, new CompletionHandler<AsynchronousSocketChannel,Void>() {
             public void completed(final AsynchronousSocketChannel ch, Void att) {
-                listener.accept(null, this);
+                listener.accept((Void)null, this);
 
                 final ByteBuffer buf = ByteBuffer.allocate(100);
-                ch.read(buf, null, new CompletionHandler<Integer,Void>() {
+                ch.read(buf, (Void)null, new CompletionHandler<Integer,Void>() {
                     public void completed(Integer bytesRead, Void att) {
                         buf.clear();
-                        ch.read(buf, null, this);
+                        ch.read(buf, (Void)null, this);
                     }
                     public void failed(Throwable exc, Void att) {
                     }
--- a/jdk/test/java/nio/channels/AsynchronousChannelGroup/Restart.java	Mon Jul 27 18:44:42 2009 +0100
+++ b/jdk/test/java/nio/channels/AsynchronousChannelGroup/Restart.java	Mon Jul 27 18:46:50 2009 +0100
@@ -94,7 +94,7 @@
         for (int i=0; i<count; i++) {
             final CountDownLatch latch = new CountDownLatch(1);
 
-            listener.accept(null, new CompletionHandler<AsynchronousSocketChannel,Void>() {
+            listener.accept((Void)null, new CompletionHandler<AsynchronousSocketChannel,Void>() {
                 public void completed(AsynchronousSocketChannel ch, Void att) {
                     try {
                         ch.close();
--- a/jdk/test/java/nio/channels/AsynchronousChannelGroup/Unbounded.java	Mon Jul 27 18:44:42 2009 +0100
+++ b/jdk/test/java/nio/channels/AsynchronousChannelGroup/Unbounded.java	Mon Jul 27 18:46:50 2009 +0100
@@ -45,10 +45,10 @@
         final AsynchronousServerSocketChannel listener =
             AsynchronousServerSocketChannel.open()
                 .bind(new InetSocketAddress(0));
-        listener.accept(null, new CompletionHandler<AsynchronousSocketChannel,Void>() {
+        listener.accept((Void)null, new CompletionHandler<AsynchronousSocketChannel,Void>() {
             public void completed(AsynchronousSocketChannel ch, Void att) {
                 queue.add(ch);
-                listener.accept(null, this);
+                listener.accept((Void)null, this);
             }
             public void failed(Throwable exc, Void att) {
             }
--- a/jdk/test/java/nio/channels/AsynchronousDatagramChannel/Basic.java	Mon Jul 27 18:44:42 2009 +0100
+++ b/jdk/test/java/nio/channels/AsynchronousDatagramChannel/Basic.java	Mon Jul 27 18:46:50 2009 +0100
@@ -66,7 +66,7 @@
         // Test: datagram packet not received immediately
         dst.clear();
         final CountDownLatch latch = new CountDownLatch(1);
-        ch.receive(dst, null, new CompletionHandler<SocketAddress,Void>() {
+        ch.receive(dst, (Void)null, new CompletionHandler<SocketAddress,Void>() {
             public void completed(SocketAddress source, Void att) {
                 latch.countDown();
             }
@@ -82,7 +82,7 @@
         // Test: timeout
         dst.clear();
         final AtomicReference<Throwable> exception = new AtomicReference<Throwable>();
-        ch.receive(dst, 2, TimeUnit.SECONDS, null, new CompletionHandler<SocketAddress,Void>() {
+        ch.receive(dst, 2, TimeUnit.SECONDS, (Void)null, new CompletionHandler<SocketAddress,Void>() {
             public void completed(SocketAddress source, Void att) {
             }
             public void failed (Throwable exc, Void att) {
@@ -101,7 +101,7 @@
         // AsynchronousCloseException
         dst = ByteBuffer.allocateDirect(100);
         exception.set(null);
-        ch.receive(dst, null, new CompletionHandler<SocketAddress,Void>() {
+        ch.receive(dst, (Void)null, new CompletionHandler<SocketAddress,Void>() {
             public void completed(SocketAddress source, Void att) {
             }
             public void failed (Throwable exc, Void att) {
@@ -156,7 +156,7 @@
         // Test: datagram packet not received immediately
         dst.clear();
         final CountDownLatch l1 = new CountDownLatch(1);
-        ch.read(dst, null, new CompletionHandler<Integer,Void>() {
+        ch.read(dst, (Void)null, new CompletionHandler<Integer,Void>() {
             public void completed(Integer bytesRead, Void att) {
                 l1.countDown();
             }
@@ -172,7 +172,7 @@
         // Test: timeout
         dst.clear();
         final AtomicReference<Throwable> exception = new AtomicReference<Throwable>();
-        ch.read(dst, 2, TimeUnit.SECONDS, null, new CompletionHandler<Integer,Void>() {
+        ch.read(dst, 2, TimeUnit.SECONDS, (Void)null, new CompletionHandler<Integer,Void>() {
             public void completed(Integer bytesRead, Void att) {
             }
             public void failed (Throwable exc, Void att) {
@@ -191,7 +191,7 @@
         // AsynchronousCloseException
         dst.clear();
         exception.set(null);
-        ch.read(dst, null, new CompletionHandler<Integer,Void>() {
+        ch.read(dst, (Void)null, new CompletionHandler<Integer,Void>() {
             public void completed(Integer bytesRead, Void att) {
             }
             public void failed (Throwable exc, Void att) {
@@ -238,7 +238,7 @@
         // Test: send datagram packet to reader and check completion handler
         // is invoked
         final CountDownLatch l2 = new CountDownLatch(1);
-        ch.send(ByteBuffer.wrap(msg), sa, null, new CompletionHandler<Integer,Void>() {
+        ch.send(ByteBuffer.wrap(msg), sa, (Void)null, new CompletionHandler<Integer,Void>() {
             public void completed(Integer bytesSent, Void att) {
                 if (bytesSent != msg.length)
                     throw new RuntimeException("Unexpected number of bytes received");
@@ -261,7 +261,7 @@
         // Test: check that failed method is invoked
         ch.close();
         final CountDownLatch l3 = new CountDownLatch(1);
-        ch.send(ByteBuffer.wrap(msg), sa, null, new CompletionHandler<Integer,Void>() {
+        ch.send(ByteBuffer.wrap(msg), sa, (Void)null, new CompletionHandler<Integer,Void>() {
             public void completed(Integer bytesSent, Void att) {
                 throw new RuntimeException("completed method invoked");
             }
@@ -315,7 +315,7 @@
 
         // Test: write datagram and check completion handler is invoked
         final CountDownLatch l2 = new CountDownLatch(1);
-        ch.write(ByteBuffer.wrap(msg), null, new CompletionHandler<Integer,Void>() {
+        ch.write(ByteBuffer.wrap(msg), (Void)null, new CompletionHandler<Integer,Void>() {
             public void completed(Integer bytesSent, Void att) {
                 if (bytesSent != msg.length)
                     throw new RuntimeException("Unexpected number of bytes received");
@@ -372,7 +372,7 @@
             final CountDownLatch latch = new CountDownLatch(1);
             long timeout = (i == 0) ? 0L : 60L;
             Future<SocketAddress> remote = ch
-                .receive(ByteBuffer.allocate(100), timeout, TimeUnit.SECONDS, null,
+                .receive(ByteBuffer.allocate(100), timeout, TimeUnit.SECONDS, (Void)null,
                     new CompletionHandler<SocketAddress,Void>() {
                         public void completed(SocketAddress source, Void att) {
                         }
@@ -395,7 +395,7 @@
             final CountDownLatch latch = new CountDownLatch(1);
             long timeout = (i == 0) ? 0L : 60L;
             Future<Integer> result = ch
-                .read(ByteBuffer.allocate(100), timeout, TimeUnit.SECONDS, null,
+                .read(ByteBuffer.allocate(100), timeout, TimeUnit.SECONDS, (Void)null,
                     new CompletionHandler<Integer,Void>() {
                         public void completed(Integer bytesRead, Void att) {
                         }
--- a/jdk/test/java/nio/channels/AsynchronousFileChannel/Basic.java	Mon Jul 27 18:44:42 2009 +0100
+++ b/jdk/test/java/nio/channels/AsynchronousFileChannel/Basic.java	Mon Jul 27 18:46:50 2009 +0100
@@ -190,7 +190,7 @@
             if (fl == null)
                 throw new RuntimeException("Unable to acquire lock");
             try {
-                ch.lock(null, new CompletionHandler<FileLock,Void> () {
+                ch.lock((Void)null, new CompletionHandler<FileLock,Void> () {
                     public void completed(FileLock result, Void att) {
                     }
                     public void failed(Throwable exc, Void att) {
@@ -217,7 +217,7 @@
         ByteBuffer buf = ByteBuffer.allocateDirect(100);
         final CountDownLatch latch = new CountDownLatch(1);
 
-        ch.read(buf, 0L, null, new CompletionHandler<Integer,Void>() {
+        ch.read(buf, 0L, (Void)null, new CompletionHandler<Integer,Void>() {
             public void completed(Integer result, Void att) {
                 try {
                     Thread.currentThread().interrupt();
@@ -311,7 +311,7 @@
                     final AtomicReference<Thread> invoker = new AtomicReference<Thread>();
                     final CountDownLatch latch = new CountDownLatch(1);
 
-                    ch.write(genBuffer(), 0L, null, new CompletionHandler<Integer,Void>() {
+                    ch.write(genBuffer(), 0L, (Void)null, new CompletionHandler<Integer,Void>() {
                         public void completed(Integer result, Void att) {
                             invoker.set(Thread.currentThread());
                             latch.countDown();
@@ -410,7 +410,7 @@
 
             // start write operation
             final CountDownLatch latch = new CountDownLatch(1);
-            Future<Integer> res = ch.write(genBuffer(), 0L, null,
+            Future<Integer> res = ch.write(genBuffer(), 0L, (Void)null,
                 new CompletionHandler<Integer,Void>() {
                     public void completed(Integer result, Void att) {
                     }
--- a/jdk/test/java/nio/channels/AsynchronousServerSocketChannel/Basic.java	Mon Jul 27 18:44:42 2009 +0100
+++ b/jdk/test/java/nio/channels/AsynchronousServerSocketChannel/Basic.java	Mon Jul 27 18:46:50 2009 +0100
@@ -95,7 +95,7 @@
        final AtomicReference<Throwable> exception = new AtomicReference<Throwable>();
 
         // start accepting
-        listener.accept(null, new CompletionHandler<AsynchronousSocketChannel,Void>() {
+        listener.accept((Void)null, new CompletionHandler<AsynchronousSocketChannel,Void>() {
             public void completed(AsynchronousSocketChannel ch, Void att) {
                 try {
                     ch.close();
--- a/jdk/test/java/nio/channels/AsynchronousSocketChannel/Basic.java	Mon Jul 27 18:44:42 2009 +0100
+++ b/jdk/test/java/nio/channels/AsynchronousSocketChannel/Basic.java	Mon Jul 27 18:46:50 2009 +0100
@@ -181,7 +181,7 @@
         }
         final AtomicReference<Throwable> connectException =
             new AtomicReference<Throwable>();
-        ch.connect(server.address(), null, new CompletionHandler<Void,Void>() {
+        ch.connect(server.address(), (Void)null, new CompletionHandler<Void,Void>() {
             public void completed(Void result, Void att) {
             }
             public void failed(Throwable exc, Void att) {
@@ -332,7 +332,7 @@
             // start read operation
             final CountDownLatch latch = new CountDownLatch(1);
             ByteBuffer buf = ByteBuffer.allocate(1);
-            Future<Integer> res = ch.read(buf, null,
+            Future<Integer> res = ch.read(buf, (Void)null,
                 new CompletionHandler<Integer,Void>() {
                     public void completed(Integer result, Void att) {
                     }
@@ -397,11 +397,11 @@
         // reads should complete immediately
         final ByteBuffer dst = ByteBuffer.allocateDirect(src.capacity() + 100);
         final CountDownLatch latch = new CountDownLatch(1);
-        ch.read(dst, null, new CompletionHandler<Integer,Void>() {
+        ch.read(dst, (Void)null, new CompletionHandler<Integer,Void>() {
             public void completed(Integer result, Void att) {
                 int n = result;
                 if (n > 0) {
-                    ch.read(dst, null, this);
+                    ch.read(dst, (Void)null, this);
                 } else {
                     latch.countDown();
                 }
@@ -450,10 +450,10 @@
         // read until the buffer is full
         final ByteBuffer dst = ByteBuffer.allocateDirect(src.capacity());
         final CountDownLatch latch = new CountDownLatch(1);
-        ch.read(dst, null, new CompletionHandler<Integer,Void>() {
+        ch.read(dst, (Void)null, new CompletionHandler<Integer,Void>() {
             public void completed(Integer result, Void att) {
                 if (dst.hasRemaining()) {
-                    ch.read(dst, null, this);
+                    ch.read(dst, (Void)null, this);
                 } else {
                     latch.countDown();
                 }
@@ -508,7 +508,7 @@
 
         // scattering read that completes ascynhronously
         final CountDownLatch latch = new CountDownLatch(1);
-        ch.read(dsts, 0, dsts.length, 0L, TimeUnit.SECONDS, null,
+        ch.read(dsts, 0, dsts.length, 0L, TimeUnit.SECONDS, (Void)null,
             new CompletionHandler<Long,Void>() {
                 public void completed(Long result, Void att) {
                     long n = result;
@@ -536,7 +536,7 @@
             dsts[i].rewind();
         }
         long n = ch
-            .read(dsts, 0, dsts.length, 0L, TimeUnit.SECONDS, null, null).get();
+            .read(dsts, 0, dsts.length, 0L, TimeUnit.SECONDS, (Void)null, null).get();
         if (n <= 0)
             throw new RuntimeException("No bytes read");
 
@@ -562,10 +562,10 @@
 
         // write all bytes and close connection when done
         final ByteBuffer src = genBuffer();
-        ch.write(src, null, new CompletionHandler<Integer,Void>() {
+        ch.write(src, (Void)null, new CompletionHandler<Integer,Void>() {
             public void completed(Integer result, Void att) {
                 if (src.hasRemaining()) {
-                    ch.write(src, null, this);
+                    ch.write(src, (Void)null, this);
                 } else {
                     try {
                         ch.close();
@@ -616,7 +616,7 @@
         // write buffers (should complete immediately)
         ByteBuffer[] srcs = genBuffers(1);
         long n = ch
-            .write(srcs, 0, srcs.length, 0L, TimeUnit.SECONDS, null, null).get();
+            .write(srcs, 0, srcs.length, 0L, TimeUnit.SECONDS, (Void)null, null).get();
         if (n <= 0)
             throw new RuntimeException("No bytes written");
 
@@ -629,7 +629,7 @@
         // write until socket buffer is full so as to create the conditions
         // for when a write does not complete immediately
         srcs = genBuffers(1);
-        ch.write(srcs, 0, srcs.length, 0L, TimeUnit.SECONDS, null,
+        ch.write(srcs, 0, srcs.length, 0L, TimeUnit.SECONDS, (Void)null,
             new CompletionHandler<Long,Void>() {
                 public void completed(Long result, Void att) {
                     long n = result;
@@ -639,7 +639,7 @@
                     if (continueWriting.get()) {
                         ByteBuffer[] srcs = genBuffers(8);
                         ch.write(srcs, 0, srcs.length, 0L, TimeUnit.SECONDS,
-                            null, this);
+                            (Void)null, this);
                     }
                 }
                 public void failed(Throwable exc, Void att) {
@@ -717,7 +717,7 @@
         // this read should timeout
         ByteBuffer dst = ByteBuffer.allocate(512);
         try {
-            ch.read(dst, 3, TimeUnit.SECONDS, null, null).get();
+            ch.read(dst, 3, TimeUnit.SECONDS, (Void)null, null).get();
             throw new RuntimeException("Read did not timeout");
         } catch (ExecutionException x) {
             if (!(x.getCause() instanceof InterruptedByTimeoutException))
--- a/jdk/test/java/nio/channels/AsynchronousSocketChannel/StressLoopback.java	Mon Jul 27 18:44:42 2009 +0100
+++ b/jdk/test/java/nio/channels/AsynchronousSocketChannel/StressLoopback.java	Mon Jul 27 18:46:50 2009 +0100
@@ -99,7 +99,7 @@
         void start() {
             sentBuffer.position(0);
             sentBuffer.limit(sentBuffer.capacity());
-            channel.write(sentBuffer, null, new CompletionHandler<Integer,Void> () {
+            channel.write(sentBuffer, (Void)null, new CompletionHandler<Integer,Void> () {
                 public void completed(Integer nwrote, Void att) {
                     bytesSent += nwrote;
                     if (finished) {
@@ -107,7 +107,7 @@
                     } else {
                         sentBuffer.position(0);
                         sentBuffer.limit(sentBuffer.capacity());
-                        channel.write(sentBuffer, null, this);
+                        channel.write(sentBuffer, (Void)null, this);
                     }
                 }
                 public void failed(Throwable exc, Void att) {
@@ -142,14 +142,14 @@
         }
 
         void start() {
-            channel.read(readBuffer, null, new CompletionHandler<Integer,Void> () {
+            channel.read(readBuffer, (Void)null, new CompletionHandler<Integer,Void> () {
                 public void completed(Integer nread, Void att) {
                     if (nread < 0) {
                         closeUnchecked(channel);
                     } else {
                         bytesRead += nread;
                         readBuffer.clear();
-                        channel.read(readBuffer, null, this);
+                        channel.read(readBuffer, (Void)null, this);
                     }
                 }
                 public void failed(Throwable exc, Void att) {