Use yield instead of sleep
This commit is contained in:
parent
6849ea2f4b
commit
7b6fb53fc1
@ -71,21 +71,13 @@ public class NioServerSocketShutdownTimeTest {
|
||||
((InetSocketAddress) channel.getLocalAddress()).getPort());
|
||||
|
||||
while (!handler.connected) {
|
||||
try {
|
||||
Thread.sleep(1);
|
||||
} catch (InterruptedException e) {
|
||||
// Ignore
|
||||
}
|
||||
Thread.yield();
|
||||
}
|
||||
|
||||
socket.close();
|
||||
|
||||
while (!handler.closed) {
|
||||
try {
|
||||
Thread.sleep(1);
|
||||
} catch (InterruptedException e) {
|
||||
// Ignore
|
||||
}
|
||||
Thread.yield();
|
||||
}
|
||||
} finally {
|
||||
if (socket != null) {
|
||||
|
Loading…
Reference in New Issue
Block a user