< prev index next >
test/jdk/java/nio/channels/spi/SelectorProvider/inheritedChannel/EchoService.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
@@ -63,10 +63,12 @@
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.nio.channels.ServerSocketChannel;
import java.nio.channels.SocketChannel;
+import jdk.test.lib.Utils;
+
public class EchoService {
private static void doIt(SocketChannel sc, int closeAfter, int delay) throws IOException {
ByteBuffer bb = ByteBuffer.allocate(1024);
int total = 0;
@@ -171,11 +173,11 @@
Selector sel = ssc.provider().openSelector();
SelectionKey sk = ssc.register(sel, SelectionKey.OP_ACCEPT);
SocketChannel sc;
int count = 0;
for (;;) {
- sel.select(5000);
+ sel.select((int)Utils.adjustTimeout(5000));
if (sk.isAcceptable() && ((sc = ssc.accept()) != null)) {
Worker w = new Worker(sc);
(new Thread(w)).start();
} else {
// if all clients have disconnected then we die as well.
< prev index next >