• Home
  • Raw
  • Download

Lines Matching full:jvm

54     JavaVM *jvm = user_data;  in s_detach_jvm_from_thread()  local
56 /* we don't need this JNIEnv, but this is an easy way to verify the JVM is still valid to use */ in s_detach_jvm_from_thread()
58 JNIEnv *env = aws_jni_acquire_thread_env(jvm); in s_detach_jvm_from_thread()
60 (*jvm)->DetachCurrentThread(jvm); in s_detach_jvm_from_thread()
62 aws_jni_release_thread_env(jvm, env); in s_detach_jvm_from_thread()
67 static JNIEnv *s_aws_jni_get_thread_env(JavaVM *jvm) { in s_aws_jni_get_thread_env() argument
73 if ((*jvm)->GetEnv(jvm, (void **)&env, JNI_VERSION_1_6) == JNI_EDETACHED) { in s_aws_jni_get_thread_env()
94 jint result = (*jvm)->AttachCurrentThreadAsDaemon(jvm, &env, &attach_args); in s_aws_jni_get_thread_env()
96 jint result = (*jvm)->AttachCurrentThreadAsDaemon(jvm, (void **)&env, &attach_args); in s_aws_jni_get_thread_env()
107 /* This should only happen in event loop threads, the JVM main thread attachment is in s_aws_jni_get_thread_env()
108 * managed by the JVM, so we only need to clean up event loop thread attachments */ in s_aws_jni_get_thread_env()
109 …_FATAL_ASSERT(AWS_OP_SUCCESS == aws_thread_current_at_exit(s_detach_jvm_from_thread, (void *)jvm)); in s_aws_jni_get_thread_env()
116 A simple system to support unpredictable JVM shutdowns. In an ideal world, everyone would correctl…
118 them correctly, that's not a realistic expectation. So we need to come up with a way for JVM shutd…
120 on the binding object is now garbage) after the JVM has shutdown (but before the process has killed…
126 … or zero for now). We protect this set with a read-write lock. Adding (CRT init) or removing (JVM
127 shutdown hook) a JVM from this set will take a write lock. Acquiring a JNIEnv from a tracked JVM, …
130 Acquiring a JNIEnv succeeds if the JVM in question is in our set, and fails otherwise. All users o…
140 read locks on a shared rw lock. Only when the JVM shutdown hook calls into native is there read-wr…
156 JavaVM *jvm = NULL; in s_jvm_table_add_jvm_for_env() local
157 jint jvmresult = (*env)->GetJavaVM(env, &jvm); in s_jvm_table_add_jvm_for_env()
158 AWS_FATAL_ASSERT(jvmresult == 0 && jvm != NULL); in s_jvm_table_add_jvm_for_env()
161 AWS_FATAL_ASSERT(AWS_OP_SUCCESS == aws_hash_table_put(s_jvms, jvm, NULL, &was_created)); in s_jvm_table_add_jvm_for_env()
174 JavaVM *jvm = NULL; in s_jvm_table_remove_jvm_for_env() local
175 jint jvmresult = (*env)->GetJavaVM(env, &jvm); in s_jvm_table_remove_jvm_for_env()
176 AWS_FATAL_ASSERT(jvmresult == 0 && jvm != NULL); in s_jvm_table_remove_jvm_for_env()
178 AWS_FATAL_ASSERT(AWS_OP_SUCCESS == aws_hash_table_remove(s_jvms, jvm, NULL, NULL)); in s_jvm_table_remove_jvm_for_env()
191 JNIEnv *aws_jni_acquire_thread_env(JavaVM *jvm) { in aws_jni_acquire_thread_env() argument
194 …* lock already, the JVM shutdown hooks causes another thread to block on taking the write lock, an… in aws_jni_acquire_thread_env()
196 * but since the JVM is going away, it's safe to just fail completely from here on out. in aws_jni_acquire_thread_env()
211 int find_result = aws_hash_table_find(s_jvms, jvm, &element); in aws_jni_acquire_thread_env()
217 JNIEnv *env = s_aws_jni_get_thread_env(jvm); in aws_jni_acquire_thread_env()
232 void aws_jni_release_thread_env(JavaVM *jvm, JNIEnv *env) { in aws_jni_release_thread_env() argument
233 (void)jvm; in aws_jni_release_thread_env()
467 "Attempt to use a JVM that has already been destroyed"),
470 "OutOfMemoryError has been raised from JVM."),