diff options
author | prappo <none@none> | 2014-07-11 14:53:55 +0100 |
---|---|---|
committer | prappo <none@none> | 2014-07-11 14:53:55 +0100 |
commit | ddac2db224a9e51a39e146753f2afc6706fc0c9e (patch) | |
tree | a3abdefee9a9ee149db73abfeb838c6187b31796 /test/com | |
parent | 716b505fbdd26576b9e6c371a9b3618f8d912e30 (diff) |
8049884: Reduce possible timing noise in com/sun/jndi/ldap/LdapTimeoutTest.java
Reviewed-by: vinnie
Diffstat (limited to 'test/com')
-rw-r--r-- | test/com/sun/jndi/ldap/LdapTimeoutTest.java | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/test/com/sun/jndi/ldap/LdapTimeoutTest.java b/test/com/sun/jndi/ldap/LdapTimeoutTest.java index c5705bc4b..ba507479e 100644 --- a/test/com/sun/jndi/ldap/LdapTimeoutTest.java +++ b/test/com/sun/jndi/ldap/LdapTimeoutTest.java @@ -23,6 +23,7 @@ /** * @test + * @run main/othervm LdapTimeoutTest * @bug 7094377 8000487 6176036 7056489 * @summary Timeout tests for ldap */ @@ -147,7 +148,7 @@ public class LdapTimeoutTest { void deadServerNoTimeout(Hashtable env) { InitialContext ctx = null; ScheduledFuture killer = killSwitch(30_000); - long start = System.nanoTime(); + long start = System.currentTimeMillis(); try { ctx = new InitialDirContext(env); SearchControls scl = new SearchControls(); @@ -157,13 +158,11 @@ public class LdapTimeoutTest { // shouldn't reach here fail(); } catch (NamingException e) { - long end = System.nanoTime(); - long elapsed = NANOSECONDS.toMillis(end - start); + long elapsed = System.currentTimeMillis() - start; if (elapsed < Connection.DEFAULT_READ_TIMEOUT_MILLIS) { - System.err.printf( - "fail: timeout should be at least %s ms, actual time is %s ms", - Connection.DEFAULT_READ_TIMEOUT_MILLIS, - elapsed); + System.err.printf("fail: timeout should be at least %s ms, " + + "actual time is %s ms%n", + Connection.DEFAULT_READ_TIMEOUT_MILLIS, elapsed); e.printStackTrace(); fail(); } else { |