6545967: sp05t003 failed ResumeThread() due to THREAD_NOT_SUSPENDED

Reviewed-by: cjplummer, sspitsyn
This commit is contained in:
Gary Adams 2018-06-20 13:57:38 -04:00
parent 07012c9753
commit dfe4aabde4
2 changed files with 18 additions and 15 deletions

View File

@ -77,29 +77,32 @@ public class hs203t003 extends RedefineAgent {
}
public boolean agentMethod() {
public boolean agentMethod() {
boolean passed = false;
MyThread mt = new MyThread();
try {
try {
mt.start();
// check if we can can pop the thread.
// we can not do redefine / pop frame on run method.
while(!MyThread.resume.get());
Thread.sleep(10000);
// we can not do redefine/pop frame on run method.
while (!MyThread.resume.get());
// sleep for some few secs to get redefined.
popThreadFrame(mt);
// pop the frame.
resumeThread(mt);
// resume the thread.
while (!isRedefined()) {
if (!agentStatus()) {
System.out.println("Failed to redefine class");
return passed;
}
Thread.sleep(100);
}
popThreadFrame(mt); // pop the frame.
resumeThread(mt); // resume the thread.
mt.join();
// wait till the other thread completes its execution.
System.out.println(" Thread state after poping / redefining = "+mt.threadState);
System.out.println("Thread state after popping/redefining = "
+ mt.threadState);
} catch(Exception ie) {
ie.printStackTrace();
}
if ( ( mt.threadState < 1000 ) &&
( redefineAttempted() && isRedefined()) &&
agentStatus() ) {
if ((mt.threadState < 1000) && agentStatus()) {
passed = true;
}
return passed;

View File

@ -383,7 +383,6 @@ callbackThreadStart(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) {
for (i = 0; i < THREADS_COUNT; i++) {
if (NSK_CPP_STUB3(IsSameObject, jni, threadsList[i], thread)) {
NSK_DISPLAY0("SUCCESS: expected THREAD_START event\n");
eventsStart++;
/* suspend thread */
NSK_DISPLAY3(" suspend starting thread #%d (%s): %p\n",
@ -394,6 +393,7 @@ callbackThreadStart(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) {
nsk_jvmti_setFailStatus();
return;
}
eventsStart++;
break;
}
@ -418,7 +418,6 @@ callbackThreadEnd(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) {
for (i = 0; i < THREADS_COUNT; i++) {
if (NSK_CPP_STUB3(IsSameObject, jni, threadsList[i], thread)) {
NSK_DISPLAY0("SUCCESS: expected THREAD_END event\n");
eventsEnd++;
/* suspend thread */
NSK_DISPLAY3(" suspend finishing thread #%d (%s): %p\n",
@ -429,6 +428,7 @@ callbackThreadEnd(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) {
nsk_jvmti_setFailStatus();
return;
}
eventsEnd++;
break;
}