You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by sh...@locus.apache.org on 2000/02/28 12:52:57 UTC
cvs commit: jakarta-tomcat/src/native/iis_netscape jk_lb_worker.h isapi.dsp jk_ajp12_worker.c jk_ajp12_worker.h jk_connect.c jk_connect.h jk_global.h jk_isapi_plugin.c jk_jni_worker.c jk_jni_worker.h jk_lb_worker.c jk_logger.h jk_map.c jk_map.h jk_nsapi_plugin.c jk_pool.c jk_pool.h jk_service.h jk_sockbuf.c jk_sockbuf.h jk_uri_worker_map.c jk_uri_worker_map.h jk_util.c jk_util.h jk_worker.c jk_worker.h jkmain.dsp nsapi.dsp test.c todo.txt
shachor 00/02/28 03:52:57
Modified: src/native/iis_netscape isapi.dsp jk_ajp12_worker.c
jk_ajp12_worker.h jk_connect.c jk_connect.h
jk_global.h jk_isapi_plugin.c jk_jni_worker.c
jk_jni_worker.h jk_lb_worker.c jk_logger.h jk_map.c
jk_map.h jk_nsapi_plugin.c jk_pool.c jk_pool.h
jk_service.h jk_sockbuf.c jk_sockbuf.h
jk_uri_worker_map.c jk_uri_worker_map.h jk_util.c
jk_util.h jk_worker.c jk_worker.h jkmain.dsp
nsapi.dsp test.c todo.txt
Added: src/native/iis_netscape jk_lb_worker.h
Log:
Add support for load balancing and multiple Jakarta JVMs for
IIS and Netscape
Revision Changes Path
1.3 +8 -0 jakarta-tomcat/src/native/iis_netscape/isapi.dsp
Index: isapi.dsp
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/native/iis_netscape/isapi.dsp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- isapi.dsp 2000/02/09 12:00:48 1.2
+++ isapi.dsp 2000/02/28 11:52:44 1.3
@@ -112,6 +112,10 @@
# End Source File
# Begin Source File
+SOURCE=.\jk_lb_worker.c
+# End Source File
+# Begin Source File
+
SOURCE=.\jk_map.c
# End Source File
# Begin Source File
@@ -153,6 +157,10 @@
# Begin Source File
SOURCE=.\jk_jni_worker.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\jk_lb_worker.h
# End Source File
# Begin Source File
1.3 +11 -2 jakarta-tomcat/src/native/iis_netscape/jk_ajp12_worker.c
Index: jk_ajp12_worker.c
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/native/iis_netscape/jk_ajp12_worker.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- jk_ajp12_worker.c 2000/02/09 12:00:48 1.2
+++ jk_ajp12_worker.c 2000/02/28 11:52:44 1.3
@@ -57,7 +57,7 @@
* Description: ajpv1.2 worker, used to call local or remote jserv hosts *
* Author: Gal Shachor <sh...@il.ibm.com> *
* Based on: jserv_ajpv12.c from Jserv *
- * Version: $Revision: 1.2 $ *
+ * Version: $Revision: 1.3 $ *
***************************************************************************/
#include "jk_ajp12_worker.h"
@@ -115,14 +115,17 @@
static int JK_METHOD service(jk_endpoint_t *e,
jk_ws_service_t *s,
- jk_logger_t *l)
+ jk_logger_t *l,
+ int *is_recoverable_error)
{
jk_log(l, JK_LOG_DEBUG, "Into jk_endpoint_t::service\n");
- if(e && e->endpoint_private && s) {
+ if(e && e->endpoint_private && s && is_recoverable_error) {
ajp12_endpoint_t *p = e->endpoint_private;
unsigned attempt;
+ *is_recoverable_error = JK_TRUE;
+
for(attempt = 0 ; attempt < p->worker->connect_retry_attempts ; attempt++) {
p->sd = jk_open_socket(&p->worker->worker_inet_addr,
JK_TRUE,
@@ -134,6 +137,12 @@
}
}
if(p->sd >= 0) {
+
+ /*
+ * After we are connected, each error that we are going to
+ * have is probably unrecoverable
+ */
+ *is_recoverable_error = JK_FALSE;
jk_sb_open(&p->sb, p->sd);
if(ajpv12_handle_request(p, s, l)) {
jk_log(l, JK_LOG_DEBUG, "In jk_endpoint_t::service, sent request\n");
1.3 +0 -0 jakarta-tomcat/src/native/iis_netscape/jk_ajp12_worker.h
Index: jk_ajp12_worker.h
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/native/iis_netscape/jk_ajp12_worker.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- jk_ajp12_worker.h 2000/02/09 12:00:48 1.2
+++ jk_ajp12_worker.h 2000/02/28 11:52:44 1.3
@@ -56,7 +56,7 @@
/***************************************************************************
* Description: ajpv1.2 worker header file *
* Author: Gal Shachor <sh...@il.ibm.com> *
- * Version: $Revision: 1.2 $ *
+ * Version: $Revision: 1.3 $ *
***************************************************************************/
#ifndef JK_AJP12_WORKER_H
1.3 +0 -0 jakarta-tomcat/src/native/iis_netscape/jk_connect.c
Index: jk_connect.c
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/native/iis_netscape/jk_connect.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- jk_connect.c 2000/02/09 12:00:48 1.2
+++ jk_connect.c 2000/02/28 11:52:44 1.3
@@ -57,7 +57,7 @@
* Description: Socket/Naming manipulation functions *
* Author: Gal Shachor <sh...@il.ibm.com> *
* Based on: Various Jserv files *
- * Version: $Revision: 1.2 $ *
+ * Version: $Revision: 1.3 $ *
***************************************************************************/
1.3 +0 -0 jakarta-tomcat/src/native/iis_netscape/jk_connect.h
Index: jk_connect.h
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/native/iis_netscape/jk_connect.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- jk_connect.h 2000/02/09 12:00:48 1.2
+++ jk_connect.h 2000/02/28 11:52:45 1.3
@@ -56,7 +56,7 @@
/***************************************************************************
* Description: Socket connections header file *
* Author: Gal Shachor <sh...@il.ibm.com> *
- * Version: $Revision: 1.2 $ *
+ * Version: $Revision: 1.3 $ *
***************************************************************************/
#ifndef JK_CONNECT_H
1.3 +2 -0 jakarta-tomcat/src/native/iis_netscape/jk_global.h
Index: jk_global.h
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/native/iis_netscape/jk_global.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- jk_global.h 2000/02/09 12:00:48 1.2
+++ jk_global.h 2000/02/28 11:52:45 1.3
@@ -57,7 +57,7 @@
* Description: Global definitions and include files that should exist *
* anywhere *
* Author: Gal Shachor <sh...@il.ibm.com> *
- * Version: $Revision: 1.2 $ *
+ * Version: $Revision: 1.3 $ *
***************************************************************************/
#ifndef JK_GLOBAL_H
@@ -110,6 +110,8 @@
#define JK_LF (10)
#define JK_CR (13)
+
+#define JK_SESSION_IDENTIFIER "JSESSIONID"
#ifdef WIN32
#define JK_METHOD __stdcall
1.3 +2 -1 jakarta-tomcat/src/native/iis_netscape/jk_isapi_plugin.c
Index: jk_isapi_plugin.c
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/native/iis_netscape/jk_isapi_plugin.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- jk_isapi_plugin.c 2000/02/09 12:00:48 1.2
+++ jk_isapi_plugin.c 2000/02/28 11:52:45 1.3
@@ -56,7 +56,7 @@
/***************************************************************************
* Description: ISAPI plugin for IIS/PWS *
* Author: Gal Shachor <sh...@il.ibm.com> *
- * Version: $Revision: 1.2 $ *
+ * Version: $Revision: 1.3 $ *
***************************************************************************/
#include <httpext.h>
@@ -484,7 +484,8 @@
if(worker) {
jk_endpoint_t *e = NULL;
if(worker->get_endpoint(worker, &e, logger)) {
- if(e->service(e, &s, logger)) {
+ int recover = JK_FALSE;
+ if(e->service(e, &s, logger, &recover)) {
rc = HSE_STATUS_SUCCESS_AND_KEEP_CONN;
lpEcb->dwHttpStatusCode = HTTP_STATUS_OK;
}
1.2 +10 -2 jakarta-tomcat/src/native/iis_netscape/jk_jni_worker.c
Index: jk_jni_worker.c
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/native/iis_netscape/jk_jni_worker.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- jk_jni_worker.c 2000/02/09 12:00:48 1.1
+++ jk_jni_worker.c 2000/02/28 11:52:45 1.2
@@ -57,7 +57,7 @@
* Description: In process JNI worker *
* Author: Gal Shachor <sh...@il.ibm.com> *
* Based on: *
- * Version: $Revision: 1.1 $ *
+ * Version: $Revision: 1.2 $ *
***************************************************************************/
#include <jni.h>
@@ -171,9 +171,10 @@
static int JK_METHOD service(jk_endpoint_t *e,
jk_ws_service_t *s,
- jk_logger_t *l)
+ jk_logger_t *l,
+ int *is_recoverable_error)
{
- if(e && e->endpoint_private && s) {
+ if(e && e->endpoint_private && s && is_recoverable_error) {
jni_endpoint_t *p = e->endpoint_private;
if(p->attached ||
@@ -182,6 +183,12 @@
p->attached = JK_TRUE;
+ /*
+ * When we call the JVM we can not know what happen
+ * So we can not recover !!!
+ */
+ *is_recoverable_error = JK_FALSE;
+
rc = (*(p->env))->CallIntMethod(p->env,
p->worker->jk_java_bridge_object,
p->worker->jk_service_method,
@@ -190,6 +197,7 @@
return rc == 0 ? JK_FALSE : JK_TRUE;
}
+ *is_recoverable_error = JK_TRUE;
}
return JK_FALSE;
1.2 +0 -0 jakarta-tomcat/src/native/iis_netscape/jk_jni_worker.h
Index: jk_jni_worker.h
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/native/iis_netscape/jk_jni_worker.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- jk_jni_worker.h 2000/02/09 12:00:48 1.1
+++ jk_jni_worker.h 2000/02/28 11:52:46 1.2
@@ -56,7 +56,7 @@
/***************************************************************************
* Description: jni worker header file *
* Author: Gal Shachor <sh...@il.ibm.com> *
- * Version: $Revision: 1.1 $ *
+ * Version: $Revision: 1.2 $ *
***************************************************************************/
#ifndef JK_JNI_WORKER_H
1.3 +242 -25 jakarta-tomcat/src/native/iis_netscape/jk_lb_worker.c
Index: jk_lb_worker.c
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/native/iis_netscape/jk_lb_worker.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- jk_lb_worker.c 2000/02/09 12:00:48 1.2
+++ jk_lb_worker.c 2000/02/28 11:52:46 1.3
@@ -58,18 +58,29 @@
* several workers. *
* Author: Gal Shachor <sh...@il.ibm.com> *
* Based on: *
- * Version: $Revision: 1.2 $ *
+ * Version: $Revision: 1.3 $ *
***************************************************************************/
-
#include "jk_pool.h"
#include "jk_service.h"
#include "jk_util.h"
#include "jk_worker.h"
+#include "jk_lb_worker.h"
+
+/*
+ * The load balancing code in this
+ */
+
+/*
+ * Time to wait before retry...
+ */
+#define WAIT_BEFORE_RECOVER (60*1)
+#define ADDITINAL_WAIT_LOAD (20)
+
struct worker_record {
char *name;
- double lb_factors;
+ double lb_factor;
double lb_value;
int in_error_state;
int in_recovering;
@@ -99,6 +110,108 @@
typedef struct lb_endpoint lb_endpoint_t;
+/* ========================================================================= */
+/* Retrieve the parameter with the given name */
+static char *get_param(jk_ws_service_t *s,
+ const char *name)
+{
+ if(s->query_string) {
+ char *id_start = NULL;
+ for(id_start = strstr(s->query_string, name) ;
+ id_start ;
+ id_start = strstr(id_start + 1, name)) {
+ if('=' == id_start[strlen(name)]) {
+ /*
+ * Session cookie was found, get it's value
+ */
+ id_start += (1 + strlen(name));
+ if(strlen(id_start)) {
+ char *id_end;
+ id_start = jk_pool_strdup(s->pool, id_start);
+ if(id_end = strchr(id_start, '&')) {
+ id_end = NULL;
+ }
+ return id_start;
+ }
+ }
+ }
+ }
+
+ return NULL;
+}
+
+/* ========================================================================= */
+/* Retrieve the cookie with the given name */
+static char *get_cookie(jk_ws_service_t *s,
+ const char *name)
+{
+ unsigned i;
+
+ for(i = 0 ; i < s->num_headers ; i++) {
+ if(0 == stricmp(s->headers_names[i], "cookie")) {
+
+ char *id_start;
+ for(id_start = strstr(s->headers_values[i], name) ;
+ id_start ;
+ id_start = strstr(id_start + 1, name)) {
+ if('=' == id_start[strlen(name)]) {
+ /*
+ * Session cookie was found, get it's value
+ */
+ id_start += (1 + strlen(name));
+ if(strlen(id_start)) {
+ char *id_end;
+ id_start = jk_pool_strdup(s->pool, id_start);
+ if(id_end = strchr(id_start, ';')) {
+ id_end = NULL;
+ }
+ return id_start;
+ }
+ }
+ }
+ }
+ }
+
+ return NULL;
+}
+
+
+/* ========================================================================= */
+/* Retrieve session id from the cookie or the parameter */
+/* (parameter first) */
+static char *get_sessionid(jk_ws_service_t *s)
+{
+ char *val;
+ val = get_param(s, JK_SESSION_IDENTIFIER);
+ if(!val) {
+ val = get_cookie(s, JK_SESSION_IDENTIFIER);
+ }
+ return val;
+}
+
+static char *get_session_route(jk_ws_service_t *s)
+{
+ char *sessionid = get_sessionid(s);
+ char *ch;
+
+ if(!sessionid) {
+ return NULL;
+ }
+
+ /*
+ * Balance parameter is appended to the end
+ */
+ ch = strrchr(sessionid, '.');
+ if(!ch) {
+ return 0;
+ }
+ ch++;
+ if(*ch == '\0') {
+ return NULL;
+ }
+ return ch;
+}
+
static void close_workers(lb_worker_t *p,
int num_of_workers,
jk_logger_t *l)
@@ -110,49 +223,141 @@
}
}
+static double get_max_lb(lb_worker_t *p)
+{
+ unsigned i;
+ double rc = 0.0;
+
+ for(i = 0 ; i < p->num_of_workers ; i++) {
+ if(!p->lb_workers[i].in_error_state) {
+ if(p->lb_workers[i].lb_value > rc) {
+ rc = p->lb_workers[i].lb_value;
+ }
+ }
+ }
+
+ return rc;
+}
+
static worker_record_t *get_most_suitable_worker(lb_worker_t *p,
jk_ws_service_t *s)
{
- return NULL;
+ worker_record_t *rc = NULL;
+ double lb_min = 0.0;
+ unsigned i;
+ char *session_route = get_session_route(s);
+
+ if(session_route) {
+ for(i = 0 ; i < p->num_of_workers ; i++) {
+ if(0 == strcmp(session_route, p->lb_workers[i].name)) {
+ if(p->lb_workers[i].in_error_state) {
+ break;
+ } else {
+ return &(p->lb_workers[i]);
+ }
+ }
+ }
+ }
+
+ for(i = 0 ; i < p->num_of_workers ; i++) {
+ if(p->lb_workers[i].in_error_state) {
+ if(!p->lb_workers[i].in_recovering) {
+ time_t now = time(0);
+
+ if((now - p->lb_workers[i].error_time) > WAIT_BEFORE_RECOVER) {
+
+ p->lb_workers[i].in_recovering = JK_TRUE;
+ p->lb_workers[i].error_time = now;
+ rc = &(p->lb_workers[i]);
+
+ break;
+ }
+ }
+ } else {
+ if(p->lb_workers[i].lb_value < lb_min || !rc) {
+ lb_min = p->lb_workers[i].lb_value;
+ rc = &(p->lb_workers[i]);
+ }
+ }
+ }
+
+ if(rc) {
+ rc->lb_value += rc->lb_factor;
+ }
+
+ return rc;
}
static int JK_METHOD service(jk_endpoint_t *e,
jk_ws_service_t *s,
- jk_logger_t *l)
+ jk_logger_t *l,
+ int *is_recoverable_error)
{
- if(e && e->endpoint_private && s) {
+ if(e && e->endpoint_private && s && is_recoverable_error) {
lb_endpoint_t *p = e->endpoint_private;
jk_endpoint_t *end = NULL;
+ /* you can not recover on another load balancer */
+ *is_recoverable_error = JK_FALSE;
+
+
while(1) {
worker_record_t *rec = get_most_suitable_worker(p->worker, s);
int rc;
+
if(rec) {
+ int is_recoverable = JK_FALSE;
+
+ s->jvm_route = jk_pool_strdup(s->pool, rec->name);
+
rc = rec->w->get_endpoint(rec->w, &end, l);
- if(!rc || !end) {
- rec->in_error_state = JK_TRUE;
- rec->error_time = time(0);
- continue;
+ if(rc && end) {
+ int src = end->service(end, s, l, &is_recoverable);
+ end->done(&end, l);
+ if(src) {
+ if(rec->in_recovering) {
+ rec->lb_value = get_max_lb(p->worker) + ADDITINAL_WAIT_LOAD;
+ }
+ rec->in_error_state = JK_FALSE;
+ rec->in_recovering = JK_FALSE;
+ rec->error_time = 0;
+ return JK_TRUE;
+ }
}
- if(end->service(end, s, l)) {
- rec->in_error_state = JK_FALSE;
- rec->in_recovering = JK_FALSE;
- return JK_TRUE;
- }
+ /*
+ * Service failed !!!
+ *
+ * Time for fault tolerance (if possible)...
+ */
rec->in_error_state = JK_TRUE;
- rec->error_time = time(0);
- // FIXME:
- //if(end->should_recover_on_other()) {
- // continue;
- //}
- }
+ rec->in_recovering = JK_FALSE;
+ rec->error_time = time(0);
- break;
- }
+ if(!is_recoverable) {
+ /*
+ * Error is not recoverable - break with an error.
+ */
+ jk_log(l, JK_LOG_ERROR,
+ "In jk_endpoint_t::service, none recoverable error...\n");
+ break;
+ }
+ /*
+ * Error is recoverable by submitting the request to
+ * another worker... Lets try to do that.
+ */
+ jk_log(l, JK_LOG_DEBUG,
+ "In jk_endpoint_t::service, recoverable error... will try to recover on other host\n");
+ } else {
+ /* NULL record, no more workers left ... */
+ jk_log(l, JK_LOG_ERROR,
+ "In jk_endpoint_t::service, No more workers left, can not submit the request\n");
+ break;
+ }
+ }
}
return JK_FALSE;
}
@@ -199,8 +404,9 @@
for(i = 0 ; i < num_of_workers ; i++) {
p->lb_workers[i].name = jk_pool_strdup(&p->p, worker_names[i]);
- p->lb_workers[i].lb_factors = jk_get_lb_factor(props,
+ p->lb_workers[i].lb_factor = jk_get_lb_factor(props,
worker_names[i]);
+ p->lb_workers[i].lb_factor = 1/p->lb_workers[i].lb_factor;
p->lb_workers[i].lb_value = 0.0;
p->lb_workers[i].in_error_state = JK_FALSE;
p->lb_workers[i].in_recovering = JK_FALSE;
@@ -234,8 +440,10 @@
static int JK_METHOD get_endpoint(jk_worker_t *pThis,
jk_endpoint_t **pend,
- jk_logger_t *log)
+ jk_logger_t *l)
{
+ jk_log(l, JK_LOG_DEBUG, "Into jk_worker_t::get_endpoint\n");
+
if(pThis && pThis->worker_private && pend) {
lb_endpoint_t *p = (lb_endpoint_t *)malloc(sizeof(lb_endpoint_t));
if(p) {
@@ -248,6 +456,9 @@
return JK_TRUE;
}
+ jk_log(l, JK_LOG_ERROR, "In jk_worker_t::get_endpoint, malloc failed\n");
+ } else {
+ jk_log(l, JK_LOG_ERROR, "In jk_worker_t::get_endpoint, NULL parameters\n");
}
return JK_FALSE;
@@ -256,6 +467,7 @@
static int JK_METHOD destroy(jk_worker_t **pThis,
jk_logger_t *l)
{
+ jk_log(l, JK_LOG_DEBUG, "Into jk_worker_t::destroy\n");
if(pThis && *pThis && (*pThis)->worker_private) {
lb_worker_t *private_data = (*pThis)->worker_private;
@@ -269,11 +481,13 @@
return JK_TRUE;
}
+ jk_log(l, JK_LOG_ERROR, "In jk_worker_t::destroy, NULL parameters\n");
return JK_FALSE;
}
int JK_METHOD lb_worker_factory(jk_worker_t **w,
- char *name)
+ const char *name,
+ jk_logger_t *l)
{
if(NULL != name && NULL != w) {
lb_worker_t *private_data =
@@ -303,6 +517,9 @@
jk_close_pool(&private_data->p);
free(private_data);
}
+ jk_log(l, JK_LOG_ERROR, "In lb_worker_factory, malloc failed\n");
+ } else {
+ jk_log(l, JK_LOG_ERROR, "In lb_worker_factory, NULL parameters\n");
}
return JK_FALSE;
1.3 +0 -0 jakarta-tomcat/src/native/iis_netscape/jk_logger.h
Index: jk_logger.h
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/native/iis_netscape/jk_logger.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- jk_logger.h 2000/02/09 12:00:48 1.2
+++ jk_logger.h 2000/02/28 11:52:46 1.3
@@ -56,7 +56,7 @@
/***************************************************************************
* Description: Logger object definitions *
* Author: Gal Shachor <sh...@il.ibm.com> *
- * Version: $Revision: 1.2 $ *
+ * Version: $Revision: 1.3 $ *
***************************************************************************/
#ifndef JK_LOGGER_H
1.3 +0 -0 jakarta-tomcat/src/native/iis_netscape/jk_map.c
Index: jk_map.c
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/native/iis_netscape/jk_map.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- jk_map.c 2000/02/09 12:00:48 1.2
+++ jk_map.c 2000/02/28 11:52:46 1.3
@@ -56,7 +56,7 @@
/***************************************************************************
* Description: General purpose map object *
* Author: Gal Shachor <sh...@il.ibm.com> *
- * Version: $Revision: 1.2 $ *
+ * Version: $Revision: 1.3 $ *
***************************************************************************/
#include "jk_global.h"
1.3 +0 -0 jakarta-tomcat/src/native/iis_netscape/jk_map.h
Index: jk_map.h
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/native/iis_netscape/jk_map.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- jk_map.h 2000/02/09 12:00:48 1.2
+++ jk_map.h 2000/02/28 11:52:47 1.3
@@ -56,7 +56,7 @@
/***************************************************************************
* Description: Map object header file *
* Author: Gal Shachor <sh...@il.ibm.com> *
- * Version: $Revision: 1.2 $ *
+ * Version: $Revision: 1.3 $ *
***************************************************************************/
#ifndef JK_MAP_H
1.3 +2 -1 jakarta-tomcat/src/native/iis_netscape/jk_nsapi_plugin.c
Index: jk_nsapi_plugin.c
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/native/iis_netscape/jk_nsapi_plugin.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- jk_nsapi_plugin.c 2000/02/09 12:00:48 1.2
+++ jk_nsapi_plugin.c 2000/02/28 11:52:47 1.3
@@ -56,7 +56,7 @@
/***************************************************************************
* Description: NSAPI plugin for Netscape servers *
* Author: Gal Shachor <sh...@il.ibm.com> *
- * Version: $Revision: 1.2 $ *
+ * Version: $Revision: 1.3 $ *
***************************************************************************/
@@ -340,7 +340,8 @@
if(init_ws_service(&private_data, &s)) {
jk_endpoint_t *e = NULL;
if(worker->get_endpoint(worker, &e, logger)) {
- if(e->service(e, &s, logger)) {
+ int recover = JK_FALSE;
+ if(e->service(e, &s, logger, &recover)) {
rc = REQ_PROCEED;
}
e->done(&e, logger);
1.3 +0 -0 jakarta-tomcat/src/native/iis_netscape/jk_pool.c
Index: jk_pool.c
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/native/iis_netscape/jk_pool.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- jk_pool.c 2000/02/09 12:00:48 1.2
+++ jk_pool.c 2000/02/28 11:52:47 1.3
@@ -56,7 +56,7 @@
/***************************************************************************
* Description: Simple memory pool *
* Author: Gal Shachor <sh...@il.ibm.com> *
- * Version: $Revision: 1.2 $ *
+ * Version: $Revision: 1.3 $ *
***************************************************************************/
#include "jk_pool.h"
1.3 +0 -0 jakarta-tomcat/src/native/iis_netscape/jk_pool.h
Index: jk_pool.h
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/native/iis_netscape/jk_pool.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- jk_pool.h 2000/02/09 12:00:48 1.2
+++ jk_pool.h 2000/02/28 11:52:47 1.3
@@ -56,7 +56,7 @@
/***************************************************************************
* Description: Memory Pool object header file *
* Author: Gal Shachor <sh...@il.ibm.com> *
- * Version: $Revision: 1.2 $ *
+ * Version: $Revision: 1.3 $ *
***************************************************************************/
#ifndef _JK_POOL_H
#define _JK_POOL_H
1.3 +2 -1 jakarta-tomcat/src/native/iis_netscape/jk_service.h
Index: jk_service.h
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/native/iis_netscape/jk_service.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- jk_service.h 2000/02/09 12:00:49 1.2
+++ jk_service.h 2000/02/28 11:52:47 1.3
@@ -58,7 +58,7 @@
* These are the web server (ws) the worker and the connection*
* JVM connection point *
* Author: Gal Shachor <sh...@il.ibm.com> *
- * Version: $Revision: 1.2 $ *
+ * Version: $Revision: 1.3 $ *
***************************************************************************/
#ifndef JK_SERVICE_H
@@ -164,7 +164,8 @@
int (JK_METHOD *service)(jk_endpoint_t *e,
jk_ws_service_t *s,
- jk_logger_t *l);
+ jk_logger_t *l,
+ int *is_recoverable_error);
int (JK_METHOD *done)(jk_endpoint_t **p,
jk_logger_t *l);
1.3 +0 -0 jakarta-tomcat/src/native/iis_netscape/jk_sockbuf.c
Index: jk_sockbuf.c
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/native/iis_netscape/jk_sockbuf.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- jk_sockbuf.c 2000/02/09 12:00:49 1.2
+++ jk_sockbuf.c 2000/02/28 11:52:48 1.3
@@ -56,7 +56,7 @@
/***************************************************************************
* Description: Simple buffer object to handle buffered socket IO *
* Author: Gal Shachor <sh...@il.ibm.com> *
- * Version: $Revision: 1.2 $ *
+ * Version: $Revision: 1.3 $ *
***************************************************************************/
#include "jk_global.h"
1.3 +0 -0 jakarta-tomcat/src/native/iis_netscape/jk_sockbuf.h
Index: jk_sockbuf.h
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/native/iis_netscape/jk_sockbuf.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- jk_sockbuf.h 2000/02/09 12:00:49 1.2
+++ jk_sockbuf.h 2000/02/28 11:52:48 1.3
@@ -56,7 +56,7 @@
/***************************************************************************
* Description: Socket buffer header file *
* Author: Gal Shachor <sh...@il.ibm.com> *
- * Version: $Revision: 1.2 $ *
+ * Version: $Revision: 1.3 $ *
***************************************************************************/
#include "jk_global.h"
1.3 +0 -0 jakarta-tomcat/src/native/iis_netscape/jk_uri_worker_map.c
Index: jk_uri_worker_map.c
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/native/iis_netscape/jk_uri_worker_map.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- jk_uri_worker_map.c 2000/02/09 12:00:49 1.2
+++ jk_uri_worker_map.c 2000/02/28 11:52:48 1.3
@@ -65,7 +65,7 @@
* servlet container. *
* *
* Author: Gal Shachor <sh...@il.ibm.com> *
- * Version: $Revision: 1.2 $ *
+ * Version: $Revision: 1.3 $ *
***************************************************************************/
#include "jk_pool.h"
1.3 +0 -0 jakarta-tomcat/src/native/iis_netscape/jk_uri_worker_map.h
Index: jk_uri_worker_map.h
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/native/iis_netscape/jk_uri_worker_map.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- jk_uri_worker_map.h 2000/02/09 12:00:49 1.2
+++ jk_uri_worker_map.h 2000/02/28 11:52:48 1.3
@@ -56,7 +56,7 @@
/***************************************************************************
* Description: URI to worker mapper header file *
* Author: Gal Shachor <sh...@il.ibm.com> *
- * Version: $Revision: 1.2 $ *
+ * Version: $Revision: 1.3 $ *
***************************************************************************/
#ifndef JK_URI_WORKER_MAP_H
1.3 +0 -0 jakarta-tomcat/src/native/iis_netscape/jk_util.c
Index: jk_util.c
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/native/iis_netscape/jk_util.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- jk_util.c 2000/02/09 12:00:49 1.2
+++ jk_util.c 2000/02/28 11:52:49 1.3
@@ -56,7 +56,7 @@
/***************************************************************************
* Description: Utility functions (mainly configuration) *
* Author: Gal Shachor <sh...@il.ibm.com> *
- * Version: $Revision: 1.2 $ *
+ * Version: $Revision: 1.3 $ *
***************************************************************************/
1.3 +0 -0 jakarta-tomcat/src/native/iis_netscape/jk_util.h
Index: jk_util.h
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/native/iis_netscape/jk_util.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- jk_util.h 2000/02/09 12:00:49 1.2
+++ jk_util.h 2000/02/28 11:52:49 1.3
@@ -56,7 +56,7 @@
/***************************************************************************
* Description: Various utility functions *
* Author: Gal Shachor <sh...@il.ibm.com> *
- * Version: $Revision: 1.2 $ *
+ * Version: $Revision: 1.3 $ *
***************************************************************************/
#ifndef _JK_UTIL_H
#define _JK_UTIL_H
1.3 +2 -0 jakarta-tomcat/src/native/iis_netscape/jk_worker.c
Index: jk_worker.c
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/native/iis_netscape/jk_worker.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- jk_worker.c 2000/02/09 12:00:49 1.2
+++ jk_worker.c 2000/02/28 11:52:49 1.3
@@ -56,11 +56,12 @@
/***************************************************************************
* Description: Workers controller *
* Author: Gal Shachor <sh...@il.ibm.com> *
- * Version: $Revision: 1.2 $ *
+ * Version: $Revision: 1.3 $ *
***************************************************************************/
#include "jk_ajp12_worker.h"
#include "jk_jni_worker.h"
+#include "jk_lb_worker.h"
#include "jk_worker.h"
#include "jk_util.h"
@@ -75,6 +76,7 @@
static worker_factory_record_t worker_factories[] = {
{ JK_AJP12_WORKER_NAME, ajp12_worker_factory},
{ JK_JNI_WORKER_NAME, jni_worker_factory},
+ { JK_LB_WORKER_NAME, lb_worker_factory},
{ NULL, NULL}
};
1.3 +0 -0 jakarta-tomcat/src/native/iis_netscape/jk_worker.h
Index: jk_worker.h
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/native/iis_netscape/jk_worker.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- jk_worker.h 2000/02/09 12:00:49 1.2
+++ jk_worker.h 2000/02/28 11:52:49 1.3
@@ -56,7 +56,7 @@
/***************************************************************************
* Description: Workers controller header file *
* Author: Gal Shachor <sh...@il.ibm.com> *
- * Version: $Revision: 1.2 $ *
+ * Version: $Revision: 1.3 $ *
***************************************************************************/
#ifndef JK_WORKER_H
1.3 +4 -0 jakarta-tomcat/src/native/iis_netscape/jkmain.dsp
Index: jkmain.dsp
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/native/iis_netscape/jkmain.dsp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- jkmain.dsp 2000/02/09 12:00:49 1.2
+++ jkmain.dsp 2000/02/28 11:52:50 1.3
@@ -151,6 +151,10 @@
# End Source File
# Begin Source File
+SOURCE=.\jk_lb_worker.h
+# End Source File
+# Begin Source File
+
SOURCE=.\jk_logger.h
# End Source File
# Begin Source File
1.3 +12 -0 jakarta-tomcat/src/native/iis_netscape/nsapi.dsp
Index: nsapi.dsp
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/native/iis_netscape/nsapi.dsp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- nsapi.dsp 2000/02/09 12:00:49 1.2
+++ nsapi.dsp 2000/02/28 11:52:50 1.3
@@ -107,6 +107,10 @@
# End Source File
# Begin Source File
+SOURCE=.\jk_lb_worker.c
+# End Source File
+# Begin Source File
+
SOURCE=.\jk_map.c
# ADD CPP /I "$(JAVA_HOME)\include" /I "$(JAVA_HOME)\include\win32"
# End Source File
@@ -150,6 +154,14 @@
# Begin Source File
SOURCE=.\jk_global.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\jk_jni_worker.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\jk_lb_worker.h
# End Source File
# Begin Source File
1.3 +20 -13 jakarta-tomcat/src/native/iis_netscape/test.c
Index: test.c
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/native/iis_netscape/test.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- test.c 2000/02/09 12:00:49 1.2
+++ test.c 2000/02/28 11:52:50 1.3
@@ -57,7 +57,7 @@
* Description: ajpv1.2 protocol, used to call local or remote jserv hosts *
* Author: Gal Shachor <sh...@il.ibm.com> *
* Based on: *
- * Version: $Revision: 1.2 $ *
+ * Version: $Revision: 1.3 $ *
***************************************************************************/
#include <stdio.h>
@@ -87,10 +87,10 @@
unsigned num_of_headers)
{
unsigned i;
- printf("Final results \n");
- printf("Status %d %s\n", status, reason ? reason : "NULL");
+// printf("Final results \n");
+// printf("Status %d %s\n", status, reason ? reason : "NULL");
for(i = 0 ; i < num_of_headers ; i++) {
- printf("Header %s is %s\n", header_names[i], header_values[i]);
+// printf("Header %s is %s\n", header_names[i], header_values[i]);
}
return JK_TRUE;
@@ -101,7 +101,7 @@
const void *buf,
unsigned len)
{
- fwrite(buf, 1, len, stdout);
+// fwrite(buf, 1, len, stdout);
return JK_TRUE;
}
@@ -109,7 +109,8 @@
{
char *names[] = {"content-type", "content-length", "Accept-Language", "Connection", "User-Agent", "Host", "Accept-Encoding", "Accept", "Cookie"};
char *values[] = {"application/x-www-form-urlencoded", "26", "en-us", "Keep-Alive", "Mozilla/4.0 (compatible; MSIE 4.01; Windows NT)", "localhost:8080", "gzip, deflate", "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/msword, application/vnd.ms-powerpoint, */*", "JSESSIONID=To1021mC22584319650438112At"};
-
+ int is_recoverable = JK_FALSE;
+ int i;
jk_map_t *map;
jk_worker_t *worker;
jk_endpoint_t *e;
@@ -194,20 +195,26 @@
map_alloc(&map);
- /*
+
map_read_properties(map,
- "d:\\temp\\native\\iis_netscape\\test.properties");
- */
+ "d:\\Microsoft Visual Studio\\VC98\\MyProjects\\jk\\test.properties");
+ /*
map_read_properties(map,
"d:\\jk_release\\src\\native\\iis_netscape\\test.properties");
+ */
+
wc_open(map, NULL);
- worker = wc_get_worker_for_name("jni", NULL);
+ worker = wc_get_worker_for_name("loadbalancer", NULL);
- worker->get_endpoint(worker, &e, NULL);
+
+ //Sleep(10*1000);
- Sleep(10*1000);
- e->service(e, &s, NULL);
- e->done(&e, NULL);
+ for(i = 0 ; i < 10000 ; i++) {
+ worker->get_endpoint(worker, &e, NULL);
+ e->service(e, &s, NULL, &is_recoverable);
+ e->done(&e, NULL);
+ }
+
worker->destroy(&worker, NULL);
1.2 +7 -9 jakarta-tomcat/src/native/iis_netscape/todo.txt
Index: todo.txt
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/native/iis_netscape/todo.txt,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- todo.txt 2000/01/24 13:23:42 1.1
+++ todo.txt 2000/02/28 11:52:50 1.2
@@ -1,12 +1,10 @@
Todo
------
-1. Add load balancing worker
-2. Add in-process worker
-3. Check other ajp versions
-4. Improve HowTos
-5. Test the Netscape plugin on other Oss and Netscape servers
-6. Test the IIS plugin on W2K and IIS5
-7. Add configuration wizard for IIS !!!
-8. Improve logging in Netscape
-9. Improve code documentation
+1. Check other ajp versions
+2. Improve HowTos
+3. Test the Netscape plugin on other Oss and Netscape servers
+4. Test the IIS plugin on W2K and IIS5
+5. Add configuration wizard for IIS !!!
+6. Improve logging in Netscape
+7. Improve code documentation
1.1 jakarta-tomcat/src/native/iis_netscape/jk_lb_worker.h
Index: jk_lb_worker.h
===================================================================
/*
* Copyright (c) 1997-1999 The Java Apache Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* 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. All advertising materials mentioning features or use of this
* software must display the following acknowledgment:
* "This product includes software developed by the Java Apache
* Project for use in the Apache JServ servlet engine project
* <http://java.apache.org/>."
*
* 4. The names "Apache JServ", "Apache JServ Servlet Engine" and
* "Java Apache Project" must not be used to endorse or promote products
* derived from this software without prior written permission.
*
* 5. Products derived from this software may not be called "Apache JServ"
* nor may "Apache" nor "Apache JServ" appear in their names without
* prior written permission of the Java Apache Project.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by the Java Apache
* Project for use in the Apache JServ servlet engine project
* <http://java.apache.org/>."
*
* THIS SOFTWARE IS PROVIDED BY THE JAVA APACHE PROJECT "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 JAVA APACHE PROJECT 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
* individuals on behalf of the Java Apache Group. For more information
* on the Java Apache Project and the Apache JServ Servlet Engine project,
* please see <http://java.apache.org/>.
*
*/
/***************************************************************************
* Description: load balance worker header file *
* Author: Gal Shachor <sh...@il.ibm.com> *
* Version: $Revision: 1.1 $ *
***************************************************************************/
#ifndef JK_LB_WORKER_H
#define JK_LB_WORKER_H
#include "jk_logger.h"
#include "jk_service.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#define JK_LB_WORKER_NAME ("lb")
int JK_METHOD lb_worker_factory(jk_worker_t **w,
const char *name,
jk_logger_t *l);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* JK_LB_WORKER_H */