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/common jk_workerEnv.c
Date Tue, 26 Mar 2002 03:03:43 GMT
costin      02/03/25 19:03:43

  Modified:    jk/native2/common jk_workerEnv.c
  Log:
  Update for the interface changes.
  
  Remove the duplicated worker creation code, jk_env takes care of pool allocation.
  
  Revision  Changes    Path
  1.22      +29 -40    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.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- jk_workerEnv.c	23 Mar 2002 17:27:13 -0000	1.21
  +++ jk_workerEnv.c	26 Mar 2002 03:03:43 -0000	1.22
  @@ -59,7 +59,7 @@
    * Description: Workers controller                                         *
    * Author:      Gal Shachor <shachor@il.ibm.com>                           *
    * Author:      Henri Gomez <hgomez@slib.fr>                               *
  - * Version:     $Revision: 1.21 $                                           *
  + * Version:     $Revision: 1.22 $                                           *
    ***************************************************************************/
   
   #include "jk_env.h"
  @@ -172,19 +172,17 @@
           jk_worker_t *w= wEnv->worker_map->valueAt( env, wEnv->worker_map, i );
           int err;
   
  -        if( w->init != NULL )
  +        if( w->init != NULL ) {
               err=w->init(env, w);
       
  -        if(err!=JK_TRUE) {
  -            if( w->destroy != NULL ) 
  -                w->destroy(env, w);
  -            env->l->jkLog(env, env->l, JK_LOG_ERROR,
  -                          "workerEnv.initWorkers() init failed for %s\n", 
  -                          name); 
  +            if(err!=JK_TRUE) {
  +                if( w->destroy != NULL ) 
  +                    w->destroy(env, w);
  +                env->l->jkLog(env, env->l, JK_LOG_ERROR,
  +                              "workerEnv.initWorkers() init failed for %s\n", 
  +                              name); 
  +            }
           }
  -    
  -        env->l->jkLog(env, env->l, JK_LOG_INFO,
  -                      "workerEnv.initWorkers(): init ok %s\n", name);
       }
       return JK_TRUE;
   }
  @@ -204,9 +202,11 @@
   
           char *name= registry->nameAt( env, registry, i );
           if( strncmp( name, "handler.", 8 ) == 0 ) {
  -            handler=(jk_handler_t *)env->createInstance(env, wEnv->pool, name, name
 );
  -            if( handler!=NULL )
  -                handler->init( env, handler, wEnv );
  +            jk_bean_t *jkb=env->createBean2(env, wEnv->pool, name, ""  );
  +            if( jkb==NULL || jkb->object==NULL )
  +                continue;
  +            handler=(jk_handler_t *)jkb->object;
  +            handler->init( env, handler, wEnv );
           }
       }
   }
  @@ -233,7 +233,7 @@
   
       env->l->init( env, env->l );
   
  -    configFile=wEnv->initData->get( env, wEnv->initData, "config.file" );
  +    configFile=wEnv->config->file;
       env->l->jkLog(env, env->l, JK_LOG_ERROR, "workerEnv.init() %s\n", configFile
);
       if(  configFile == NULL ) {
           wEnv->config->setPropertyString( env, wEnv->config,
  @@ -416,7 +416,7 @@
   }
   
   static jk_worker_t *jk2_workerEnv_createWorker(jk_env_t *env,
  -                                            jk_workerEnv_t *wEnv,
  +                                               jk_workerEnv_t *wEnv,
                                                  char *type, char *name) 
   {
       int err=JK_TRUE;
  @@ -424,6 +424,7 @@
       jk_worker_t *w = NULL;
       jk_worker_t *oldW = NULL;
       jk_pool_t *workerPool;
  +    jk_bean_t *jkb;
   
       /* First find if it already exists */
       w=env->getByName( env, name );
  @@ -433,38 +434,24 @@
                         name);
           return w;
       }
  -
  -    workerPool=wEnv->pool->create(env, wEnv->pool, HUGE_POOL_SIZE);
  -
  -    /* Each worker has it's own pool */
  -    if( type == NULL ) type="ajp13";
       
  +    jkb=env->createBean(env, wEnv->pool, name );
   
  -    w=(jk_worker_t *)env->createInstance(env, workerPool, type, name );
  -
  -    if( w == NULL ) {
  +    if( jkb == NULL || jkb->object==NULL ) {
           env->l->jkLog(env, env->l, JK_LOG_ERROR,
  -                "workerEnv.createWorker(): factory can't create worker %s:%s\n",
  +                      "workerEnv.createWorker(): factory can't create worker %s:%s\n",
                         type, name); 
           return NULL;
       }
  +    w=(jk_worker_t *)jkb->object;
   
  -    w->pool=workerPool;
       w->workerEnv=wEnv;
   
  -    w->rPoolCache= jk2_objCache_create( env, workerPool  );
  +    w->rPoolCache= jk2_objCache_create( env, w->pool  );
       err=w->rPoolCache->init( env, w->rPoolCache,
                                       1024 ); /* XXX make it unbound */
       wEnv->worker_map->put(env, wEnv->worker_map, name, w, (void *)&oldW);
               
  -    if(oldW!=NULL) {
  -        env->l->jkLog(env, env->l, JK_LOG_ERROR,
  -                      "workerEnv.createWorker() duplicated %s worker \n",
  -                      name);
  -        if( w->destroy != NULL )
  -            oldW->destroy(env, oldW);
  -    }
  -    
       return w;
   }
   
  @@ -476,6 +463,7 @@
       jk_workerEnv_t *wEnv;
       int err;
       jk_pool_t *uriMapPool;
  +    jk_bean_t *jkb;
   
       env->l->jkLog(env, env->l, JK_LOG_DEBUG, "Creating workerEnv \n");
   
  @@ -551,17 +539,18 @@
   
       jk2_map_default_create(env,&wEnv->worker_map, wEnv->pool);
   
  -    uriMapPool = wEnv->pool->create(env, wEnv->pool, HUGE_POOL_SIZE);
  -    
  -    wEnv->uriMap=env->createInstance(env, uriMapPool,"uriMap", "uriMap");
  +    jkb=env->createBean2(env, wEnv->pool,"uriMap", "");
   
  -    if( wEnv->uriMap==NULL ) {
  +    if( jkb==NULL ) {
           env->l->jkLog(env, env->l, JK_LOG_ERROR,
                         "Error getting uriMap implementation\n");
           return JK_FALSE;
       }
  +    wEnv->uriMap=jkb->object;
   
  -    wEnv->config=env->createInstance(env, pool,"config", "config");
  +    jkb=env->createBean2(env, wEnv->pool,"config", "");
  +    env->alias(env, "config:", "config");
  +    wEnv->config=jkb->object;
       wEnv->config->workerEnv = wEnv;
       wEnv->config->map = wEnv->initData;
       
  
  
  

--
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