< prev index next >
test/vmTestbase/nsk/jvmti/PopFrame/popframe001.java
Print this page
@@ -37,11 +37,10 @@
public class popframe001 {
static final int PASSED = 0;
static final int FAILED = 2;
static final int JCK_STATUS_BASE = 95;
- static boolean DEBUG_MODE = false;
static volatile boolean popFdone = false;
static volatile int totRes = PASSED;
private PrintStream out;
private popFrameCls popFrameClsThr;
static Object barrier = new Object();
@@ -56,13 +55,13 @@
System.getProperty("java.library.path"));
throw e;
}
}
- native static int doPopFrame(int vrb, popFrameCls popFrameClsThr);
- native static int suspThread(int vrb, popFrameCls popFrameClsThr);
- native static int resThread(int vrb, popFrameCls popFrameClsThr);
+ native static int doPopFrame(popFrameCls popFrameClsThr);
+ native static int suspThread(popFrameCls popFrameClsThr);
+ native static int resThread(popFrameCls popFrameClsThr);
public static void main(String[] argv) {
argv = nsk.share.jvmti.JVMTITest.commonInit(argv);
System.exit(run(argv, System.out) + JCK_STATUS_BASE);
@@ -74,53 +73,40 @@
private int runIt(String argv[], PrintStream out) {
int retValue = 0;
this.out = out;
- for (int i = 0; i < argv.length; i++) {
- if (argv[i].equals("-v")) // verbose mode
- DEBUG_MODE = true;
- }
popFrameClsThr = new popFrameCls("Tested Thread");
startingBarrier = new Wicket();
// start the child thread
popFrameClsThr.start();
startingBarrier.waitFor();
// pause until the child thread exits notification-block
synchronized (barrier) {
}
- if (DEBUG_MODE) {
out.println("Going to suspend the thread...");
- retValue = suspThread(1, popFrameClsThr);
- } else
- retValue = suspThread(0, popFrameClsThr);
+ retValue = suspThread(popFrameClsThr);
if (retValue != PASSED) {
out.println("TEST: failed to suspend thread");
return FAILED;
}
// pop a frame of the child thread
- if (DEBUG_MODE) {
out.println("Going to pop a frame...");
- retValue = doPopFrame(1, popFrameClsThr);
- } else
- retValue = doPopFrame(0, popFrameClsThr);
+ retValue = doPopFrame(popFrameClsThr);
popFdone = true;
popFrameClsThr.letItGo();
if (retValue != PASSED) {
out.println("TEST: failed to pop frame");
- resThread(0, popFrameClsThr);
+ resThread(popFrameClsThr);
return FAILED;
}
- if (DEBUG_MODE) {
out.println("Going to resume the thread...");
- retValue = resThread(1, popFrameClsThr);
- } else
- retValue = resThread(0, popFrameClsThr);
+ retValue = resThread(popFrameClsThr);
if (retValue != PASSED) {
out.println("TEST: failed to resume thread");
return FAILED;
}
@@ -141,34 +127,26 @@
super(name);
}
public void run() {
activeMethod();
- if (DEBUG_MODE)
- out.println("popFrameCls (" + this +
- "): exiting...");
+ out.println("popFrameCls (" + this + "): exiting...");
}
public void activeMethod() {
boolean compl = true; // complain in a finally block
if (popframe001.popFdone) { // popping has been done
- if (DEBUG_MODE)
- out.println("popFrameCls (" + this +
- "): enter activeMethod() after popping");
+ out.println("popFrameCls (" + this + "): enter activeMethod() after popping");
return;
}
try {
// notify the main thread
synchronized (popframe001.barrier) {
- if (DEBUG_MODE)
- out.println("popFrameCls (" + this +
- "): notifying main thread");
+ out.println("popFrameCls (" + this + "): notifying main thread");
popframe001.startingBarrier.unlock();
- if (DEBUG_MODE)
- out.println("popFrameCls (" + this +
- "): inside activeMethod()");
+ out.println("popFrameCls (" + this + "): inside activeMethod()");
}
// loop until the main thread pops us
int i = 0;
int n = 1000;
while (flag) {
< prev index next >