8315486: vmTestbase/nsk/jdwp/ThreadReference/ForceEarlyReturn/forceEarlyReturn002/forceEarlyReturn002.java timed out
Reviewed-by: cjplummer, lmesnik
This commit is contained in:
parent
ef49e6c0d7
commit
041510dc21
test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/ForceEarlyReturn/forceEarlyReturn002
@ -139,13 +139,34 @@ public class forceEarlyReturn002 extends TestDebuggerType1 {
|
||||
}
|
||||
}
|
||||
|
||||
// get thread ID for "startNewThread" command
|
||||
private long getNewThreadId() throws Exception {
|
||||
final String debugeeClassSig = "L" + getDebugeeClassName().replace('.', '/') + ";";
|
||||
log.display(" getting classID for " + debugeeClassSig);
|
||||
long classID = debuggee.getReferenceTypeID(debugeeClassSig);
|
||||
log.display(" got classID: " + classID);
|
||||
|
||||
log.display(" getting testNewThread field value");
|
||||
JDWP.Value value = debuggee.getStaticFieldValue(classID, "testNewThread", JDWP.Tag.THREAD);
|
||||
|
||||
long threadID = ((Long)value.getValue()).longValue();
|
||||
log.display(" got threadID: " + threadID);
|
||||
return threadID;
|
||||
}
|
||||
|
||||
private int createThreadStartEventRequest() {
|
||||
try {
|
||||
long newThreadId = getNewThreadId();
|
||||
// create command packet and fill requred out data
|
||||
CommandPacket command = new CommandPacket(JDWP.Command.EventRequest.Set);
|
||||
command.addByte(JDWP.EventKind.THREAD_START);
|
||||
command.addByte(JDWP.SuspendPolicy.ALL);
|
||||
command.addInt(0);
|
||||
// we want the THREAD_START event only for the test thread
|
||||
// and not any others that might be started by debuggee VM,
|
||||
// so add THREAD_ONLY modifier
|
||||
command.addInt(1);
|
||||
command.addByte(JDWP.EventModifierKind.THREAD_ONLY);
|
||||
command.addObjectID(newThreadId);
|
||||
command.setLength();
|
||||
|
||||
transport.write(command);
|
||||
@ -175,7 +196,7 @@ public class forceEarlyReturn002 extends TestDebuggerType1 {
|
||||
Value value;
|
||||
|
||||
value = new Value(JDWP.Tag.INT, 0);
|
||||
// create command with invalid trheadID, expect INVALID_OBJECT error
|
||||
// create command with invalid threadID, expect INVALID_OBJECT error
|
||||
sendCommand(-1, value, true, JDWP.Error.INVALID_OBJECT);
|
||||
|
||||
// create StateTestThread
|
||||
|
@ -57,14 +57,7 @@ public class forceEarlyReturn002a extends AbstractJDWPDebuggee {
|
||||
|
||||
return true;
|
||||
} else if (command.equals(COMMAND_START_NEW_THREAD)) {
|
||||
Thread thread = new Thread(new Runnable() {
|
||||
public void run() {
|
||||
log.display("Thread exit");
|
||||
}
|
||||
});
|
||||
|
||||
thread.setName("forceEarlyReturn002a_NewThread");
|
||||
thread.start();
|
||||
testNewThread.start();
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -72,6 +65,21 @@ public class forceEarlyReturn002a extends AbstractJDWPDebuggee {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void init(String args[]) {
|
||||
super.init(args);
|
||||
|
||||
// create thread for "NewThread" command in advance
|
||||
testNewThread = new Thread(new Runnable() {
|
||||
public void run() {
|
||||
log.display("Thread exit");
|
||||
}
|
||||
});
|
||||
testNewThread.setName("forceEarlyReturn002a_NewThread");
|
||||
}
|
||||
|
||||
private static Thread testNewThread;
|
||||
|
||||
private Thread testThreadInNative;
|
||||
|
||||
private void stopThreadInNative() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user