Skip to Main Content

Java HotSpot Virtual Machine

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JVM Threads vs. native threads vs. JNI

843829Sep 29 2009 — edited Oct 1 2009
Dears,

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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 29 2009
Added on Sep 29 2009
9 comments
893 views