Question on checking JNIEnv validity

don rhummy <[email protected]> Fri, 18 Apr 2008 15:16:17 -0700
Newsgroups gmane.comp.windows.devel.java.advanced
Message-ID <[email protected]>
I am building some C++ classes that will be used by
other people. These classes work with JNI and can be
used in multiple threads (C++ created, not in Java). I
know this means that each thread created needs to get
a valid JNIEnv from the JavaVM.

The problem is that AttachCurrentThread is, I'm
guessing, quite an expensive call. So I want to "know"
when to call it. However, I can't seem to find a
function to tell me if the JNIEnv is valid or not. For
example a function such as EnvIsValid(JavaVM* vm,
JNIEnv* env). Is there a way to tell if the current
JNIEnv is valid without having to reload it?

Thanks!

Don


      ____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com