c++ - Can i call multiple times JNI_CreateJavaVM? -
I am trying to call two threads witch "DispFrontEnd" function first thread ended, failing to start another JVM Stayed .. ??
tks
#include "jni.h" #include & lt; Process.h & gt; #include "Stdafx.h" // DISPATCH check the check bool DispatchThreadCreated = FALSE; If (Dispatchart cutted == wrong) {Handle HD spread; HDispThread = (handle) _biginthread (DispFrontEnd, 0, (zero *) transmission input); If ((long) HDIPPathread == -1) {log.LogError ("Thread Disp frontend returns ******** bg", (long) hdpritread); Log.LogError ("errno", errno); Log.LogError ("_ doserrno", _doserrno); } And {logloc-> LogMethod ("Dispatch Thread Created"); DispatchThreadCreated = TRUE; // aspara que a thread terminal WaitForSingleObject (hDispThread, INFINITE); DispatchThreadCreated = FALSE; // 01_02_2010 logloc-> LogMethod ("Dispatch thread ENDED"); }} If (DispatchtraredCrited == incorrect) {Handle HD Spreadread 3; Logloc-> LogMethod ("3: Dispatch Thread Created"); HDispThread3 = (handle) _biginthread (disprintand, 0, (zero *) dispatch input); If ((long) HDKTTrade 3 == -1) {log.LogError ("3: Return to DispFrontEnd ******** BG", (long) HDScreadred 3); Log.LogError ("errno", errno); Log.LogError ("_ doserrno", _doserrno); } Other {logloc-> Lodge Method ("3: Dispatch Thread Created"); DispatchThreadCreated = TRUE; // Aspera Q One Thread Terminal WaitForSingleObject (hDispThread3, INFINITE); DispatchThreadCreated = FALSE; // 01_02_2010 logloc-> LogMethod ("3: Dispatch thread ENDED"); }} Zero DispFrontEnd (zero * inder) {JNIEnv * env; JavaVM * jvm; Env = create_vm (& amp; jvm); // Tap back on second call ??? } JNIEnv * create_vm (JavaWime ** jvm) {CString str; JNIEnv * env; JavaVMInitArgs vm_args; JavaVMOption option; Options.optionString = "-Djava.class.path = C: \\ Sending \\ lib \\ Run.jar; C: \\ Sending \\ sections"; // Path to Java Source Code vm_args.version = JNI_VERSION_1_6; // JDK version This version indicates 1.6 vm_args.nOptions = 1; Vm_args.options = More options; Vm_args.ignoreUnrecognized = 0; Int rate = JNIKerezWam (JVM, (NIL **) and NV, and VM_ORG); If (Rate End Lt; 0) {env = NULL; Str.Format ("Error! Create JVM, (% d)", ret); // Show it on another call! ? Logloc-> Logmath (str); } Other {str.Format ("JVM% x successfully created!", Env-> GetVersion ()); Logloc-> Logmath (str); } Return env; }
Do you really want to start several JVMs? Can you use - GIT attack content thread (JavaWam * VM, JNIANew ** p_env, zero * thr_args); instead of this?
The only thing I know is that an original thread can not attach two separate JVMs at the same time.
Comments
Post a Comment