8285383: vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t001/hs204t001.java failed with "exit code: 96"

Reviewed-by: dcubed, lmesnik, sspitsyn
This commit is contained in:
Alex Menkov 2022-09-20 18:18:39 +00:00
parent 3b438a68ea
commit 21008cad46
8 changed files with 0 additions and 735 deletions

View File

@ -1,307 +0,0 @@
/*
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#include <stdio.h>
#include <jvmti.h>
#include "agent_common.h"
#include <jni.h>
#include <string.h>
#include "jni_tools.h"
#include "jvmti_tools.h"
extern "C" {
static JNIEnv* jni = NULL;
static jvmtiEnv *jvmti = NULL;
static jlong timeout = 0;
static jint testStep;
static jint redefineNumber;
static unsigned char* newClassBytes;
static unsigned char* path;
static jthread testedThread;
static jclass testClass;
static jclass myTestClass;
#define NAME "nsk/jvmti/scenarios/hotswap/HS204/hs204t001/hs204t001R"
#define CLASS_NAME "Lnsk/jvmti/scenarios/hotswap/HS204/hs204t001/hs204t001R;"
#define PATH_TO_NEW_BYTECODE "pathToNewByteCode"
#define FILE_NAME "nsk/jvmti/scenarios/hotswap/HS204/hs204t001/hs204t001R"
static jint newClassSize;
char *getClassName(jvmtiEnv *jvmti, jclass klass) {
char * className;
char * generic;
if (!NSK_JVMTI_VERIFY(jvmti->GetClassSignature(klass, &className, &generic))) {
nsk_jvmti_setFailStatus();
}
return className;
}
JNIEXPORT void JNICALL
callbackClassLoad(jvmtiEnv *jvmti_env,
JNIEnv* jni_env,
jthread thread,
jclass klass) {
char * name;
name = getClassName(jvmti_env,klass);
if ((strcmp(name,CLASS_NAME) == 0) && (redefineNumber == 1)) {
char fileName[512];
nsk_jvmti_getFileName(redefineNumber, FILE_NAME, fileName,
sizeof(fileName)/sizeof(char));
NSK_DISPLAY1(">>>>>>CallbackClassLoad ... Name=%s... >>\n",name);
if (nsk_jvmti_redefineClass(jvmti, klass, fileName)) {
NSK_DISPLAY0("\nMyClass :: Successfully redefined..\n");
redefineNumber++;
} else {
NSK_COMPLAIN0("\nMyClass :: Failed to redefine ..\n");
}
/* if ((myTestClass = jni_env->NewGlobalRef(klass)) == NULL) {
NSK_COMPLAIN0("Failed to create global ref...");
}
*/
}
}
JNIEXPORT void JNICALL
callbackClassPrepare(jvmtiEnv *jvmti_env,
JNIEnv* jni_env,
jthread thread,
jclass klass) {
char * name;
name = getClassName(jvmti_env, klass);
if ((strcmp(name, CLASS_NAME) == 0) && (redefineNumber == 0)) {
char fileName[512];
nsk_jvmti_getFileName(redefineNumber, FILE_NAME, fileName,
sizeof(fileName)/sizeof(char));
NSK_DISPLAY1(">>>>>>callbackClassPrepare ... Name=%s... >>\n",name);
if (nsk_jvmti_redefineClass(jvmti, klass, fileName)) {
NSK_DISPLAY0("\nMyClass :: Successfully redefined..\n");
redefineNumber++;
} else {
NSK_COMPLAIN0("\nMyClass :: Failed to redefine ..\n");
}
myTestClass = (jclass) jni_env->NewGlobalRef(klass);
if (myTestClass == NULL) {
NSK_COMPLAIN0("Failed to create global ref...");
}
}
}
JNIEXPORT void JNICALL
callbackClassFileLoadHock(jvmtiEnv *jvmti_env,
JNIEnv* jni_env,
jclass class_being_redefined,
jobject loader,
const char* name,
jobject protection_domain,
jint class_data_len,
const unsigned char* class_data,
jint* new_class_data_len,
unsigned char** new_class_data) {
if (name != NULL && strcmp(name, NAME) == 0 && (redefineNumber == 1)) {
NSK_DISPLAY1(">>>>>>callbackClassFileLoadHock ... Name=%s... >>\n",name);
/*redefineClass(jvmti_env, myTestClass);*/
}
}
JNIEXPORT void JNICALL
#ifdef STATIC_BUILD
Agent_OnUnload_hs204t001(JavaVM *jvm)
#else
Agent_OnUnload(JavaVM *jvm)
#endif
{
NSK_DISPLAY0(" VM ... Going Down.. (C/C++) \n");
return;
}
static void JNICALL agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) {
redefineNumber = 0;
jni = agentJNI;
testStep=1;
NSK_DISPLAY0("\n\n>>>> Debugge started, waiting for class loading \n");
jni->DeleteGlobalRef(testClass);
jni->DeleteGlobalRef(testedThread);
NSK_DISPLAY0("Waiting for debuggee to become ready\n");
if (!nsk_jvmti_waitForSync(timeout)) {
return;
}
testStep = 1;
NSK_DISPLAY0("\n\n>>>> Debugge started, waiting for class loading \n");
if (!nsk_jvmti_resumeSync())
return;
NSK_DISPLAY0("Waiting for debuggee's threads to finish\n");
if (!nsk_jvmti_waitForSync(timeout))
return;
jni->DeleteGlobalRef(testClass);
jni->DeleteGlobalRef(testedThread);
NSK_DISPLAY0("Let debuggee to finish\n");
if (!nsk_jvmti_resumeSync())
return;
}
#ifdef STATIC_BUILD
JNIEXPORT jint JNICALL Agent_OnLoad_hs204t001(JavaVM *jvm, char *options, void *reserved) {
return Agent_Initialize(jvm, options, reserved);
}
JNIEXPORT jint JNICALL Agent_OnAttach_hs204t001(JavaVM *jvm, char *options, void *reserved) {
return Agent_Initialize(jvm, options, reserved);
}
JNIEXPORT jint JNI_OnLoad_hs204t001(JavaVM *jvm, char *options, void *reserved) {
return JNI_VERSION_1_8;
}
#endif
jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) {
jint rc ;
NSK_DISPLAY0(" VM.. Started..\n");
rc=vm->GetEnv((void **)&jvmti, JVMTI_VERSION_1_1);
if (rc != JNI_OK) {
NSK_COMPLAIN0(" Could not load JVMTI interface \n");
} else {
/* Open simple block for better memor usage. */
jvmtiCapabilities caps;
memset(&caps, 0, sizeof(caps));
/*
set capabilities of
1.ClassFileLoadHock,
2.ClassLoad(doesn;t require any capabilities to set).
3.ClassPrepare (doesn;t require any capabilitiesto set).
4.Redefine (default).
5.PopFrame.
*/
caps.can_generate_all_class_hook_events=1;
caps.can_access_local_variables = 1;
caps.can_generate_single_step_events=1;
caps.can_redefine_classes = 1;
caps.can_suspend = 1;
caps.can_pop_frame=1;
caps.can_generate_all_class_hook_events=1;
jvmti->AddCapabilities(&caps);
/*
set the method and other functions..
*/
{
jvmtiEventCallbacks eventCallbacks;
memset(&eventCallbacks, 0, sizeof(eventCallbacks));
eventCallbacks.ClassLoad = callbackClassLoad;
eventCallbacks.ClassPrepare=callbackClassPrepare;
eventCallbacks.ClassFileLoadHook=callbackClassFileLoadHock;
rc=jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks));
if (rc != JVMTI_ERROR_NONE) {
NSK_COMPLAIN0("Error setting event callbacks");
return JNI_ERR;
}
}
{
nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_SINGLE_STEP, testedThread);
nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_LOAD, testedThread);
nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, testedThread);
nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, testedThread);
nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK,testedThread);
}
if (!nsk_jvmti_setAgentProc(agentProc, NULL)) {
NSK_COMPLAIN0("setAgentProc failed");
}
if (!nsk_jvmti_parseOptions(options)) {
NSK_COMPLAIN0("Cannot parse options");
}
NSK_DISPLAY1("Wait time: %d\n",nsk_jvmti_getWaitTime());
timeout=nsk_jvmti_getWaitTime();
NSK_DISPLAY1(" returning back.. enter timeout-->%d \n",timeout);
return JNI_OK;
}
// TODO: shouldn't we return JNI_ERR if GetEnv failed?
return JNI_OK;
}
JNIEXPORT void JNICALL
Java_nsk_jvmti_scenarios_hotswap_HS204_hs204t001_hs204t001_setThread(JNIEnv * env,
jclass klass,
jobject thread) {
NSK_DISPLAY0(" Inside the setThread Method");
if (!NSK_JNI_VERIFY(env, (testClass = (jclass) env->NewGlobalRef(klass)) != NULL))
nsk_jvmti_setFailStatus();
if (!NSK_JNI_VERIFY(env, (testedThread = env->NewGlobalRef(thread)) != NULL))
nsk_jvmti_setFailStatus();
}
JNIEXPORT jboolean JNICALL
Java_nsk_jvmti_scenarios_hotswap_HS204_hs204t001_hs204t001_suspendThread(JNIEnv * env,
jclass klass,
jobject thread) {
jint state;
NSK_DISPLAY0("---suspend thread .. \n");
if (jvmti->GetThreadState(thread, &state) == JVMTI_ERROR_NONE) {
NSK_DISPLAY0(" No Errors in finding state of the thread.\n");
if (state & JVMTI_THREAD_STATE_ALIVE) {
NSK_DISPLAY0(" Thread state is alive .. So can be suspend should be possible ..\n");
nsk_jvmti_disableNotification(jvmti, JVMTI_EVENT_SINGLE_STEP, thread);
if (!NSK_JVMTI_VERIFY(jvmti->SuspendThread(thread))) {
NSK_COMPLAIN0("TEST FAILED: unable to suspend the thread \n");
nsk_jvmti_setFailStatus();
return NSK_FALSE;
} else {
NSK_DISPLAY0(" Sucessfully suspended Thread..\n");
}
} else {
NSK_COMPLAIN0("Was not able to suspend a thread..\n");
return NSK_FALSE;
}
}
return NSK_TRUE;
}
JNIEXPORT jboolean JNICALL
Java_nsk_jvmti_scenarios_hotswap_HS204_hs204t001_hs204t001_popFrame(JNIEnv * env,
jclass klass,
jthread thread) {
jint state;
NSK_DISPLAY0("Inside pop_Frame method.....\n");
if (jvmti->GetThreadState(thread, &state) == JVMTI_ERROR_NONE) {
NSK_DISPLAY0(" Got the state of thread \n");
if (state & JVMTI_THREAD_STATE_SUSPENDED) {
NSK_DISPLAY0(" Thread is already in suspended mode..\n");
if (!NSK_JVMTI_VERIFY(jvmti->PopFrame(thread))) {
NSK_COMPLAIN0(" TEST FAILED: UNABLE TO POP FRAME \n");
nsk_jvmti_setFailStatus();
return NSK_FALSE;
} else {
NSK_DISPLAY0(" Poped frame safely..");
}
/* We should resume that thread for next execution.. */
if (!NSK_JVMTI_VERIFY(jvmti->ResumeThread(thread))) {
NSK_COMPLAIN0(" TEST FAILED: UNABLE TO Resume thread \n");
nsk_jvmti_setFailStatus();
return NSK_FALSE;
} else {
NSK_DISPLAY0(" Resumed.. thread for next set of executions...");
}
} else {
NSK_DISPLAY0(" Thread is not in Suspened State for poping its status..");
}
}
return NSK_TRUE;
}
}

View File

@ -1,115 +0,0 @@
/*
* Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
*
* @summary converted from VM Testbase nsk/jvmti/scenarios/hotswap/HS204/hs204t001.
* VM Testbase keywords: [jpda, jvmti, onload_only_caps, noras, redefine, feature_hotswap, quarantine]
* VM Testbase comments: 6813266
* VM Testbase readme:
* DESCRIPTION
* This test is for HS204 T001 scenario of "HotSwap class and pop frame".
* There are several java classes. First - hs204t001 - main class - is for redefinitions, running test thread and control
* results.
* All others - hs204t001R - are classes which are redefined and one of them is used to test popFrame feature.
* We enable events ClassFileLoadHook, ClassLoad, and ClassPrepare and popFrame feature.
* Then main class begins list of redefenitions in the following order:
* 1. After receiving ClassLoad event, native agent redefines the class being loaded (hs204t001R).
* 2. Waits for ClassFileLoadHook event from step 1 and redefines the class again
* 3. Catches ClassPrepare event from step 2 and redefines the class again
* 4. Receives ClassFileLoadHook event and makes another redefinition
* When all redefinitions have been done, we suspend the thread test class from Java code, invoke popFrame() and resume the test thread.
* This should result in doInThisThread() method executed for the second time.
* COMMENTS
*
* @library /vmTestbase
* /test/lib
* @build nsk.jvmti.scenarios.hotswap.HS204.hs204t001.hs204t001
*
* @comment compile newclassXX to bin/newclassXX
* @run driver nsk.share.ExtraClassesBuilder
* newclass02 newclass03 newclass01 newclass00
*
* @run main/othervm/native
* -agentlib:hs204t001=pathToNewByteCode=./bin,-waittime=5,package=nsk,samples=100,mode=compiled
* nsk.jvmti.scenarios.hotswap.HS204.hs204t001.hs204t001
*/
package nsk.jvmti.scenarios.hotswap.HS204.hs204t001;
import java.io.PrintStream;
import nsk.share.Log;
import nsk.share.Consts;
import nsk.share.jvmti.ArgumentHandler;
import nsk.share.jvmti.DebugeeClass;
import java.util.concurrent.atomic.AtomicBoolean;
public class hs204t001 extends DebugeeClass {
static int status = Consts.TEST_PASSED;
static Log log = null;
static native void setThread(Thread thread);
static native boolean suspendThread(Thread thread);
static native boolean popFrame(Thread thread);
public static void main(String[] args) {
args = nsk.share.jvmti.JVMTITest.commonInit(args);
System.exit(Consts.JCK_STATUS_BASE + run(args, System.out));
}
// redirecting for some of the testing models.
public static int run(String[] args , PrintStream out) {
return new hs204t001().runIt(args, out);
}
private int runIt(String[] args, PrintStream out) {
int iter;
ArgumentHandler argHandler = new ArgumentHandler(args);
int timeout = argHandler.findOptionIntValue("-waittime",10);
out.println("... timeout.. "+timeout);
out.println(".. Path "+argHandler.findOptionValue("pathToNewByteCode"));
// Logger was initialized.
log = new Log(out, argHandler);
out.println(" Testing started..");
hs204t001R t1;
t1= new hs204t001R() ;
setThread(t1);
t1.start();
int afterSuspend=0;
try {
while(!hs204t001R.suspend.get());
out.println(" State.."+t1.getIndex());
suspendThread(t1);
afterSuspend=t1.getIndex();
//System.out.println("after suspending the read contents of index ="+t1.data);
hs204t001R.run.set(false);
popFrame(t1);
// resume this thread.
t1.join();
} catch(InterruptedException ie) {
ie.printStackTrace();
}
log.display(" index == "+t1.getIndex());
out.println(" index ="+t1.getIndex());
return (t1.getIndex() == afterSuspend ? 0 : 1);
}
}

View File

@ -1,56 +0,0 @@
/*
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package nsk.jvmti.scenarios.hotswap.HS204.hs204t001;
import java.util.concurrent.atomic.AtomicBoolean;
public class hs204t001R extends Thread {
static public AtomicBoolean suspend = new AtomicBoolean(false);
static public AtomicBoolean run = new AtomicBoolean(true);
private int index=0;
public hs204t001R() {
setName("hs204t001R");
System.out.println("hs204t001R--NewOne");
}
public void run() {
System.out.println("Thread started");
doInThisThread();
System.out.println("Thread exiting");
}
private void doInThisThread() {
while(hs204t001R.run.get()) {
index+=10;
if (index == 1500) {
hs204t001R.suspend.set(true);
}
}
}
public int getIndex() {
return index;
}
}

View File

@ -1,33 +0,0 @@
/*
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#include "native_thread.cpp"
#include "nsk_tools.cpp"
#include "jni_tools.cpp"
#include "jvmti_tools.cpp"
#include "agent_tools.cpp"
#include "jvmti_FollowRefObjects.cpp"
#include "Injector.cpp"
#include "JVMTITools.cpp"
#include "agent_common.cpp"
#include "hs204t001.cpp"

View File

@ -1,56 +0,0 @@
/*
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package nsk.jvmti.scenarios.hotswap.HS204.hs204t001;
import java.util.concurrent.atomic.AtomicBoolean;
public class hs204t001R extends Thread {
static public AtomicBoolean suspend = new AtomicBoolean(false);
static public AtomicBoolean run = new AtomicBoolean(true);
private int index=0;
public hs204t001R() {
setName("hs204t001R");
System.out.println("hs204t001R");
}
public void run() {
System.out.println(" started running thread..");
doInThisThread();
System.out.println(" comming out ..");
}
private void doInThisThread() {
System.out.println("... Inside doThisThread..");
while(hs204t001R.run.get()) {
index+=10;
if (index == 1500) {
hs204t001R.suspend.set(true);
}
}
}
public int getIndex() {
return index;
}
}

View File

@ -1,57 +0,0 @@
/*
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package nsk.jvmti.scenarios.hotswap.HS204.hs204t001;
import java.util.concurrent.atomic.AtomicBoolean;
public class hs204t001R extends Thread{
static public AtomicBoolean suspend = new AtomicBoolean(false);
static public AtomicBoolean run = new AtomicBoolean(true);
private int index=0;
public hs204t001R() {
super();
setName("hs204t001R");
System.out.println("NEWCLASS01") ;
}
public void run() {
System.out.println(" started running thread..");
doInThisThread();
System.out.println(" comming out ..");
}
private void doInThisThread() {
System.out.println("... Inside doThisThread..");
while(hs204t001R.run.get()) {
index+=1;
if (index == 1500) {
hs204t001R.suspend.set(true);
}
}
}
public int getIndex() {
return index;
}
}

View File

@ -1,55 +0,0 @@
/*
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package nsk.jvmti.scenarios.hotswap.HS204.hs204t001;
import java.util.concurrent.atomic.AtomicBoolean;
public class hs204t001R extends Thread{
static public AtomicBoolean suspend = new AtomicBoolean(false);
static public AtomicBoolean run = new AtomicBoolean(true);
private int index=0;
public hs204t001R() {
super();
setName("hs204t001R");
System.out.println("NEWCLASS02");
}
public void run() {
System.out.println(" started running thread..");
doInThisThread();
System.out.println(" comming out ..");
}
private void doInThisThread() {
System.out.println("... Inside doThisThread..");
while(hs204t001R.run.get()) {
index+=1;
if (index == 1500) {
hs204t001R.suspend.set(true);
}
}
}
public int getIndex() {
return index;
}
}

View File

@ -1,56 +0,0 @@
/*
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package nsk.jvmti.scenarios.hotswap.HS204.hs204t001;
import java.util.concurrent.atomic.AtomicBoolean;
public class hs204t001R extends Thread{
static public AtomicBoolean suspend = new AtomicBoolean(false);
static public AtomicBoolean run = new AtomicBoolean(true);
private int index=0;
public hs204t001R() {
super();
setName("hs204t001R");
System.out.println("NEWCLASS04");
}
public void run() {
System.out.println(" started running thread..");
doInThisThread();
System.out.println(" comming out ..");
}
private void doInThisThread() {
System.out.println("... Inside doThisThread..");
while(hs204t001R.run.get()) {
index+=1;
if (index == 1500) {
hs204t001R.suspend.set(true);
}
}
}
public int getIndex() {
return index;
}
}