Mercurial > hg > shenandoah-preopenjdk-archive > openjdk8 > jdk
changeset 10240:45052ffb3af5
8059311: com/sun/jndi/ldap/LdapTimeoutTest.java fails with exit_code == 0
Reviewed-by: vinnie
author | prappo |
---|---|
date | Fri, 07 Nov 2014 15:12:04 +0000 |
parents | 70a678a6f975 |
children | bbb6ce1a16ab |
files | test/com/sun/jndi/ldap/LdapTimeoutTest.java |
diffstat | 1 files changed, 5 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- a/test/com/sun/jndi/ldap/LdapTimeoutTest.java Fri Oct 24 06:18:00 2014 -0700 +++ b/test/com/sun/jndi/ldap/LdapTimeoutTest.java Fri Nov 07 15:12:04 2014 +0000 @@ -46,8 +46,7 @@ import static java.util.concurrent.TimeUnit.NANOSECONDS; public class LdapTimeoutTest { - private static final ScheduledExecutorService pool = - Executors.newScheduledThreadPool(1); + static volatile int passed = 0, failed = 0; static void pass() {passed++;} static void fail() {failed++; Thread.dumpStack();} @@ -80,7 +79,6 @@ new LdapTimeoutTest().simpleAuthConnectTest(env); } finally { s.interrupt(); - LdapTimeoutTest.pool.shutdown(); } System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed); @@ -90,7 +88,6 @@ void ldapReadTimeoutTest(Hashtable env, boolean ssl) { InitialContext ctx = null; if (ssl) env.put(Context.SECURITY_PROTOCOL, "ssl"); - ScheduledFuture killer = killSwitch(5_000); long start = System.nanoTime(); try { ctx = new InitialDirContext(env); @@ -112,13 +109,12 @@ pass(); } } finally { - if (!shutItDown(killer, ctx)) fail(); + if (!shutItDown(ctx)) fail(); } } void simpleAuthConnectTest(Hashtable env) { InitialContext ctx = null; - ScheduledFuture killer = killSwitch(5_000); long start = System.nanoTime(); try { ctx = new InitialDirContext(env); @@ -141,13 +137,12 @@ fail(); } } finally { - if (!shutItDown(killer, ctx)) fail(); + if (!shutItDown(ctx)) fail(); } } void deadServerNoTimeout(Hashtable env) { InitialContext ctx = null; - ScheduledFuture killer = killSwitch(30_000); long start = System.currentTimeMillis(); try { ctx = new InitialDirContext(env); @@ -169,12 +164,11 @@ pass(); } } finally { - if (!shutItDown(killer, ctx)) fail(); + if (!shutItDown(ctx)) fail(); } } - boolean shutItDown(ScheduledFuture killer, InitialContext ctx) { - killer.cancel(true); + boolean shutItDown(InitialContext ctx) { try { if (ctx != null) ctx.close(); return true; @@ -183,17 +177,6 @@ } } - ScheduledFuture killSwitch(int ms) { - final Thread current = Thread.currentThread(); - return LdapTimeoutTest.pool.schedule(new Callable<Void>() { - public Void call() throws Exception { - System.err.println("Fail: killSwitch()"); - System.exit(0); - return null; - } - }, ms, MILLISECONDS); - } - static class Server extends Thread { final ServerSocket serverSock;