From 131f4b631e3a4f51cfb431ca06e3864845420702 Mon Sep 17 00:00:00 2001 From: weijun Date: Mon, 26 Sep 2011 17:13:47 +0800 Subject: [PATCH] 7094842: test/javax/security/auth/Subject/{Synch.java,Synch2.java,Synch3.java} loop forever in agentvm mode Reviewed-by: alanb --- test/javax/security/auth/Subject/Synch.java | 5 +++-- test/javax/security/auth/Subject/Synch2.java | 5 +++-- test/javax/security/auth/Subject/Synch3.java | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/test/javax/security/auth/Subject/Synch.java b/test/javax/security/auth/Subject/Synch.java index 417606b71..9acc21852 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 b3da63a37..c88fbee5e 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 5feecd0fd..e058702a9 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; } } -- GitLab