127
128 /** Agent library initialization. */
129 #ifdef STATIC_BUILD
130 JNIEXPORT jint JNICALL Agent_OnLoad_threadend002(JavaVM *jvm, char *options, void *reserved) {
131 return Agent_Initialize(jvm, options, reserved);
132 }
133 JNIEXPORT jint JNICALL Agent_OnAttach_threadend002(JavaVM *jvm, char *options, void *reserved) {
134 return Agent_Initialize(jvm, options, reserved);
135 }
136 JNIEXPORT jint JNI_OnLoad_threadend002(JavaVM *jvm, char *options, void *reserved) {
137 return JNI_VERSION_1_8;
138 }
139 #endif
140 jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
141
142 if (!NSK_VERIFY(nsk_jvmti_parseOptions(options)))
143 return JNI_ERR;
144
145 timeout = nsk_jvmti_getWaitTime() * 60 * 1000;
146
147 if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL))
148 return JNI_ERR;
149
150 if (!setCallBacks()) {
151 return JNI_ERR;
152 }
153
154 if (!enableEvent(JVMTI_ENABLE, JVMTI_EVENT_THREAD_END)) {
155 NSK_COMPLAIN0("Events could not be enabled");
156 nsk_jvmti_setFailStatus();
157 return JNI_ERR;
158 }
159
160 if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL)))
161 return JNI_ERR;
162
163 return JNI_OK;
164 }
165
166 }
|
127
128 /** Agent library initialization. */
129 #ifdef STATIC_BUILD
130 JNIEXPORT jint JNICALL Agent_OnLoad_threadend002(JavaVM *jvm, char *options, void *reserved) {
131 return Agent_Initialize(jvm, options, reserved);
132 }
133 JNIEXPORT jint JNICALL Agent_OnAttach_threadend002(JavaVM *jvm, char *options, void *reserved) {
134 return Agent_Initialize(jvm, options, reserved);
135 }
136 JNIEXPORT jint JNI_OnLoad_threadend002(JavaVM *jvm, char *options, void *reserved) {
137 return JNI_VERSION_1_8;
138 }
139 #endif
140 jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
141
142 if (!NSK_VERIFY(nsk_jvmti_parseOptions(options)))
143 return JNI_ERR;
144
145 timeout = nsk_jvmti_getWaitTime() * 60 * 1000;
146
147 jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved);
148 if (!NSK_VERIFY(jvmti != NULL))
149 return JNI_ERR;
150
151 if (!setCallBacks()) {
152 return JNI_ERR;
153 }
154
155 if (!enableEvent(JVMTI_ENABLE, JVMTI_EVENT_THREAD_END)) {
156 NSK_COMPLAIN0("Events could not be enabled");
157 nsk_jvmti_setFailStatus();
158 return JNI_ERR;
159 }
160
161 if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL)))
162 return JNI_ERR;
163
164 return JNI_OK;
165 }
166
167 }
|