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...@locus.apache.org on 2000/05/18 21:41:55 UTC
cvs commit: jakarta-tomcat/src/native/jni_connect jk_jnicb.c
costin 00/05/18 12:41:54
Modified: src/native/apache2.0 Makefile.linux mod_jk.c
src/native/jk jk_jni_worker.c
src/native/jni_connect jk_jnicb.c
Log:
- Fix previous post ( missing one line )
- added some ( commented-out ) code that keeps the endpoint open between invocations.
It should be used only in non-load-balancing situations.
Revision Changes Path
1.2 +3 -4 jakarta-tomcat/src/native/apache2.0/Makefile.linux
Index: Makefile.linux
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/native/apache2.0/Makefile.linux,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Makefile.linux 2000/04/25 00:30:59 1.1
+++ Makefile.linux 2000/05/18 19:41:42 1.2
@@ -1,7 +1,9 @@
## You need to edit this file - configure later :-)
APACHE_HOME=/usr/local/apache-2.0
+AP20_SRC=/home/costin/src/jakarta/apache-2.0/src
OS=linux
+
## I assume this one is set up already
# JAVA_HOME=
@@ -13,14 +15,13 @@
##
-AP20_SRC=/home/costin/src/jakarta/apache-2.0/src
AP20SRC_INCL=-I. -I${AP20_SRC}/modules/standard -I${AP20_SRC} -I${AP20_SRC}/include -I${AP20_SRC}/lib/apr/include -I${AP20_SRC}/os/unix
CFLAGS=-DHAVE_CONFIG_H -g -fpic -DSHARED_MODULE -O2 -D_REENTRANT -pthread -DLINUX
SRCS=jk_ajp12_worker.c jk_connect.c jk_lb_worker.c \
jk_map.c jk_pool.c jk_sockbuf.c jk_uri_worker_map.c jk_util.c jk_worker.c \
- jk_ajp23_worker.c jk_msg_buff.c jk_jni_worker.c
+ jk_msg_buff.c jk_jni_worker.c
OBJS=${patsubst %.c,%.o,${SRCS}}
@@ -29,8 +30,6 @@
.c.o:
${CC} -c ${CFLAGS} ${JAVA_INCL} ${AP20SRC_INCL} -I../jk $<
-
-
all: mod_jk.so
1.5 +31 -4 jakarta-tomcat/src/native/apache2.0/mod_jk.c
Index: mod_jk.c
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/native/apache2.0/mod_jk.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- mod_jk.c 2000/05/05 17:00:32 1.4
+++ mod_jk.c 2000/05/18 19:41:43 1.5
@@ -445,6 +445,14 @@
/* ========================================================================= */
/* The JK module handlers */
/* ========================================================================= */
+
+ap_status_t jk_cleanup_endpoint( void *data ) {
+ jk_endpoint_t *end = (jk_endpoint_t *)data;
+ /* printf("XXX jk_cleanup1 %ld\n", data); */
+ end->done(&end, NULL);
+ return 0;
+}
+
static int jk_handler(request_rec *r)
{
const char *worker_name = ap_table_get(r->notes, JK_WORKER_ID);
@@ -477,14 +485,33 @@
if(init_ws_service(&private_data, &s)) {
jk_endpoint_t *end = NULL;
- if(worker->get_endpoint(worker, &end, l)) {
- int is_recoverable_error = JK_FALSE;
+
+ /* Use per/thread pool ( or "context" ) to reuse the
+ endpoint. It's a bit faster, but I don't know
+ how to deal with load balancing - but it's usefull for JNI
+ */
+
+#ifdef REUSE_WORKER
+ ap_pool_t *rpool=r->pool;
+ ap_pool_t *tpool=rpool->parent->parent;
+
+ ap_get_userdata( &end, "jk_thread_endpoint", tpool );
+ if(end==NULL ) {
+ worker->get_endpoint(worker, &end, l);
+ ap_set_userdata( end , "jk_thread_endpoint", &jk_cleanup_endpoint, tpool );
+ }
+#else
+ end=worker->get_endpoint(worker, &end, l);
+#endif
+ {
+ int is_recoverable_error = JK_FALSE;
rc = end->service(end,
&s,
l,
&is_recoverable_error);
-
- end->done(&end, l);
+#ifndef REUSE_WORKER
+ end->done(&end, l);
+#endif
}
}
1.5 +4 -2 jakarta-tomcat/src/native/jk/jk_jni_worker.c
Index: jk_jni_worker.c
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/native/jk/jk_jni_worker.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- jk_jni_worker.c 2000/05/18 19:20:56 1.4
+++ jk_jni_worker.c 2000/05/18 19:41:46 1.5
@@ -57,7 +57,7 @@
* Description: In process JNI worker *
* Author: Gal Shachor <sh...@il.ibm.com> *
* Based on: *
- * Version: $Revision: 1.4 $ *
+ * Version: $Revision: 1.5 $ *
***************************************************************************/
#ifndef WIN32
@@ -563,16 +563,18 @@
JNIEnv **env,
jk_logger_t *l)
{
+ JDK1_1InitArgs vm_args;
JNIEnv *penv;
int err;
*env = NULL;
+ vm_args.version = 0x00010001;
+
if(0 != jni_get_default_java_vm_init_args(&vm_args)) {
jk_log(l, JK_LOG_EMERG, "Fail-> can't get default vm init args\n");
return JK_FALSE;
}
- vm_args.version = 0x00010001;
if(vm_args.classpath) {
unsigned len = strlen(vm_args.classpath) +
1.2 +2 -4 jakarta-tomcat/src/native/jni_connect/jk_jnicb.c
Index: jk_jnicb.c
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/native/jni_connect/jk_jnicb.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- jk_jnicb.c 2000/02/09 12:00:52 1.1
+++ jk_jnicb.c 2000/05/18 19:41:49 1.2
@@ -56,7 +56,7 @@
/***************************************************************************
* Description: JNI callbacks implementation for the JNI in process adapter*
* Author: Gal Shachor <sh...@il.ibm.com> *
- * Version: $Revision: 1.1 $ *
+ * Version: $Revision: 1.2 $ *
***************************************************************************/
#include "jk_jnicb.h"
@@ -118,7 +118,6 @@
jk_log(pl, JK_LOG_ERROR,
"In JNIConnectionHandler::read, NULL ws service object\n");
}
-
return rc;
}
@@ -134,7 +133,6 @@
jk_ws_service_t *ps = (jk_ws_service_t *)s;
jk_logger_t *pl = (jk_logger_t *)l;
-
if(ps) {
char port[10];
@@ -257,7 +255,7 @@
(*env)->NewStringUTF(env, ps->headers_values[i]));
}
- return JK_TRUE;
+ return JK_TRUE;
} else {
jk_log(pl, JK_LOG_ERROR,
"In JNIConnectionHandler::readHeaders, NULL ws service object\n");