cvs commit: jakarta-tomcat-connectors/jk/native2/jni jk_jnicb.c jk_jnicb.exp jk_jnicb.h
costin 02/03/27 16:14:34 Removed: jk/native2/jni jk_jnicb.c jk_jnicb.exp jk_jnicb.h Log: Remove the old jni code, no longer supported for jk2. Jk2 uses the a jni channel and ajp13 marshalling. This minimize the amount of JNI calls ( each cross has a performance impact ) and eliminate the allocation and conversion on the C side ( creating the strings was hugely expensive, almost eliminating any benefit of doing jni - the java side knows how to avoid strings and create them efficiently, and the optimizations is hard to reproduce in C ). -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-tomcat-connectors/jk/native2/jni jk_jnicb.c
costin 01/12/16 23:11:41 Modified:jk/native2/jni jk_jnicb.c Log: Update to the new signatures. Revision ChangesPath 1.5 +183 -206 jakarta-tomcat-connectors/jk/native2/jni/jk_jnicb.c Index: jk_jnicb.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/jni/jk_jnicb.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- jk_jnicb.c2001/12/04 23:56:06 1.4 +++ jk_jnicb.c2001/12/17 07:11:41 1.5 @@ -58,12 +58,13 @@ /*** * Description: JNI callbacks implementation for the JNI in process adapter* * Author: Gal Shachor [EMAIL PROTECTED] * - * Version: $Revision: 1.4 $ * + * Version: $Revision: 1.5 $ * ***/ #include jk_jnicb.h #include jk_service.h #include jk_pool.h +#include jk_env.h /* * Class: org_apache_tomcat_modules_server_JNIConnectionHandler @@ -72,26 +73,26 @@ */ JNIEXPORT jint JNICALL Java_org_apache_tomcat_modules_server_JNIConnectionHandler_getNumberOfHeaders - (JNIEnv *env, jobject o, jlong s, jlong l) + (JNIEnv *jniEnv, jobject o, jlong s, jlong l) { /* [V] Convert indirectly from jlong - int - pointer to shut up gcc */ /* I hope it's okay on other compilers and/or machines... */ jk_ws_service_t *ps = (jk_ws_service_t *)(int)s; -jk_logger_t *pl = (jk_logger_t *)(int)l; - -pl-jkLog(pl, JK_LOG_DEBUG, Into JNIConnectionHandler::getNumberOfHeaders\n); - +jk_env_t *env = (jk_env_t *)(int)l; +int cnt; + if(!ps) { - pl-jkLog(pl, JK_LOG_ERROR, - In JNIConnectionHandler::getNumberOfHeaders, NULL ws service object\n); + env-l-jkLog(env, env-l, JK_LOG_ERROR, + JNIConnectionHandler.getNumberOfHeaders() NullPointerException\n); /* [V] JNIConnectionHandler doesn't handle this */ return -1; } -pl-jkLog(pl, JK_LOG_DEBUG, -Done JNIConnectionHandler::getNumberOfHeaders, found %d headers\n, -ps-num_headers); -return (jint)ps-num_headers; +cnt=ps-headers_in-size( env, ps-headers_in ); + +env-l-jkLog(env, env-l, JK_LOG_DEBUG, + JNIConnectionHandler.getNumberOfHeaders() %d headers\n, cnt); +return (jint)cnt; } /* @@ -101,10 +102,10 @@ */ JNIEXPORT jint JNICALL Java_org_apache_tomcat_modules_server_JNIConnectionHandler_read - (JNIEnv *env, jobject o, jlong s, jlong l, jbyteArray buf, jint from, jint cnt) + (JNIEnv *jniEnv, jobject o, jlong s, jlong l, jbyteArray buf, jint from, jint cnt) { jk_ws_service_t *ps = (jk_ws_service_t *)(int)s; -jk_logger_t *pl = (jk_logger_t *)(int)l; +jk_env_t *env = (jk_env_t *)(int)l; jint rc = -1; jboolean iscommit; jbyte *nbuf; @@ -112,32 +113,34 @@ unsigned ncnt = (unsigned)cnt; unsigned acc = 0; -pl-jkLog(pl, JK_LOG_DEBUG, Into JNIConnectionHandler::read\n); +env-l-jkLog(env, env-l, JK_LOG_DEBUG, + Into JNIConnectionHandler::read\n); if(!ps) { -pl-jkLog(pl, JK_LOG_ERROR, - In JNIConnectionHandler::read, NULL ws service object\n); +env-l-jkLog(env, env-l, JK_LOG_ERROR, + jkjni.read() NULL ws service object\n); return -1; } -nbuf = (*env)-GetByteArrayElements(env, buf, iscommit); +nbuf = (*jniEnv)-GetByteArrayElements(jniEnv, buf, iscommit); if(!nbuf) { -pl-jkLog(pl, JK_LOG_ERROR, - In JNIConnectionHandler::read, GetByteArrayElements error\n); +env-l-jkLog(env, env-l, JK_LOG_ERROR, + In JNIConnectionHandler::read, GetByteArrayElements error\n); return -1; } -if(!ps-read(ps, nbuf + nfrom, ncnt, acc)) { -pl-jkLog(pl, JK_LOG_ERROR, - In JNIConnectionHandler::read, failed to read from web server\n); +if(!ps-read(env, ps, nbuf + nfrom, ncnt, acc)) { +env-l-jkLog(env, env-l, JK_LOG_ERROR, + jkjni.read() failed to read from web server\n); } else { rc = (jint)acc; } -(*env)-ReleaseByteArrayElements(env, buf, nbuf, 0); +(*jniEnv)-ReleaseByteArrayElements(jniEnv, buf, nbuf, 0); -pl-jkLog(pl, JK_LOG_DEBUG, Done JNIConnectionHandler::read\n); +env-l-jkLog(env, env-l, JK_LOG_DEBUG, + Done JNIConnectionHandler::read\n); return rc; } @@ -148,17 +151,17 @@ */ JNIEXPORT jint JNICALL
cvs commit: jakarta-tomcat-connectors/jk/native2/jni jk_jnicb.c
costin 01/12/04 11:13:04 Modified:jk/native2/jni jk_jnicb.c Log: Update jni code. Revision ChangesPath 1.3 +1 -2 jakarta-tomcat-connectors/jk/native2/jni/jk_jnicb.c Index: jk_jnicb.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/jni/jk_jnicb.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- jk_jnicb.c2001/12/02 01:07:12 1.2 +++ jk_jnicb.c2001/12/04 19:13:04 1.3 @@ -58,12 +58,11 @@ /*** * Description: JNI callbacks implementation for the JNI in process adapter* * Author: Gal Shachor [EMAIL PROTECTED] * - * Version: $Revision: 1.2 $ * + * Version: $Revision: 1.3 $ * ***/ #include jk_jnicb.h #include jk_service.h -#include jk_util.h #include jk_pool.h /* -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-tomcat-connectors/jk/native2/jni jk_jnicb.c jk_jnicb.exp jk_jnicb.h
costin 01/12/01 14:42:33 Added: jk/native2/jni jk_jnicb.c jk_jnicb.exp jk_jnicb.h Log: The jni code, imported from native/ Revision ChangesPath 1.1 jakarta-tomcat-connectors/jk/native2/jni/jk_jnicb.c Index: jk_jnicb.c === /* = * * * * The Apache Software License, Version 1.1 * * * * Copyright (c) 1999-2001 The Apache Software Foundation. * * All rights reserved.* * * * = * * * * Redistribution and use in source and binary forms, with or without modi- * * fication, are permitted provided that the following conditions are met: * * * * 1. Redistributions of source code must retain the above copyright notice * *notice, this list of conditions and the following disclaimer. * * * * 2. Redistributions in binary form must reproduce the above copyright * *notice, this list of conditions and the following disclaimer in the * *documentation and/or other materials provided with the distribution. * * * * 3. The end-user documentation included with the redistribution, if any, * *must include the following acknowlegement: * * * * This product includes software developed by the Apache Software * *Foundation http://www.apache.org/. * * * *Alternately, this acknowlegement may appear in the software itself, if * *and wherever such third-party acknowlegements normally appear. * * * * 4. The names The Jakarta Project, Jk, and Apache Software * *Foundation must not be used to endorse or promote products derived * *from this software without prior written permission. For written * *permission, please contact [EMAIL PROTECTED].* * * * 5. Products derived from this software may not be called Apache nor may * *Apache appear in their names without prior written permission of the * *Apache Software Foundation.* * * * THIS SOFTWARE IS PROVIDED AS IS AND ANY EXPRESSED OR IMPLIED WARRANTIES * * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY * * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL * * THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY * * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * * POSSIBILITY OF SUCH DAMAGE. * * * * = * * * * This software consists of voluntary contributions made by many indivi- * * duals on behalf of the Apache Software Foundation. For more information * * on the Apache Software Foundation, please see http://www.apache.org/. * * * * = */ /*** * Description: JNI callbacks implementation for the JNI
cvs commit: jakarta-tomcat-connectors/jk/native2/jni jk_jnicb.c
costin 01/12/01 17:07:12 Modified:jk/native2 build.xml jk/native2/jni jk_jnicb.c Log: Fix build.xml, update jni. Revision ChangesPath 1.2 +1 -1 jakarta-tomcat-connectors/jk/native2/build.xml Index: build.xml === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/build.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- build.xml 2001/12/01 21:57:47 1.1 +++ build.xml 2001/12/02 01:07:12 1.2 @@ -76,7 +76,7 @@ def name=USE_APACHE_MD5 info=Use the MD5 implementation that is part of apache2 / src dir=. - include name=server/apache-2.0/mod_jk.c / + include name=server/apache2/mod_jk.c / include name=common/*.c / include name=apr/*.c / /src 1.2 +46 -46jakarta-tomcat-connectors/jk/native2/jni/jk_jnicb.c Index: jk_jnicb.c === RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/jni/jk_jnicb.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- jk_jnicb.c2001/12/01 22:42:33 1.1 +++ jk_jnicb.c2001/12/02 01:07:12 1.2 @@ -58,7 +58,7 @@ /*** * Description: JNI callbacks implementation for the JNI in process adapter* * Author: Gal Shachor [EMAIL PROTECTED] * - * Version: $Revision: 1.1 $ * + * Version: $Revision: 1.2 $ * ***/ #include jk_jnicb.h @@ -80,16 +80,16 @@ jk_ws_service_t *ps = (jk_ws_service_t *)(int)s; jk_logger_t *pl = (jk_logger_t *)(int)l; -jk_log(pl, JK_LOG_DEBUG, Into JNIConnectionHandler::getNumberOfHeaders\n); +pl-jkLog(pl, JK_LOG_DEBUG, Into JNIConnectionHandler::getNumberOfHeaders\n); if(!ps) { - jk_log(pl, JK_LOG_ERROR, + pl-jkLog(pl, JK_LOG_ERROR, In JNIConnectionHandler::getNumberOfHeaders, NULL ws service object\n); /* [V] JNIConnectionHandler doesn't handle this */ return -1; } -jk_log(pl, JK_LOG_DEBUG, +pl-jkLog(pl, JK_LOG_DEBUG, Done JNIConnectionHandler::getNumberOfHeaders, found %d headers\n, ps-num_headers); return (jint)ps-num_headers; @@ -113,10 +113,10 @@ unsigned ncnt = (unsigned)cnt; unsigned acc = 0; -jk_log(pl, JK_LOG_DEBUG, Into JNIConnectionHandler::read\n); +pl-jkLog(pl, JK_LOG_DEBUG, Into JNIConnectionHandler::read\n); if(!ps) { -jk_log(pl, JK_LOG_ERROR, +pl-jkLog(pl, JK_LOG_ERROR, In JNIConnectionHandler::read, NULL ws service object\n); return -1; } @@ -124,13 +124,13 @@ nbuf = (*env)-GetByteArrayElements(env, buf, iscommit); if(!nbuf) { -jk_log(pl, JK_LOG_ERROR, +pl-jkLog(pl, JK_LOG_ERROR, In JNIConnectionHandler::read, GetByteArrayElements error\n); return -1; } if(!ps-read(ps, nbuf + nfrom, ncnt, acc)) { -jk_log(pl, JK_LOG_ERROR, +pl-jkLog(pl, JK_LOG_ERROR, In JNIConnectionHandler::read, failed to read from web server\n); } else { rc = (jint)acc; @@ -138,7 +138,7 @@ (*env)-ReleaseByteArrayElements(env, buf, nbuf, 0); -jk_log(pl, JK_LOG_DEBUG, Done JNIConnectionHandler::read\n); +pl-jkLog(pl, JK_LOG_DEBUG, Done JNIConnectionHandler::read\n); return rc; } @@ -155,11 +155,11 @@ jk_logger_t *pl = (jk_logger_t *)(int)l; char port[10]; -jk_log(pl, JK_LOG_DEBUG, +pl-jkLog(pl, JK_LOG_DEBUG, Into JNIConnectionHandler::readEnvironment. Environment follows ---\n); if(!ps) { -jk_log(pl, JK_LOG_ERROR, +pl-jkLog(pl, JK_LOG_ERROR, In JNIConnectionHandler::readEnvironment, NULL ws service object\n); return JK_FALSE; } @@ -171,63 +171,63 @@ envbuf, 0, (*env)-NewStringUTF(env, ps-method)); - jk_log(pl, JK_LOG_DEBUG, --- method: %s\n, ps-method); + pl-jkLog(pl, JK_LOG_DEBUG, --- method: %s\n, ps-method); } if(ps-req_uri) { (*env)-SetObjectArrayElement(env, envbuf, 1, (*env)-NewStringUTF(env, ps-req_uri)); - jk_log(pl, JK_LOG_DEBUG, --- req_uri: %s\n, ps-req_uri); +