cvs commit: jakarta-tomcat-connectors/jk/native2/include jk_worker.h

2004-02-27 Thread hgomez
hgomez  2004/02/27 00:34:18

  Modified:jk/native2/server/apache2 mod_jk2.c
   jk/native2/common jk_worker_lb.c
   jk/native2/include jk_worker.h
  Log:
  Fix problem with ErrorDocument and Apache 2.0.

  

  By default now, WE DON'T touch the headers
  
  Revision  ChangesPath
  1.68  +12 -5 jakarta-tomcat-connectors/jk/native2/server/apache2/mod_jk2.c
  
  Index: mod_jk2.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/server/apache2/mod_jk2.c,v
  retrieving revision 1.67
  retrieving revision 1.68
  diff -u -r1.67 -r1.68
  --- mod_jk2.c 24 Feb 2004 08:44:42 -  1.67
  +++ mod_jk2.c 27 Feb 2004 08:34:18 -  1.68
  @@ -22,7 +22,7 @@
***/
   
   /*
  - * mod_jk: keeps all servlet/jakarta related ramblings together.
  + * mod_jk2: keeps all servlet/jakarta related ramblings together.
*/
   
   
  @@ -697,7 +697,7 @@
   env-l-jkLog(env, env-l, JK_LOG_ERROR, 
 mod_jk.handle() No worker for %s\n, r-uri); 
   workerEnv-globalEnv-releaseEnv( workerEnv-globalEnv, env );
  -return 500;
  +return HTTP_INTERNAL_SERVER_ERROR;
   }
   
   if( uriEnv-mbean-debug  0 )
  @@ -752,9 +752,16 @@
   }
   
   env-l-jkLog(env, env-l, JK_LOG_ERROR,
  -  mod_jk.handler() Error connecting to tomcat %d\n, rc);
  +  mod_jk.handler() Error connecting to tomcat %d, status %d\n, 
rc, s-status);
  +  
   workerEnv-globalEnv-releaseEnv( workerEnv-globalEnv, env );
  -return 500;
  +
  +/* In case of error, if service() set a status code, send it back */
  +/* Else fallback to HTTP_INTERNAL_SERVER_ERROR (500). */
  +if (s-status != 0)
  +return s-status;
  +else
  +return HTTP_INTERNAL_SERVER_ERROR;  
   }
   
   /** Use the internal mod_jk mappings to find if this is a request for
  
  
  
  1.37  +24 -16jakarta-tomcat-connectors/jk/native2/common/jk_worker_lb.c
  
  Index: jk_worker_lb.c
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_worker_lb.c,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- jk_worker_lb.c24 Feb 2004 08:44:40 -  1.36
  +++ jk_worker_lb.c27 Feb 2004 08:34:18 -  1.37
  @@ -326,7 +326,7 @@
   }
   
   /* Initialize here the recovery POST buffer */
  - s-reco_buf = jk2_msg_ajp_create( env, s-pool, 0);
  +s-reco_buf = jk2_msg_ajp_create( env, s-pool, 0);
   s-reco_status = RECO_INITED;
   
   while(1) {
  @@ -356,17 +356,21 @@
   s-status=lb-noWorkerCode; /* SERVICE_UNAVAILABLE is the default */
   }
   
  -if( s-status == 302 ) {
  -s-headers_out-put(env, s-headers_out,
  -Location, lb-noWorkerMsg, NULL);
  -s-head(env, s );
  -} else {
  -s-headers_out-put(env, s-headers_out,
  -Content-Type, text/html, NULL);
  -s-head(env, s );
  -s-jkprintf(env, s, lb-noWorkerMsg );
  -}
  -
  +/* Don't touch headers if noErrorHeader set to TRUE, ie ErrorDocument 
in Apache via mod_alias */
  +if (! lb-noErrorHeader) {
  +/* XXX: I didn't understand the 302, since s-status is 
lb-hwBalanceErr or lb-noWorkerCode */
  +/* Both could be set in workers2.properties so . */ 
  +if( s-status == 302 ) {
  +s-headers_out-put(env, s-headers_out,
  +Location, lb-noWorkerMsg, NULL);
  +s-head(env, s );
  +} else {
  +s-headers_out-put(env, s-headers_out,
  +Content-Type, text/html, NULL);
  +s-head(env, s );
  +s-jkprintf(env, s, lb-noWorkerMsg );
  +}
  +}
   s-afterRequest( env, s);
   lb_priv-error_time = time(NULL);
   return JK_ERR;
  @@ -473,10 +477,10 @@
   
   static char *jk2_worker_lb_multiValueInfo[]={worker, NULL };
   static char *jk2_worker_lb_setAttributeInfo[]={attempts, stickySession, 
recovery, timeout,
  -   hwBalanceErr, noWorkerMsg, 
noWorkerCode, worker, NULL };
  +   hwBalanceErr, noErrorHeader, 
noWorkerMsg, noWorkerCode, worker, NULL };
   
   static char *jk2_worker_lb_getAttributeInfo[]={attempts, stickySession, 
recovery, timeout,
  -   hwBalanceErr, noWorkerMsg, 

cvs commit: jakarta-tomcat-connectors/jk/native2/include jk_worker.h

2004-02-27 Thread hgomez
hgomez  2004/02/27 00:40:04

  Modified:jk/native2/include jk_worker.h
  Log:
  Oups,

  

  
  Revision  ChangesPath
  1.36  +2 -1  jakarta-tomcat-connectors/jk/native2/include/jk_worker.h
  
  Index: jk_worker.h
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/include/jk_worker.h,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- jk_worker.h   27 Feb 2004 08:34:18 -  1.35
  +++ jk_worker.h   27 Feb 2004 08:40:04 -  1.36
  @@ -50,6 +50,7 @@
  in error state, we move to the next leve.
   */
   #define JK_LB_LEVELS 4
  +#define JK_LB_MAX_WORKERS 256
   
   /* XXX Separate this in 2 structures: jk_lb.h and jk_ajp.h.
  Using 'worker' as a generic term is confusing, the objects are very different.
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: cvs commit: jakarta-tomcat-connectors/jk/native2/include jk_worker.h

2004-02-27 Thread NormW
Good morning All.
From my source, a 302 code is Found - the requested resource lies
temporarily under a different URI, which doesn't seem to match very closely
the text of the default noWorkerMsg.
Speaking of which, the word 'temporary' in the #define noWorkerMsg should be
'temporarily'.
Norm



 hgomez  2004/02/27 00:34:18

   Modified:jk/native2/server/apache2 mod_jk2.c
jk/native2/common jk_worker_lb.c
jk/native2/include jk_worker.h
   Log:
   Fix problem with ErrorDocument and Apache 2.0.

   By default now, WE DON'T touch the headers

   Revision  ChangesPath
   1.68  +12 -5
jakarta-tomcat-connectors/jk/native2/server/apache2/mod_jk2.c

   Index: mod_jk2.c
   ===
   RCS file:
/home/cvs/jakarta-tomcat-connectors/jk/native2/server/apache2/mod_jk2.c,v
   retrieving revision 1.67
   retrieving revision 1.68
   diff -u -r1.67 -r1.68
   --- mod_jk2.c 24 Feb 2004 08:44:42 - 1.67
   +++ mod_jk2.c 27 Feb 2004 08:34:18 - 1.68
   @@ -22,7 +22,7 @@

***/

/*
   - * mod_jk: keeps all servlet/jakarta related ramblings together.
   + * mod_jk2: keeps all servlet/jakarta related ramblings together.
 */


   @@ -697,7 +697,7 @@
env-l-jkLog(env, env-l, JK_LOG_ERROR,
  mod_jk.handle() No worker for %s\n, r-uri);
workerEnv-globalEnv-releaseEnv( workerEnv-globalEnv, env );
   -return 500;
   +return HTTP_INTERNAL_SERVER_ERROR;
}

if( uriEnv-mbean-debug  0 )
   @@ -752,9 +752,16 @@
}

env-l-jkLog(env, env-l, JK_LOG_ERROR,
   -  mod_jk.handler() Error connecting to tomcat %d\n,
rc);
   +  mod_jk.handler() Error connecting to tomcat %d,
status %d\n, rc, s-status);
   +
workerEnv-globalEnv-releaseEnv( workerEnv-globalEnv, env );
   -return 500;
   +
   +/* In case of error, if service() set a status code, send it back
*/
   +/* Else fallback to HTTP_INTERNAL_SERVER_ERROR (500). */
   +if (s-status != 0)
   +return s-status;
   +else
   +return HTTP_INTERNAL_SERVER_ERROR;
}

/** Use the internal mod_jk mappings to find if this is a request for



   1.37  +24 -16
jakarta-tomcat-connectors/jk/native2/common/jk_worker_lb.c

   Index: jk_worker_lb.c
   ===
   RCS file:
/home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_worker_lb.c,v
   retrieving revision 1.36
   retrieving revision 1.37
   diff -u -r1.36 -r1.37
   --- jk_worker_lb.c 24 Feb 2004 08:44:40 - 1.36
   +++ jk_worker_lb.c 27 Feb 2004 08:34:18 - 1.37
   @@ -326,7 +326,7 @@
}

/* Initialize here the recovery POST buffer */
   - s-reco_buf = jk2_msg_ajp_create( env, s-pool, 0);
   +s-reco_buf = jk2_msg_ajp_create( env, s-pool, 0);
s-reco_status = RECO_INITED;

while(1) {
   @@ -356,17 +356,21 @@
s-status=lb-noWorkerCode; /* SERVICE_UNAVAILABLE is
the default */
}

   -if( s-status == 302 ) {
   -s-headers_out-put(env, s-headers_out,
   -Location, lb-noWorkerMsg, NULL);
   -s-head(env, s );
   -} else {
   -s-headers_out-put(env, s-headers_out,
   -Content-Type, text/html, NULL);
   -s-head(env, s );
   -s-jkprintf(env, s, lb-noWorkerMsg );
   -}
   -
   +/* Don't touch headers if noErrorHeader set to TRUE, ie
ErrorDocument in Apache via mod_alias */
   +if (! lb-noErrorHeader) {
   +/* XXX: I didn't understand the 302, since s-status is
lb-hwBalanceErr or lb-noWorkerCode */
   +/* Both could be set in workers2.properties so . */
   +if( s-status == 302 ) {
   +s-headers_out-put(env, s-headers_out,
   +Location, lb-noWorkerMsg,
NULL);
   +s-head(env, s );
   +} else {
   +s-headers_out-put(env, s-headers_out,
   +Content-Type, text/html,
NULL);
   +s-head(env, s );
   +s-jkprintf(env, s, lb-noWorkerMsg );
   +}
   +}
s-afterRequest( env, s);
lb_priv-error_time = time(NULL);
return JK_ERR;
   @@ -473,10 +477,10 @@

static char *jk2_worker_lb_multiValueInfo[]={worker, NULL };
static char *jk2_worker_lb_setAttributeInfo[]={attempts,
stickySession, recovery, timeout,
   -   hwBalanceErr,
noWorkerMsg, noWorkerCode, worker, NULL };
   +

cvs commit: jakarta-tomcat-connectors/jk/native2/include jk_worker.h

2003-03-03 Thread costin
costin  2003/03/03 23:20:11

  Modified:jk/native2/include jk_worker.h
  Log:
  Added a field to explicitely control graceful stop state.
  Using disabled was very confusing.
  
  Revision  ChangesPath
  1.30  +6 -2  jakarta-tomcat-connectors/jk/native2/include/jk_worker.h
  
  Index: jk_worker.h
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/include/jk_worker.h,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- jk_worker.h   4 Feb 2003 07:40:32 -   1.29
  +++ jk_worker.h   4 Mar 2003 07:20:11 -   1.30
  @@ -211,7 +211,11 @@
*  or when the configuration changes.
*/
   int in_error_state;
  -
  +
  +/** Explicit field for gracefull state. In this mode only requests with 
  +session IDs matching the worker will be forwarded, nothing else */
  +int graceful;
  +
   /* Worker priority.
* Workers with lower priority are allways preffered - regardless of lb_value
* This is user to represent 'local' workers ( we can call it 'proximity' or 
'distance' )
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-connectors/jk/native2/include jk_worker.h

2002-10-18 Thread mturk
mturk   2002/10/18 08:21:01

  Modified:jk/native2/include jk_worker.h
  Log:
  Add maxEndpoints option
  
  Revision  ChangesPath
  1.28  +11 -1 jakarta-tomcat-connectors/jk/native2/include/jk_worker.h
  
  Index: jk_worker.h
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/include/jk_worker.h,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- jk_worker.h   14 Oct 2002 06:32:49 -  1.27
  +++ jk_worker.h   18 Oct 2002 15:21:01 -  1.28
   -162,6 +162,16 
*/
   struct jk_map *endpointMap;
   
  +/* Maximum number of endpoints per worker.
  +   The default value is 0, meaning unlimited.
  + */
  +int maxEndpoints;
  +
  +/* Indicates that worker has reached maximum number of 'used'
  +   connections.  
  + */
  +int in_max_epcount;
  +
   /** Request pool cache. XXX We may use a pool of requests.
*/
   struct jk_objCache *rPoolCache;
  
  
  

--
To unsubscribe, e-mail:   mailto:tomcat-dev-unsubscribe;jakarta.apache.org
For additional commands, e-mail: mailto:tomcat-dev-help;jakarta.apache.org




cvs commit: jakarta-tomcat-connectors/jk/native2/include jk_worker.h

2002-10-14 Thread mturk

mturk   2002/10/13 23:32:50

  Modified:jk/native2/include jk_worker.h
  Log:
  Add the lb_disabled flag, that when set marks the worker out from
  the lb scheme. This is used for non-channel workers that doesnt
  participate in the TC connections. These flag is set inside the particular
  worker implementation.
  
  Revision  ChangesPath
  1.27  +5 -1  jakarta-tomcat-connectors/jk/native2/include/jk_worker.h
  
  Index: jk_worker.h
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/include/jk_worker.h,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- jk_worker.h   29 Jun 2002 18:33:06 -  1.26
  +++ jk_worker.h   14 Oct 2002 06:32:49 -  1.27
  @@ -188,6 +188,10 @@
*/
   int  lb_factor;
   int  lb_value;
  +/* If set then the worker doesn't participate in the
  + * load-balancer scheme. This is used for non-Tomcat workers.
  + */
  +int  lb_disabled;
   
   /* Time when the last error occured on this worker */
   time_t  error_time;
  
  
  

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




cvs commit: jakarta-tomcat-connectors/jk/native2/include jk_worker.h

2002-06-29 Thread mturk

mturk   2002/06/29 00:45:15

  Modified:jk/native2/include jk_worker.h
  Log:
  Added initalized variable to the worker
  
  Revision  ChangesPath
  1.25  +6 -1  jakarta-tomcat-connectors/jk/native2/include/jk_worker.h
  
  Index: jk_worker.h
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/include/jk_worker.h,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- jk_worker.h   31 May 2002 17:49:07 -  1.24
  +++ jk_worker.h   29 Jun 2002 07:45:15 -  1.25
  @@ -198,6 +198,11 @@
*/
   int in_error_state;
   
  +/* Initialized. Will be set to JK_TRUE after first service 
  + * call to the worker 
  + */
  +int initialized;
  +
   /* Worker priority.
* Workers with lower priority are allways preffered - regardless of lb_value
* This is user to represent 'local' workers ( we can call it 'proximity' or 
'distance' )
  
  
  

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




cvs commit: jakarta-tomcat-connectors/jk/native2/include jk_worker.h

2002-06-29 Thread mturk

mturk   2002/06/29 11:33:06

  Modified:jk/native2/include jk_worker.h
  Log:
  Remove the initalize flag from the worker.
  
  Revision  ChangesPath
  1.26  +2 -7  jakarta-tomcat-connectors/jk/native2/include/jk_worker.h
  
  Index: jk_worker.h
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/include/jk_worker.h,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- jk_worker.h   29 Jun 2002 07:45:15 -  1.25
  +++ jk_worker.h   29 Jun 2002 18:33:06 -  1.26
  @@ -197,12 +197,7 @@
*  or when the configuration changes.
*/
   int in_error_state;
  -
  -/* Initialized. Will be set to JK_TRUE after first service 
  - * call to the worker 
  - */
  -int initialized;
  -
  +
   /* Worker priority.
* Workers with lower priority are allways preffered - regardless of lb_value
* This is user to represent 'local' workers ( we can call it 'proximity' or 
'distance' )
  
  
  

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




cvs commit: jakarta-tomcat-connectors/jk/native2/include jk_worker.h

2002-05-14 Thread costin

costin  02/05/14 10:07:08

  Modified:jk/native2/include jk_worker.h
  Log:
  Few changes:
  
  - removed the statistics, too dangerous in a MT env.
  
  - remove the config stuff, it's now implemented in a generic way in jkconfig.
  
  - remove the init/destroy methods - that duplicate the init/destroy in bean.
  It is much cleaner to use the same lifecycle API for all components.
  ( it's mostly cosmetic, the behavior is the same ).
  
  - Added a 'hwBalanceErr' to support Bernd's use case - if set we check
  only local workers for requests without a session, and if all are down
  we return the given error code ( to be used by a front balancer )
  
  Revision  ChangesPath
  1.20  +12 -36jakarta-tomcat-connectors/jk/native2/include/jk_worker.h
  
  Index: jk_worker.h
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/include/jk_worker.h,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- jk_worker.h   9 May 2002 20:58:13 -   1.19
  +++ jk_worker.h   14 May 2002 17:07:08 -  1.20
  @@ -58,7 +58,7 @@
   /***
* Description: Workers controller header file *
* Author:  Gal Shachor [EMAIL PROTECTED]   * 
  - * Version: $Revision: 1.19 $   *
  + * Version: $Revision: 1.20 $   *
***/
   
   #ifndef JK_WORKER_H
  @@ -135,10 +135,6 @@
   
   struct jk_workerEnv *workerEnv;
   
  -/** Pool for worker specific informations. XXX to be removed, is duplicated
  -*/
  -struct jk_pool *pool;
  -
   /* 
* A 'this' pointer which is used by the subclasses of this class to
* point to data/functions which are specific to a given protocol 
  @@ -172,15 +168,6 @@
*/
   char *route;
   
  -/* Number of requests served by this worker and the number of errors */
  -int reqCnt;
  -int errCnt;
  -
  -/* Total time ( for average - divide by reqCnt ) and maxTime */
  -/* XXX Not used curently. XXX Mutex for mt access  */
  -long time;
  -long maxTime;
  -
   /** lb groups in which this worker belongs */
   struct jk_map *groups;
   
  @@ -206,15 +193,6 @@
*/
   int level;
   
  -/*  Information for reconfiguration  */
  -
  -/* Only one thread can update the config
  - */
  -JK_CRIT_SEC cs;
  -/* 'Version' or generation. Used to update the workers dynamically
  -   at runtime */
  -int ver;
  -
   /*  Information specific to the lb worker 
 */
   
   /** Load balanced workers. Maps name-worker, used at config time.
  @@ -223,23 +201,21 @@
*/
   struct jk_map *lbWorkerMap;
   
  +/** Support for some hardware load-balancing schemes.
  +If this is set, jk2 will only forward new requests to local
  +workers ( level=0 ). All other workers will get requests
  +with a session id.
  +
  +The value of this field will be used as a status code if
  +all local workers are down. This way the front load-balancers
  +will know this server shouldn't be used for new requests.
  +*/
  +int hwBalanceErr;
  +
   int workerCnt[JK_LB_LEVELS];
   jk_worker_t *workerTables[JK_LB_LEVELS][JK_LB_MAX_WORKERS];
   
   /*  Methods supported by all workers  */
  -/*
  - * Do whatever initialization needs to be done to start this worker up.
  - * Configuration options are passed in via the props parameter.  
  - *
  - * You can skip this by setting it to NULL.
  - */
  -int (JK_METHOD *init)(struct jk_env *env, jk_worker_t *_this);
  -
  -/*
  - * Shutdown this worker. XXX Some cleanup must be made by default
  - * by workerEnv, so we don't need to duplicate the code.
  - */
  -int (JK_METHOD *destroy)(struct jk_env *env, jk_worker_t *_thisP );
   
   /*
* Forward a request to the servlet engine.  The request is described
  
  
  

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




cvs commit: jakarta-tomcat-connectors/jk/native2/include jk_worker.h

2002-05-09 Thread costin

costin  02/05/09 13:58:13

  Modified:jk/native2/include jk_worker.h
  Log:
  Switch the lb_factor/lb_value to int. For now we'll just use a small int ( 0..255 )
  to represent the lb_value, and roll back to 0. The only role of lb_value
  is to make sure all workers get a similar amount of requests - with lb_factor
  giving more priority to some workers. There is little benefit on using floats
  for that, and a small int avoids the need for atomic operations.
  
  Note that we can still enhance the model to use the number of 'active connections'
  and favor the tomcat instances that have fewer active connections. We
  can also use the average response time ( after we add this info :-)
  
  Add multiple 'levels' - a genaralization of the 'local worker concept.
  At init time the channels are sorted by level in different tables
  ( currently we have 4 levels only, hardcoded - but I doubt we need more than 2 ).
  If all workers in a lower level are in error state, we move to the next.
  That removes the sepcial meaning of '0',
  
  Revision  ChangesPath
  1.19  +18 -16jakarta-tomcat-connectors/jk/native2/include/jk_worker.h
  
  Index: jk_worker.h
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/include/jk_worker.h,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- jk_worker.h   8 May 2002 23:47:27 -   1.18
  +++ jk_worker.h   9 May 2002 20:58:13 -   1.19
  @@ -58,7 +58,7 @@
   /***
* Description: Workers controller header file *
* Author:  Gal Shachor [EMAIL PROTECTED]   * 
  - * Version: $Revision: 1.18 $   *
  + * Version: $Revision: 1.19 $   *
***/
   
   #ifndef JK_WORKER_H
  @@ -87,6 +87,13 @@
   struct jk_map;
   typedef struct jk_worker jk_worker_t;
   
  +/* Number of lb levels/priorities. Workers are grouped by the level,
  +   lower levels will allways be prefered. If all workers in a level are
  +   in error state, we move to the next leve.
  +*/
  +#define JK_LB_LEVELS 4
  +#define JK_LB_MAX_WORKERS 256
  +
   /*
* The worker 'class', which represents something to which the web server
* can delegate requests. 
  @@ -181,8 +188,8 @@
* The information can be accessed by other components -
* for example to report status, etc.
*/
  -double  lb_factor;
  -double  lb_value;
  +int  lb_factor;
  +int  lb_value;
   
   /* Time when the last error occured on this worker */
   time_t  error_time;
  @@ -191,19 +198,14 @@
*  ( number of requests or time ), if no other worker is active
*  or when the configuration changes.
*/
  -int in_error_state;
  +int in_error_state;
   
   /* Worker priority.
* Workers with lower priority are allways preffered - regardless of lb_value
* This is user to represent 'local' workers ( we can call it 'proximity' or 
'distance' )
*/
  -int priority;
  +int level;
   
  -/* I have no idea what it means... */
  -int in_recovering;
  -/* I have no idea why we need this */
  -int retry_count;
  -
   /*  Information for reconfiguration  */
   
   /* Only one thread can update the config
  @@ -215,15 +217,15 @@
   
   /*  Information specific to the lb worker 
 */
   
  -/** For load balancing workers
  +/** Load balanced workers. Maps name-worker, used at config time.
  + *  When the worker is initialized or refreshed it'll set the runtime
  + *  tables.
*/
   struct jk_map *lbWorkerMap;
  -
  -/* Cache for fast access. Do we need it ? XXX Move to a private structure */
  -jk_worker_t **lb_workers;
  -int lb_workers_size;
  -int num_of_workers;
   
  +int workerCnt[JK_LB_LEVELS];
  +jk_worker_t *workerTables[JK_LB_LEVELS][JK_LB_MAX_WORKERS];
  +
   /*  Methods supported by all workers  */
   /*
* Do whatever initialization needs to be done to start this worker up.
  
  
  

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




cvs commit: jakarta-tomcat-connectors/jk/native2/include jk_worker.h

2002-04-25 Thread costin

costin  02/04/25 11:43:29

  Modified:jk/native2/include jk_worker.h
  Log:
  Added a 'version' and a critical section for updates.
  
  The workers are updated by lb/shm when a change is detected in the scoreboard.
  That need only in-process thread synchronization.
  
  ( we could use apr - but the CS is working fine for now )
  
  Revision  ChangesPath
  1.16  +8 -1  jakarta-tomcat-connectors/jk/native2/include/jk_worker.h
  
  Index: jk_worker.h
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/include/jk_worker.h,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- jk_worker.h   15 Apr 2002 23:46:01 -  1.15
  +++ jk_worker.h   25 Apr 2002 18:43:29 -  1.16
  @@ -58,7 +58,7 @@
   /***
* Description: Workers controller header file *
* Author:  Gal Shachor [EMAIL PROTECTED]   * 
  - * Version: $Revision: 1.15 $   *
  + * Version: $Revision: 1.16 $   *
***/
   
   #ifndef JK_WORKER_H
  @@ -179,6 +179,13 @@
*  which this worker is in error state and can't perform.
*/
   struct jk_exception *lastError;
  +
  +/* 'Version' or generation. Used to update the workers dynamically
  +   at runtime */
  +int ver;
  +/* Only one thread can update the config
  + */
  +JK_CRIT_SEC cs;
   
   /** For load balancing workers
*/
  
  
  

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




cvs commit: jakarta-tomcat-connectors/jk/native2/include jk_worker.h

2002-04-15 Thread costin

costin  02/04/15 16:46:01

  Modified:jk/native2/include jk_worker.h
  Log:
  Fix from Eugene Gluzberg drag0n2 at yahoo.com - when all workers are down
  we'll ignore the timeout and retry.
  
  Revision  ChangesPath
  1.15  +2 -1  jakarta-tomcat-connectors/jk/native2/include/jk_worker.h
  
  Index: jk_worker.h
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/include/jk_worker.h,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- jk_worker.h   12 Apr 2002 00:23:42 -  1.14
  +++ jk_worker.h   15 Apr 2002 23:46:01 -  1.15
  @@ -58,7 +58,7 @@
   /***
* Description: Workers controller header file *
* Author:  Gal Shachor [EMAIL PROTECTED]   * 
  - * Version: $Revision: 1.14 $   *
  + * Version: $Revision: 1.15 $   *
***/
   
   #ifndef JK_WORKER_H
  @@ -173,6 +173,7 @@
   double  lb_value;
   int in_error_state;
   int in_recovering;
  +int retry_count;
   time_t  error_time;
   /** Last exception recorded on this worker, the reason for
*  which this worker is in error state and can't perform.
  
  
  

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




cvs commit: jakarta-tomcat-connectors/jk/native2/include jk_worker.h

2002-04-11 Thread costin

costin  02/04/11 17:23:42

  Modified:jk/native2/include jk_worker.h
  Log:
  Add extra field to avoid reallocating the array all the time
  
  Revision  ChangesPath
  1.14  +7 -4  jakarta-tomcat-connectors/jk/native2/include/jk_worker.h
  
  Index: jk_worker.h
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/include/jk_worker.h,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- jk_worker.h   18 Mar 2002 17:56:40 -  1.13
  +++ jk_worker.h   12 Apr 2002 00:23:42 -  1.14
  @@ -58,7 +58,7 @@
   /***
* Description: Workers controller header file *
* Author:  Gal Shachor [EMAIL PROTECTED]   * 
  - * Version: $Revision: 1.13 $   *
  + * Version: $Revision: 1.14 $   *
***/
   
   #ifndef JK_WORKER_H
  @@ -179,12 +179,15 @@
*/
   struct jk_exception *lastError;
   
  -/** If num_of_workers  0 this is an load balancing worker
  +/** For load balancing workers
*/
  -jk_worker_t **lb_workers;
   struct jk_map *lbWorkerMap;
  -int num_of_workers;
   
  +/* Cache for fast access. Do we need it ? XXX Move to a private structure */
  +jk_worker_t **lb_workers;
  +int lb_workers_size;
  +int num_of_workers;
  +
   /*
* Do whatever initialization needs to be done to start this worker up.
* Configuration options are passed in via the props parameter.  
  
  
  

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




cvs commit: jakarta-tomcat-connectors/jk/native2/include jk_worker.h

2002-03-01 Thread costin

costin  02/03/01 21:42:12

  Modified:jk/native2/include jk_worker.h
  Log:
  Finally remove validate().
  
  Initialization is done using setProperty() followed by an init().
  The worker should be independent of the way it is configured -
  and 'smart' workers can change some settings at runtime.
  
  Adding individual setters and introspection is of course not
  easy in C, but setProperty() is close enough for what we
  need.
  
  Revision  ChangesPath
  1.12  +10 -19jakarta-tomcat-connectors/jk/native2/include/jk_worker.h
  
  Index: jk_worker.h
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/include/jk_worker.h,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- jk_worker.h   6 Feb 2002 19:19:16 -   1.11
  +++ jk_worker.h   2 Mar 2002 05:42:12 -   1.12
  @@ -58,7 +58,7 @@
   /***
* Description: Workers controller header file *
* Author:  Gal Shachor [EMAIL PROTECTED]   * 
  - * Version: $Revision: 1.11 $   *
  + * Version: $Revision: 1.12 $   *
***/
   
   #ifndef JK_WORKER_H
  @@ -152,10 +152,12 @@
   /** Communication channel used by the worker 
*/
   struct jk_channel *channel;
  +char *channelName;
   
   /** Reuse the endpoint and it's connection
*/
   struct jk_objCache *endpointCache;
  +int cache_sz;
   
   /** Request pool cache. XXX We may use a pool of requests.
*/
  @@ -181,33 +183,22 @@
   /** If num_of_workers  0 this is an load balancing worker
*/
   jk_worker_t **lb_workers;
  +struct jk_map *lbWorkerMap;
   int num_of_workers;
   
  -/*
  - * Given a worker which is in the process of being created, and a list
  - * of configuration options (or 'properties'), check to see if it the
  - * options are.  This will always be called before the init() method.
  - *
  - * This is different from init - see the apache config process.
  - * Validate should only do static checks on data ( if it has all
  - * the info it needs and if it's valid ). Init() can do any
  - * 'active' opertions.
  - *
  - * You can skip this by setting it to NULL.
  - */
  -int (JK_METHOD *validate)(struct jk_env *env, jk_worker_t *_this,
  -  struct jk_map *props,
  -  struct jk_workerEnv *we);
  +int (JK_METHOD *setProperty)(struct jk_env *env, jk_worker_t *_this,
  + char *name, char *value );
   
  +char *(JK_METHOD *getProperty)(struct jk_env *env, jk_worker_t *_this,
  +   char *name );
  +
   /*
* Do whatever initialization needs to be done to start this worker up.
* Configuration options are passed in via the props parameter.  
*
* You can skip this by setting it to NULL.
*/
  -int (JK_METHOD *init)(struct jk_env *env, jk_worker_t *_this,
  -  struct jk_map *props,
  -  struct jk_workerEnv *we );
  +int (JK_METHOD *init)(struct jk_env *env, jk_worker_t *_this);
   
   /*
* Shutdown this worker. XXX Some cleanup must be made by default
  
  
  

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Re: cvs commit: jakarta-tomcat-connectors/jk/native2/include jk_worker.h

2002-03-01 Thread Bill Barker


- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, March 01, 2002 9:42 PM
Subject: cvs commit: jakarta-tomcat-connectors/jk/native2/include
jk_worker.h


 costin  02/03/01 21:42:12

   Modified:jk/native2/include jk_worker.h
   Log:
   Finally remove validate().

   Initialization is done using setProperty() followed by an init().
   The worker should be independent of the way it is configured -
   and 'smart' workers can change some settings at runtime.

   Adding individual setters and introspection is of course not
   easy in C, but setProperty() is close enough for what we
   need.

So, I guess in JK3 we'll need full-blown C++ style vtables and interface
discovery? We'll have almost managed to re-invent COM. ;-)


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




cvs commit: jakarta-tomcat-connectors/jk/native2/include jk_worker.h

2002-01-25 Thread costin

costin  02/01/25 22:41:51

  Modified:jk/native2/include jk_worker.h
  Log:
  Added a cache for requests. Right now we recycle the pools ( it used to be part
  of the endpoint logic, I just preserved it ). It would make more sense to
  recycle the whole request, like we do in java - or don't bother at all,
  allocation is much cheaper ( and is even cheaper if apr_pools are used -
  the jk_pool does a malloc ). For now I'll leave it how it was.
  
  Get endpoint is gone, it's up to the worker to use an endpoint if it wants
  and how it uses it. Service is in - that's what the worker is supposed to do.
  
  Revision  ChangesPath
  1.10  +19 -24jakarta-tomcat-connectors/jk/native2/include/jk_worker.h
  
  Index: jk_worker.h
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/include/jk_worker.h,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- jk_worker.h   16 Dec 2001 23:17:23 -  1.9
  +++ jk_worker.h   26 Jan 2002 06:41:51 -  1.10
  @@ -58,7 +58,7 @@
   /***
* Description: Workers controller header file *
* Author:  Gal Shachor [EMAIL PROTECTED]   * 
  - * Version: $Revision: 1.9 $   *
  + * Version: $Revision: 1.10 $   *
***/
   
   #ifndef JK_WORKER_H
  @@ -102,10 +102,6 @@
* There is also a load balancing worker (jk_lb_worker.c), which itself
* manages a group of workers.
*
  - * Web servers are configured to forward requests to a given worker.  To
  - * handle those requests, the worker's get_endpoint method is called, and
  - * then the service() method of that endpoint is called.
  - *
* As with all the core jk classes, this is essentially an abstract base
* class which is implemented/extended by classes which are specific to a
* particular protocol (or request-handling system).  By using an abstract
  @@ -124,7 +120,8 @@
* imagine that you are seeing the internal vtables of your favorite OO
* language.  Whatever works for you.
*
  - * See jk_ajp14_worker.c, jk_ajp13_worker.c and jk_ajp12_worker.c for examples.  
  + * See jk_ajp14_worker.c, jk_worker_status for examples.  
  + *
*/
   struct jk_worker {
   
  @@ -159,6 +156,10 @@
   /** Reuse the endpoint and it's connection
*/
   struct jk_objCache *endpointCache;
  +
  +/** Request pool cache. XXX We may use reqCache.
  + */
  +struct jk_objCache *rPoolCache;
   
   /* 
* Open connections cache...
  @@ -214,34 +215,28 @@
   /*
* Do whatever initialization needs to be done to start this worker up.
* Configuration options are passed in via the props parameter.  
  + *
  + * You can skip this by setting it to NULL.
*/
   int (JK_METHOD *init)(struct jk_env *env, jk_worker_t *_this,
 struct jk_map *props,
 struct jk_workerEnv *we );
   
   /*
  - * Obtain an endpoint to service a particular request.  A pointer to
  - * the endpoint is stored in pend. The done() method in the
  - * endpoint will be called when the endpoint is no longer needed.
  + * Shutdown this worker. XXX Some cleanup must be made by default
  + * by workerEnv, so we don't need to duplicate the code.
*/
  -int (JK_METHOD *get_endpoint)(struct jk_env *env, jk_worker_t *_this,
  -  struct jk_endpoint **pend );
  +int (JK_METHOD *destroy)(struct jk_env *env, jk_worker_t *_thisP );
   
   /*
  - * Called when this particular endpoint has finished processing a
  - * request.  For some protocols (e.g. ajp12), this frees the memory
  - * associated with the endpoint.  For others (e.g. ajp13/ajp14), this can
  - * return the endpoint to a cache of already opened endpoints.  
  - */
  -/* int (JK_METHOD *done)(jk_env_t *env, */
  -/*   jk_worker_t *_this, */
  -/*   struct jk_endpoint *p ); */
  -
  + * Forward a request to the servlet engine.  The request is described
  + * by the jk_ws_service_t object.  I'm not sure exactly how
  + * is_recoverable_error is being used.  
  + */
  +int (JK_METHOD *service)(struct jk_env *env,
  + struct jk_worker *_this,
  + struct jk_ws_service *s);
   
  -/*
  - * Shutdown this worker. 
  - */
  -int (JK_METHOD *destroy)(struct jk_env *env, jk_worker_t *_thisP );
   };
   
   #ifdef __cplusplus
  
  
  

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: 

cvs commit: jakarta-tomcat-connectors/jk/native2/include jk_worker.h

2001-12-12 Thread costin

costin  01/12/12 14:01:49

  Modified:jk/native2/include jk_worker.h
  Log:
  Removed the login_struct, it's private to the login handler.
  
  The secret is now a property of the worker (not specific to ajp14 ).
  
  logon method is no longer needed, normal message handlers are used instead.
  
  Revision  ChangesPath
  1.6   +5 -52 jakarta-tomcat-connectors/jk/native2/include/jk_worker.h
  
  Index: jk_worker.h
  ===
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/include/jk_worker.h,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- jk_worker.h   2001/12/07 23:10:34 1.5
  +++ jk_worker.h   2001/12/12 22:01:49 1.6
  @@ -58,7 +58,7 @@
   /***
* Description: Workers controller header file *
* Author:  Gal Shachor [EMAIL PROTECTED]   * 
  - * Version: $Revision: 1.5 $   *
  + * Version: $Revision: 1.6 $   *
***/
   
   #ifndef JK_WORKER_H
  @@ -71,6 +71,7 @@
   #include jk_mt.h
   #include jk_uriMap.h
   #include jk_objCache.h
  +#include jk_msg.h
   
   #ifdef __cplusplus
   extern C {
  @@ -80,55 +81,10 @@
   struct jk_endpoint;
   struct jk_env;
   struct jk_objCache;
  +struct jk_msg;
   typedef struct jk_worker jk_worker_t;
   
  -
   /*
  - * The login structure
  - */
  -typedef struct jk_login_service jk_login_service_t;
  -#define AJP14_ENTROPY_SEED_LEN   32  /* we're using MD5 = 32 chars 
*/
  -#define AJP14_COMPUTED_KEY_LEN   32  /* we're using MD5 also */
  -
  -struct jk_login_service {
  -
  -/*
  - *  Pointer to web-server name
  - */
  -char * web_server_name;
  -
  -/*
  - * Pointer to servlet-engine name
  - */
  -char * servlet_engine_name;
  -
  -/*
  - * Pointer to secret key
  - */
  -char * secret_key;
  -
  -/*
  - * Received entropy seed
  - */
  -char entropy[AJP14_ENTROPY_SEED_LEN + 1];
  -
  -/*
  - * Computed key
  - */
  -char computed_key[AJP14_COMPUTED_KEY_LEN + 1];
  -
  -/*
  - *  What we want to negociate
  - */
  -unsigned long negociation;
  -
  -/*
  - * What we received from servlet engine 
  - */
  -unsigned long negociated;
  -};
  -
  -/*
* The worker 'class', which represents something to which the web server
* can delegate requests. 
*
  @@ -213,7 +169,8 @@
   /* struct jk_endpoint **ep_cache; */
   
   int proto;
  -struct jk_login_service *login;
  +/* Password for ajp14+ connections. If null we default to ajp13.*/
  +char * secret;
   
   /* Each worker can be part of a load-balancer scheme.
* The information can be accessed by other components -
  @@ -230,10 +187,6 @@
   jk_worker_t **lb_workers;
   int num_of_workers;
   
  -int (* logon)(struct jk_endpoint *ae,
  -  jk_logger_t*l);
  -
  -
   /*
* For all of the below (except destroy), the first argument is
* essentially a 'this' pointer.  
  
  
  

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]