989018 wrote:huh? i'm saying that the jvm invoking native code is exactly the same as a C program invoking the code. anything that could happen in the C program could happen in the jvm invoked JNI program. the jvm is not using some other magical version of system threads which are different than the system threads used by a C program.
Not necessarily true. From a C program, a single threaded app is really single threaded. But using JVM via JNI, even though we write a single threaded JAVA app, it is still running in a multithreaded env, right?
What I suspect is that the Java App is preempted in the middle of the execution when it is waiting for the server reply, and it is loaded back later. Since the JVM owns 9 threads, for some unknown reason, it is loaded back into a different thread. On the other hand, this won't happen in the C program case, right? The process has only one thread. Even if it is preempted for any reason, it can only be loaded back to the exact same thread.
gimbal2 wrote:not on any jvm that i am aware of. most modern jvms use native threads. back in the day, the sun jvm had a "green threads" option where each "java thread" was not necessarily tied to a specific native thread, however i don't think that exists anymore. dunno if there are any other jvm impls which do this sort of thing, but certainly not the oracle/openjdk jvm.
I'm no expert by far, but I get the nagging feeling that this is actually related to multicore execution. To the outside world a Java program can be single threaded, but under the hood it may very well be that multiple (native) threads are employed to optimize for multicore execution.
But I'm -really- making wild guesses here, I have no reference at all to back that up.
989018 wrote:Why not execute your C++ program from directly from the OS and see if the problem goes away. My guess is that it won't go away and therefore the problem has nothing to do with java.
We can't reproduce the problem locally. Our customer is using jdk_1.6.0_35 that came with the WebLogic installation. We don't have WebLogic, and we use jse_1.6.0_35 in our local test. Are those two very different?