JVM Threads vs. native threads vs. JNI
843829Sep 29 2009 — edited Oct 1 2009Dears,
I need to call from Java code subsequently native methods (JNI), but the requirement is that they are called in the same native thread. By native thread I mean the Operating System thread. Can I rely on that the JVM thread will be scheduled with the same native thread? Is it defined somehow? If not, cannot I ensure that by synchronizing of block of code?
The reason is that an API I want to call is Thread Local Storage sensitive. It is Windows impersonation. I would like to avoid duplicating of native methods in JNI - a typical and an impersonation versions. Any thoughts and/or suggestions?
Thanks in advance
Bronislav Gabrhelik