# HG changeset patch # User weijun # Date 1337586030 -28800 # Node ID c624acdf1852ee2bb4e9d051686ebe5bffb3ef02 # Parent 9c9ad46c7c408e53d9cb76eb46dc55e2e2825d1a 7170308: timing error in the krb5 test SSL.java Reviewed-by: xuelei diff -r 9c9ad46c7c40 -r c624acdf1852 jdk/test/sun/security/krb5/auto/SSL.java --- a/jdk/test/sun/security/krb5/auto/SSL.java Fri May 18 12:29:33 2012 -0700 +++ b/jdk/test/sun/security/krb5/auto/SSL.java Mon May 21 15:40:30 2012 +0800 @@ -53,6 +53,9 @@ private static volatile String server; private static volatile int port; + // 0-Not started, 1-Start OK, 2-Failure + private static volatile int serverState = 0; + public static void main(String[] args) throws Exception { krb5Cipher = args[0]; @@ -109,14 +112,20 @@ s.doAs(new JsseServerAction(), null); } catch (Exception e) { e.printStackTrace(); + serverState = 2; } } }); server.setDaemon(true); server.start(); - // Warm the server - Thread.sleep(2000); + while (serverState == 0) { + Thread.sleep(50); + } + + if (serverState == 2) { + throw new Exception("Server already failed"); + } // Now create the keytab @@ -214,6 +223,7 @@ (SSLServerSocket) sslssf.createServerSocket(0); // any port port = sslServerSocket.getLocalPort(); System.out.println("Listening on " + port); + serverState = 1; // Enable only a KRB5 cipher suite. String enabledSuites[] = {krb5Cipher};