tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_worker_jni.c
Date Fri, 05 Jul 2002 08:09:37 GMT
mturk       2002/07/05 01:09:37

  Modified:    jk/native2/common jk_worker_jni.c
  Log:
  Do not detach the jvm on init, cause both Apache and IIS
  have the main thread now.
  Wait for TomcatStarter to signal the stop event and
  then unregister natives and destroy the jvm.
  
  Revision  Changes    Path
  1.24      +18 -8     jakarta-tomcat-connectors/jk/native2/common/jk_worker_jni.c
  
  Index: jk_worker_jni.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_worker_jni.c,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- jk_worker_jni.c	2 Jul 2002 12:06:46 -0000	1.23
  +++ jk_worker_jni.c	5 Jul 2002 08:09:37 -0000	1.24
  @@ -67,6 +67,10 @@
   #include "jk_env.h"
   #include "jk_bean.h"
   
  +#ifdef HAS_APR
  +#include "apr_thread_proc.h"
  +#endif
  +
   #ifdef HAVE_JNI
   
   #include "jk_vm.h"
  @@ -74,6 +78,7 @@
   #include <jni.h>
   
   extern jint jk_jni_aprImpl_registerNatives(JNIEnv *, jclass);
  +extern int jk_jni_status_code;
   
   /* default only, will be  configurable  */
   #define JAVA_BRIDGE_CLASS_NAME ("org/apache/jk/apr/TomcatStarter")
  @@ -334,9 +339,12 @@
                                       jniWorker->jk_java_bridge_class,
                                       jniWorker->jk_main_method,
                                       jargs);
  -    
  +#if 0
  +    /* Do not detach the main thread.
  +     * It will be detached on destroy
  +     */
       vm->detach(env, vm);
  -
  +#endif
       /* XXX create a jni channel */
       return JK_OK;
   }
  @@ -379,17 +387,19 @@
           env->l->jkLog(env, env->l, JK_LOG_INFO,
                         "jni.destroy() calling main()...\n");
   
  +        jk_jni_status_code =0;
           (*jniEnv)->CallStaticVoidMethod(jniEnv,
                                       jniWorker->jk_java_bridge_class,
                                       jniWorker->jk_main_method,
                                       jargs,stdout_name,stderr_name);
  -#if 0
  -        /* XXX  Need to fix the TomcatStarter not calling jkSetAttribute
  -         *      and call the destroy JVM on that event.
  -         *      Perhaps the DestroyJavaVM is not needed at all.
  -         */
  -        vm->destroy(env, vm);
  +#ifdef HAS_APR
  +        while (jk_jni_status_code != 2) {
  +            apr_thread_yield();
  +        }
   #endif
  +        (*jniEnv)->UnregisterNatives(jniEnv, jniWorker->jk_java_bridge_apri_class);
  +
  +        vm->destroy(env, vm);
       }
       env->l->jkLog(env, env->l, JK_LOG_INFO, "jni.destroy() done\n");
   
  
  
  

--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message