diff --git a/test/javax/security/auth/Subject/Synch.java b/test/javax/security/auth/Subject/Synch.java index 417606b71875eef200b1f859b6bf2f2dc1f50ab9..9acc2185282fc77977c4e1863b2e81726f9ca7e0 100644 --- a/test/javax/security/auth/Subject/Synch.java +++ b/test/javax/security/auth/Subject/Synch.java @@ -35,15 +35,15 @@ import javax.security.auth.Subject; import javax.security.auth.x500.X500Principal; public class Synch { + static volatile boolean finished = false; public static void main(String[] args) { Subject subject = new Subject(); final Set principals = subject.getPrincipals(); principals.add(new X500Principal("CN=Alice")); new Thread() { - { setDaemon(true); } public void run() { Principal last = new X500Principal("CN=Bob"); - for (int i = 0; true; i++) { + for (int i = 0; !finished; i++) { Principal next = new X500Principal("CN=Bob" + i); principals.add(next); principals.remove(last); @@ -70,5 +70,6 @@ public class Synch { } }); } + finished = true; } } diff --git a/test/javax/security/auth/Subject/Synch2.java b/test/javax/security/auth/Subject/Synch2.java index b3da63a37028d693cba484bd5dfe5a6b405f8a4e..c88fbee5ea21a3dc593907ad4c842eceeb076cc0 100644 --- a/test/javax/security/auth/Subject/Synch2.java +++ b/test/javax/security/auth/Subject/Synch2.java @@ -35,6 +35,7 @@ import javax.security.auth.Subject; import javax.security.auth.x500.X500Principal; public class Synch2 { + static volatile boolean finished = false; public static void main(String[] args) { System.setSecurityManager(new SecurityManager()); Subject subject = new Subject(); @@ -44,12 +45,11 @@ public class Synch2 { credentials.add("Dummy credential"); new Thread() { { - setDaemon(true); start(); } public void run() { X500Principal p = new X500Principal("CN=Bob"); - while (true) { + while (!finished) { principals.add(p); principals.remove(p); } @@ -62,5 +62,6 @@ public class Synch2 { } } } + finished = true; } } diff --git a/test/javax/security/auth/Subject/Synch3.java b/test/javax/security/auth/Subject/Synch3.java index 5feecd0fd1d67841c37de400ee9e26ed963c9429..e058702a97bd10b74e91c4971ce00916e9bfe5da 100644 --- a/test/javax/security/auth/Subject/Synch3.java +++ b/test/javax/security/auth/Subject/Synch3.java @@ -33,18 +33,18 @@ import javax.security.auth.Subject; import javax.security.auth.x500.X500Principal; public class Synch3 { + static volatile boolean finished = false; public static void main(String[] args) { Subject subject = new Subject(); final Set principals = subject.getPrincipals(); principals.add(new X500Principal("CN=Alice")); new Thread() { { - setDaemon(true); start(); } public void run() { X500Principal p = new X500Principal("CN=Bob"); - while (true) { + while (!finished) { principals.add(p); principals.remove(p); } @@ -53,5 +53,6 @@ public class Synch3 { for (int i = 0; i < 1000; i++) { subject.getPrincipals(X500Principal.class); } + finished = true; } }