tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cos...@apache.org
Subject cvs commit: jakarta-tomcat-connectors/jk/native2/include jk_workerEnv.h
Date Sun, 02 Dec 2001 01:04:51 GMT
costin      01/12/01 17:04:51

  Modified:    jk/native2/common jk_workerEnv.c
               jk/native2/include jk_workerEnv.h
  Log:
  Added a 'perThreadWorker' option to replace the #ifdef REUSE_WORKER.
  
  This is the experimental option that uses per thread data instead of
  object pool to recycle connections.
  
  It's usually better to use runtime options instead of compile preprocessing.
  
  Revision  Changes    Path
  1.2       +30 -23    jakarta-tomcat-connectors/jk/native2/common/jk_workerEnv.c
  
  Index: jk_workerEnv.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_workerEnv.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- jk_workerEnv.c	2001/12/01 22:35:27	1.1
  +++ jk_workerEnv.c	2001/12/02 01:04:51	1.2
  @@ -59,7 +59,7 @@
    * Description: Workers controller                                         *
    * Author:      Gal Shachor <shachor@il.ibm.com>                           *
    * Author:      Henri Gomez <hgomez@slib.fr>                               *
  - * Version:     $Revision: 1.1 $                                           *
  + * Version:     $Revision: 1.2 $                                           *
    ***************************************************************************/
   
   #include "jk_workerEnv.h" 
  @@ -77,6 +77,7 @@
   {
       jk_map_t *init_data=_this->init_data;
       char **worker_list  = NULL;
  +    jk_logger_t *l=_this->l;
       unsigned i;
       int err;
   
  @@ -91,10 +92,12 @@
       for(i = 0 ; i < _this->num_of_workers ; i++) {
           jk_worker_t *w = NULL;
           jk_worker_t *oldw = NULL;
  +        const char *name=(const char*)worker_list[i];
   
  -        w=_this->createWorker(_this, worker_list[i], init_data);
  +        w=_this->createWorker(_this, name, init_data);
  +        w->channel=NULL;
           if( w==NULL ) {
  -            jk_log(_this->l, JK_LOG_ERROR,
  +            l->jkLog(_this->l, JK_LOG_ERROR,
                      "init failed to create worker %s\n", 
                      worker_list[i]);
               /* Ignore it, other workers may be ok.
  @@ -103,7 +106,7 @@
               map_put(_this->worker_map, worker_list[i], w, (void *)&oldw);
           
               if(oldw!=NULL) {
  -                jk_log(_this->l, JK_LOG_DEBUG, 
  +                l->jkLog(_this->l, JK_LOG_DEBUG, 
                          "build_worker_map, removing old %s worker \n",
                          worker_list[i]);
                   oldw->destroy(&oldw, _this->l);
  @@ -113,9 +116,9 @@
           }
       }
   
  -    jk_log(_this->l, JK_LOG_DEBUG, "build_worker_map, done\n"); 
  +    l->jkLog(_this->l, JK_LOG_DEBUG, "build_worker_map, done\n"); 
   
  -    jk_log(_this->l, JK_LOG_DEBUG,
  +    l->jkLog(_this->l, JK_LOG_DEBUG,
              "workerEnv.init() done: %d %s\n", _this->num_of_workers, worker_list[0]);

       return JK_TRUE;
   }
  @@ -136,13 +139,13 @@
       for(i = 0 ; i < sz ; i++) {
           jk_worker_t *w = map_value_at(_this->worker_map, i);
           if(w) {
  -            jk_log(l, JK_LOG_DEBUG,
  +            l->jkLog(l, JK_LOG_DEBUG,
                      "destroy worker %s\n",
                      map_name_at(_this->worker_map, i));
               w->destroy(&w, l);
           }
       }
  -    jk_log(_this->l, JK_LOG_DEBUG, "workerEnv.close() done %d\n", sz); 
  +    l->jkLog(_this->l, JK_LOG_DEBUG, "workerEnv.close() done %d\n", sz); 
       map_free(&_this->worker_map);
   }
   
  @@ -150,16 +153,17 @@
                                                     const char *name )
   {
       jk_worker_t * rc;
  -
  +    jk_logger_t *l=_this->l;
  +    
       if(!name) {
  -        jk_log(_this->l, JK_LOG_ERROR, "wc_get_worker_for_name NULL name\n");
  +        l->jkLog(l, JK_LOG_ERROR, "wc_get_worker_for_name NULL name\n");
           return NULL;
       }
   
       rc = map_get(_this->worker_map, name, NULL);
   
       if( rc==NULL ) {
  -        jk_log(_this->l, JK_LOG_ERROR, "getWorkerForName: no worker found for %s \n",
name);
  +        l->jkLog(l, JK_LOG_ERROR, "getWorkerForName: no worker found for %s \n", name);
       } 
       return rc;
   }
  @@ -171,6 +175,7 @@
       int err;
       char *type;
       jk_env_objectFactory_t fac;
  +    jk_logger_t *l=_this->l;
       jk_worker_t *w = NULL;
   
       type=map_getStrProp( init_data,"worker",name,"type",NULL );
  @@ -178,7 +183,7 @@
       w=(jk_worker_t *)_this->env->getInstance(_this->env, "worker", type );
       
       if( w == NULL ) {
  -        jk_log(_this->l, JK_LOG_ERROR,
  +        l->jkLog(l, JK_LOG_ERROR,
                  "workerEnv.createWorker(): factory can't create worker %s:%s\n",
                  type, name); 
           return JK_FALSE;
  @@ -187,24 +192,24 @@
       w->name=(char *)name;
       w->workerEnv=_this;
       
  -    err=w->validate(w, init_data, _this, _this->l);
  +    err=w->validate(w, init_data, _this, l);
       
       if( err!=JK_TRUE ) {
  -        jk_log(_this->l, JK_LOG_ERROR,
  +        l->jkLog(l, JK_LOG_ERROR,
                  "workerEnv.createWorker(): validate failed for %s:%s\n", 
                  type, name); 
  -        w->destroy(&w, _this->l);
  +        w->destroy(&w, l);
           return NULL;
       }
       
  -    jk_log(_this->l, JK_LOG_DEBUG,
  +    l->jkLog(l, JK_LOG_DEBUG,
              "workerEnv.createWorker(): validated %s:%s\n",
              type, name);
       
  -    err=w->init(w, init_data, _this, _this->l);
  +    err=w->init(w, init_data, _this, l);
       if(err!=JK_TRUE) {
  -        w->destroy(&w, _this->l);
  -        jk_log(_this->l, JK_LOG_ERROR, "workerEnv.createWorker() init failed for %s\n",

  +        w->destroy(&w, l);
  +        l->jkLog(l, JK_LOG_ERROR, "workerEnv.createWorker() init failed for %s\n", 
                  name); 
           return NULL;
       }
  @@ -219,13 +224,13 @@
       jk_workerEnv_t *_this;
       int err;
   
  -    jk_log(l, JK_LOG_DEBUG, "Creating workerEnv \n");
  +    l->jkLog(l, JK_LOG_DEBUG, "Creating workerEnv \n");
   
       _this=(jk_workerEnv_t *)calloc( 1, sizeof( jk_workerEnv_t ));
       *result=_this;
   
  -    _this->worker_properties = NULL;
  -    map_alloc(& _this->worker_properties);
  +    _this->init_data = NULL;
  +    map_alloc(& _this->init_data);
   
       _this->worker_file     = NULL;
       _this->log_file        = NULL;
  @@ -286,16 +291,18 @@
                                              "default");
   
       if( _this->uriMap==NULL ) {
  -        jk_log(l, JK_LOG_ERROR, "Error getting uriMap implementation\n");
  +        l->jkLog(l, JK_LOG_ERROR, "Error getting uriMap implementation\n");
           return;
       }
   
       _this->uriMap->workerEnv = _this;
  +    _this->perThreadWorker=0;
       
       /* methods */
       _this->init=&jk_workerEnv_init;
       _this->getWorkerForName=&jk_workerEnv_getWorkerForName;
       _this->close=&jk_workerEnv_close;
  +    _this->createWorker=&jk_workerEnv_createWorker;
   
       
       return JK_TRUE;
  
  
  
  1.2       +5 -2      jakarta-tomcat-connectors/jk/native2/include/jk_workerEnv.h
  
  Index: jk_workerEnv.h
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/include/jk_workerEnv.h,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- jk_workerEnv.h	2001/12/01 22:01:02	1.1
  +++ jk_workerEnv.h	2001/12/02 01:04:51	1.2
  @@ -58,7 +58,7 @@
   /***************************************************************************
    * Description: Workers controller header file                             *
    * Author:      Gal Shachor <shachor@il.ibm.com>                           * 
  - * Version:     $Revision: 1.1 $                                           *
  + * Version:     $Revision: 1.2 $                                           *
    ***************************************************************************/
   
   #ifndef JK_WORKERENV_H
  @@ -139,7 +139,6 @@
       /*
        * Worker stuff
        */
  -    jk_map_t *worker_properties;
       char     *worker_file;
   
       char     *secret_key;
  @@ -169,6 +168,10 @@
        */
       int options;
   
  +    /** Old REUSE_WORKER define. Instead of using an object pool, use
  +        thread data to recycle the connection. */
  +    int perThreadWorker;
  +    
       /*
        * Environment variables support
        */
  
  
  

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


Mime
View raw message