You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by mt...@apache.org on 2002/11/06 17:32:26 UTC
cvs commit: jakarta-tomcat-connectors/jk/native2/common jk_worker_jni.c jk_vm_default.c jk_channel_jni.c
mturk 2002/11/06 08:32:25
Modified: jk/native2/common jk_worker_jni.c jk_vm_default.c
jk_channel_jni.c
Log:
Fix the JNI disabling for multi-process servers, moving disabled from
factory to the init.
Also, check if the JVM aborted.
Revision Changes Path
1.33 +9 -9 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.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- jk_worker_jni.c 31 Oct 2002 11:55:36 -0000 1.32
+++ jk_worker_jni.c 6 Nov 2002 16:32:25 -0000 1.33
@@ -234,6 +234,15 @@
return JK_ERR;
}
+ /* Allow only the first child to execute the worker */
+ if (_this->workerEnv->childId != 0) {
+ env->l->jkLog(env, env->l, JK_LOG_INFO,
+ "workerJni.Init() Skipping initialization for the %d %d\n",
+ _this->workerEnv->childId,
+ _this->workerEnv->childProcessId);
+ return JK_ERR;
+ }
+
props=_this->workerEnv->initData;
jniWorker = _this->worker_private;
@@ -462,15 +471,6 @@
}
wEnv = env->getByName( env, "workerEnv" );
- /* Allow only the first child to execute the worker */
- if (wEnv->childId != 0) {
- env->l->jkLog(env, env->l, JK_LOG_INFO,
- "workerJni.factory() Skipping initialization for the %d %d\n",
- wEnv->childId, wEnv->childProcessId);
- result->disabled = 1;
- return JK_OK;
- }
-
/* No singleton - you can have multiple jni workers,
running different bridges or starting different programs inprocess*/
1.27 +9 -4 jakarta-tomcat-connectors/jk/native2/common/jk_vm_default.c
Index: jk_vm_default.c
===================================================================
RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_vm_default.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- jk_vm_default.c 31 Oct 2002 11:55:36 -0000 1.26
+++ jk_vm_default.c 6 Nov 2002 16:32:25 -0000 1.27
@@ -193,14 +193,18 @@
{
jk2_jni_error_signaled = JK_TRUE;
jk2_jni_error_code = code;
-
+
+#ifdef DEBUG
fprintf(stderr, "JVM error hook called %d\n", code);
+#endif
}
static void jk2_jni_abort_hook()
{
jk2_jni_abort_signaled = JK_TRUE;
+#ifdef DEBUG
fprintf(stderr, "JVM abort hook\n");
+#endif
}
/** Load the VM. Must be called after init.
@@ -276,7 +280,8 @@
int err;
JavaVM *jvm = (JavaVM *)jkvm->jvm;
- if( jvm == NULL ) return NULL;
+ if (jvm == NULL || jk2_jni_abort_signaled)
+ return NULL;
#if defined LINUX && defined APACHE2_SIGHACK
/* [V] This message is important. If there are signal mask issues, *
@@ -324,7 +329,7 @@
int err;
JavaVM *jvm = (JavaVM *)jkvm->jvm;
- if( jvm == NULL ) {
+ if (jvm == NULL || jk2_jni_abort_signaled) {
return;
}
@@ -608,7 +613,7 @@
int err;
JavaVM *jvm = (JavaVM *)jkvm->jvm;
- if( jvm == NULL ) {
+ if (jvm == NULL || jk2_jni_abort_signaled) {
return;
}
1.37 +5 -5 jakarta-tomcat-connectors/jk/native2/common/jk_channel_jni.c
Index: jk_channel_jni.c
===================================================================
RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_channel_jni.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- jk_channel_jni.c 31 Oct 2002 11:55:36 -0000 1.36
+++ jk_channel_jni.c 6 Nov 2002 16:32:25 -0000 1.37
@@ -129,6 +129,11 @@
jk_channel_t *jniW=jniWB->object;
jk_workerEnv_t *wEnv=jniW->workerEnv;
+ if (wEnv->childId != 0) {
+ if( jniW->worker != NULL )
+ jniW->worker->mbean->disabled=JK_TRUE;
+ return JK_ERR;
+ }
if( wEnv->vm == NULL ) {
env->l->jkLog(env, env->l, JK_LOG_INFO,
"channel_jni.init() no VM found\n" );
@@ -628,11 +633,6 @@
wEnv = env->getByName( env, "workerEnv" );
- if (wEnv->childId != 0) {
- result->disabled = 1;
- return JK_OK;
- }
-
ch=(jk_channel_t *)pool->calloc(env, pool, sizeof( jk_channel_t));
ch->recv= jk2_channel_jni_recv;
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>