Skip to content

Commit

Permalink
8207316: java/nio/channels/spi/SelectorProvider/inheritedChannel/Inhe…
Browse files Browse the repository at this point in the history
…ritedChannelTest.java failed

Backport-of: 069fa39
  • Loading branch information
RealCLanger committed Jul 28, 2021
1 parent 8ec02f3 commit 5c8a0b4
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* 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
Expand Down Expand Up @@ -38,6 +38,8 @@
import java.nio.channels.Selector;
import java.nio.channels.SocketChannel;

import jdk.test.lib.Utils;

public class CloseTest {

public static void main(String args[]) throws Exception {
Expand All @@ -50,7 +52,7 @@ public static void main(String args[]) throws Exception {

String service_args[] = new String[2];
service_args[0] = String.valueOf(msg.length());
service_args[1] = String.valueOf( 15*1000 );
service_args[1] = String.valueOf( Utils.adjustTimeout(15*1000) );


SocketChannel sc = Launcher.launchWithSocketChannel("EchoService", service_args);
Expand All @@ -65,7 +67,7 @@ public static void main(String args[]) throws Exception {
Selector sel = sc.provider().openSelector();
SelectionKey sk = sc.register(sel, SelectionKey.OP_READ);

long to = 12 * 1000;
long to = Utils.adjustTimeout(12*1000);
for (;;) {
long st = System.currentTimeMillis();
sel.select(to);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* 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
Expand Down Expand Up @@ -65,6 +65,8 @@
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 {
Expand Down Expand Up @@ -173,7 +175,7 @@ public static void main(String args[]) throws IOException {
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();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* 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
Expand Down Expand Up @@ -44,6 +44,8 @@
import java.nio.channels.SocketChannel;
import java.util.Random;

import jdk.test.lib.Utils;

public class EchoTest {

private static int failures = 0;
Expand Down Expand Up @@ -80,7 +82,7 @@ private static void TCPEchoTest() throws IOException {
Selector sel = sc.provider().openSelector();
SelectionKey sk = sc.register(sel, SelectionKey.OP_READ);
int nread = 0;
long to = 5000;
long to = Utils.adjustTimeout(5000);
while (nread < size) {
long st = System.currentTimeMillis();
sel.select(to);
Expand Down Expand Up @@ -144,7 +146,7 @@ private static void UDPEchoTest() throws IOException {
// and receive the echo
byte b[] = new byte[msg.length() + 100];
DatagramPacket pkt2 = new DatagramPacket(b, b.length);
dc.socket().setSoTimeout(5000);
dc.socket().setSoTimeout((int)Utils.adjustTimeout(5000));
dc.socket().receive(pkt2);

if (pkt2.getLength() != msg.length()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
public class InheritedChannelTest {

private static final String TEST_SRC = System.getProperty("test.src");
private static final String TEST_CLASSES = System.getProperty("test.classes");
private static final String TEST_CLASSES = System.getProperty("test.class.path");
private static final Path POLICY_PASS = Paths.get(TEST_SRC, "java.policy.pass");
private static final Path POLICY_FAIL = Paths.get(TEST_SRC, "java.policy.fail");

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* 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
Expand Down Expand Up @@ -42,6 +42,8 @@
import java.nio.channels.ServerSocketChannel;
import java.nio.channels.SocketChannel;

import jdk.test.lib.Utils;

public class StateTest {

private static int failures = 0;
Expand All @@ -66,7 +68,7 @@ private static void waitForTestResult(ServerSocketChannel ssc, boolean expectFai
*/
ssc.configureBlocking(false);
sk = ssc.register(sel, SelectionKey.OP_ACCEPT);
long to = 15*1000;
long to = Utils.adjustTimeout(15*1000);
sc = null;
for (;;) {
long st = System.currentTimeMillis();
Expand All @@ -89,7 +91,7 @@ private static void waitForTestResult(ServerSocketChannel ssc, boolean expectFai
*/
sc.configureBlocking(false);
sk = sc.register(sel, SelectionKey.OP_READ);
to = 5000;
to = Utils.adjustTimeout(5000);
ByteBuffer bb = ByteBuffer.allocateDirect(20);
for (;;) {
long st = System.currentTimeMillis();
Expand Down

1 comment on commit 5c8a0b4

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.