You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by co...@apache.org on 2002/06/10 23:27:39 UTC
cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_worker_jni.c
costin 2002/06/10 14:27:39
Modified: jk/native2/common jk_worker_jni.c
Log:
Second part of the patch.
Revision Changes Path
1.16 +27 -2 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.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- jk_worker_jni.c 16 May 2002 23:48:27 -0000 1.15
+++ jk_worker_jni.c 10 Jun 2002 21:27:39 -0000 1.16
@@ -71,7 +71,9 @@
#include "jk_vm.h"
#include "jk_registry.h"
-#include "jni.h"
+#include <jni.h>
+
+extern jint jk_jni_aprImpl_registerNatives(JNIEnv *, jclass);
/* default only, will be configurable */
#define JAVA_BRIDGE_CLASS_NAME ("org/apache/jk/apr/TomcatStarter")
@@ -88,7 +90,6 @@
typedef struct jni_worker_data jni_worker_data_t;
-
/** -------------------- Startup -------------------- */
/** Static methods - much easier...
@@ -166,6 +167,7 @@
char *str_config = NULL;
jk_map_t *props=_this->workerEnv->initData;
jk_vm_t *vm=_this->workerEnv->vm;
+ jclass aprImplClass;
jclass jstringClass;
jarray jargs;
int i=0;
@@ -228,6 +230,29 @@
env->l->jkLog(env, env->l, JK_LOG_INFO,
"Loaded %s\n", jniWorker->className);
+/* Instead of loading mod_jk2.so from java, use the JNI RegisterGlobals.
+ XXX Need the way to customize JAVA_BRIDGE_CLASS_APRI, but since
+ it's hardcoded in JniHandler.java doesn't matter for now.
+*/
+ aprImplClass =
+ (*jniEnv)->FindClass(jniEnv, JAVA_BRIDGE_CLASS_APRI );
+
+ if( aprImplClass == NULL ) {
+ env->l->jkLog(env, env->l, JK_LOG_ERROR,
+ "Can't find class %s\n", JAVA_BRIDGE_CLASS_APRI );
+ /* [V] the detach here may segfault on 1.1 JVM... */
+ vm->detach(env, vm);
+ return JK_ERR;
+ }
+ rc = jk_jni_aprImpl_registerNatives( jniEnv, aprImplClass);
+
+ if( rc != 0) {
+ env->l->jkLog(env, env->l, JK_LOG_ERROR,
+ "Can't register native functions for %s \n", JAVA_BRIDGE_CLASS_APRI );
+ vm->detach(env, vm);
+ return JK_ERR;
+ }
+
rc=jk2_get_method_ids(env, jniWorker, jniEnv);
if( rc!=JK_OK ) {
env->l->jkLog(env, env->l, JK_LOG_EMERG,
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>