提交 131f4b63 编写于 作者: W weijun

7094842: test/javax/security/auth/Subject/{Synch.java,Synch2.java,Synch3.java}...

7094842: test/javax/security/auth/Subject/{Synch.java,Synch2.java,Synch3.java} loop forever in agentvm mode
Reviewed-by: alanb
上级 405378d3
......@@ -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;
}
}
......@@ -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;
}
}
......@@ -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;
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册