Java Code Examples for jdk.testlibrary.Utils#adjustTimeout()

The following examples show how to use jdk.testlibrary.Utils#adjustTimeout() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JMXStartStopTest.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private static void testConnect(int port, int rmiPort) throws Exception {
    EOFException lastException = null;
    // factor adjusted timeout (5 seconds) for the RMI to become available
    long timeout = System.currentTimeMillis() + Utils.adjustTimeout(5000);
    do {
        try {
            doTestConnect(port, rmiPort);
            lastException = null;
        } catch (EOFException e) {
            lastException = e;
            System.out.println("Error establishing RMI connection. Retrying in 500ms.");
            Thread.sleep(500);
        }
    } while (lastException != null && System.currentTimeMillis() < timeout);

    if (lastException != null) {
        // didn't manage to get the RMI running in time
        // rethrow the exception
        throw lastException;
    }
}
 
Example 2
Source File: MethodResultTest.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private static JMXConnector connect(JMXServiceURL addr) {
    final long timeout = Utils.adjustTimeout(100);

    JMXConnector connector = null;
    while (connector == null) {
        try {
            connector = JMXConnectorFactory.connect(addr);
        } catch (IOException e) {
            System.out.println("Connection error. Retrying after delay...");
            delay(timeout);
        } catch (Exception otherException) {
            System.out.println("Unexpected exception while connecting " + otherException);
            throw new RuntimeException(otherException);
        }
    }
    return connector;
}
 
Example 3
Source File: GaugeMonitorDeadlockTest.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    if (args.length != 1)
        throw new Exception("Arg should be test number");
    checkingTime = Utils.adjustTimeout(1000); // default 1s timeout
    System.out.println("=== checkingTime = " + checkingTime + "ms");

    int testNo = Integer.parseInt(args[0]) - 1;
    TestCase test = testCases[testNo];
    System.out.println("Test: " + test.getDescription());
    test.run();
    System.out.println("Test passed");
}
 
Example 4
Source File: GaugeMonitorDeadlockTest.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    if (args.length != 1)
        throw new Exception("Arg should be test number");
    checkingTime = Utils.adjustTimeout(1000); // default 1s timeout
    System.out.println("=== checkingTime = " + checkingTime + "ms");

    int testNo = Integer.parseInt(args[0]) - 1;
    TestCase test = testCases[testNo];
    System.out.println("Test: " + test.getDescription());
    test.run();
    System.out.println("Test passed");
}
 
Example 5
Source File: GaugeMonitorDeadlockTest.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    if (args.length != 1)
        throw new Exception("Arg should be test number");
    checkingTime = Utils.adjustTimeout(1000); // default 1s timeout
    System.out.println("=== checkingTime = " + checkingTime + "ms");

    int testNo = Integer.parseInt(args[0]) - 1;
    TestCase test = testCases[testNo];
    System.out.println("Test: " + test.getDescription());
    test.run();
    System.out.println("Test passed");
}
 
Example 6
Source File: GaugeMonitorDeadlockTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    if (args.length != 1)
        throw new Exception("Arg should be test number");
    checkingTime = Utils.adjustTimeout(1000); // default 1s timeout
    System.out.println("=== checkingTime = " + checkingTime + "ms");

    int testNo = Integer.parseInt(args[0]) - 1;
    TestCase test = testCases[testNo];
    System.out.println("Test: " + test.getDescription());
    test.run();
    System.out.println("Test passed");
}
 
Example 7
Source File: GaugeMonitorDeadlockTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    if (args.length != 1)
        throw new Exception("Arg should be test number");
    checkingTime = Utils.adjustTimeout(1000); // default 1s timeout
    System.out.println("=== checkingTime = " + checkingTime + "ms");

    int testNo = Integer.parseInt(args[0]) - 1;
    TestCase test = testCases[testNo];
    System.out.println("Test: " + test.getDescription());
    test.run();
    System.out.println("Test passed");
}
 
Example 8
Source File: GaugeMonitorDeadlockTest.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    if (args.length != 1)
        throw new Exception("Arg should be test number");
    checkingTime = Utils.adjustTimeout(1000); // default 1s timeout
    System.out.println("=== checkingTime = " + checkingTime + "ms");

    int testNo = Integer.parseInt(args[0]) - 1;
    TestCase test = testCases[testNo];
    System.out.println("Test: " + test.getDescription());
    test.run();
    System.out.println("Test passed");
}
 
Example 9
Source File: GaugeMonitorDeadlockTest.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    if (args.length != 1)
        throw new Exception("Arg should be test number");
    checkingTime = Utils.adjustTimeout(1000); // default 1s timeout
    System.out.println("=== checkingTime = " + checkingTime + "ms");

    int testNo = Integer.parseInt(args[0]) - 1;
    TestCase test = testCases[testNo];
    System.out.println("Test: " + test.getDescription());
    test.run();
    System.out.println("Test passed");
}