mturk 2002/10/31 03:55:36
Modified: jk/native2/common jk_worker_jni.c jk_vm_default.c
jk_channel_jni.c
Log:
Fix the disabling of the JNI in the multiprocess servers.
Question: Can we disable the JNI if there is more then one child process?
Revision Changes Path
1.32 +14 -24 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.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- jk_worker_jni.c 26 Oct 2002 14:46:28 -0000 1.31
+++ jk_worker_jni.c 31 Oct 2002 11:55:36 -0000 1.32
@@ -233,17 +233,6 @@
"workerJni.init() No VM found\n");
return JK_ERR;
}
- /* XXX Allow only the first child to execute the worker
- * The WM will be shared between processes.
- */
- if (_this->workerEnv->childId != 0) {
- env->l->jkLog(env, env->l, JK_LOG_INFO,
- "workerJni.init() Skipping initialization for process %d
%d\n",
- _this->workerEnv->childId, _this->workerEnv->childProcessId);
-
- _this->lb_disabled = JK_TRUE;
- return JK_OK;
- }
props=_this->workerEnv->initData;
jniWorker = _this->worker_private;
@@ -414,17 +403,6 @@
return JK_ERR;
}
- /* XXX Allow only the first child to execute the worker
- * The WM will be shared between processes.
- */
- if (_this->workerEnv->childId != 0) {
- env->l->jkLog(env, env->l, JK_LOG_INFO,
- "workerJni.init() Skipping destroying for process %d %d\n",
- _this->workerEnv->childId, _this->workerEnv->childProcessId);
-
- return JK_OK;
- }
-
jniWorker = _this->worker_private;
if (jniWorker->hook < JK2_WORKER_HOOK_CLOSE) {
@@ -475,13 +453,25 @@
{
jk_worker_t *_this;
jni_worker_data_t *jniData;
-
+ jk_workerEnv_t *wEnv;
+
if(name==NULL) {
env->l->jkLog(env, env->l, JK_LOG_EMERG,
"jni.factory() NullPointerException name==null\n");
return JK_ERR;
}
+ 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*/
@@ -513,7 +503,7 @@
result->setAttribute = jk2_jni_worker_setProperty;
_this->mbean=result;
- _this->workerEnv=env->getByName( env, "workerEnv" );
+ _this->workerEnv = wEnv;
_this->workerEnv->addWorker( env, _this->workerEnv, _this );
return JK_OK;
1.26 +4 -1 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.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- jk_vm_default.c 26 Oct 2002 14:46:28 -0000 1.25
+++ jk_vm_default.c 31 Oct 2002 11:55:36 -0000 1.26
@@ -657,7 +657,10 @@
workerEnv=env->getByName( env, "workerEnv" );
- if (workerEnv->childGeneration > 0) {
+ /* TODO: use timeframe for child generation
+ *
+ */
+ if (workerEnv->childGeneration > 10) {
result->disabled = 1;
return JK_OK;
}
1.36 +7 -1 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.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- jk_channel_jni.c 26 Sep 2002 10:39:57 -0000 1.35
+++ jk_channel_jni.c 31 Oct 2002 11:55:36 -0000 1.36
@@ -626,6 +626,13 @@
jk_workerEnv_t *wEnv;
jk_channel_jni_private_t *jniPrivate;
+
+ 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;
@@ -649,7 +656,6 @@
result->object= ch;
result->init= jk2_channel_jni_init;
- wEnv=env->getByName( env, "workerEnv" );
ch->workerEnv=wEnv;
wEnv->addChannel( env, wEnv, ch );
--
To unsubscribe, e-mail: <mailto:tomcat-dev-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@;jakarta.apache.org>