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