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_worker_ajp13.c jk_worker_lb.c
Date Tue, 08 Apr 2003 03:59:02 GMT
costin      2003/04/07 20:59:01

  Modified:    jk/native2/common jk_worker_ajp13.c jk_worker_lb.c
  Log:
  A small lb feature - allow lb to specify explicitely where to redirect a
  specific worker. This can be used with clustering.
  I did some basic testing ( using JMX to control the redirection ), but it
  needs more.
  
  Revision  Changes    Path
  1.48      +7 -3      jakarta-tomcat-connectors/jk/native2/common/jk_worker_ajp13.c
  
  Index: jk_worker_ajp13.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/common/jk_worker_ajp13.c,v
  retrieving revision 1.47
  retrieving revision 1.48
  diff -u -r1.47 -r1.48
  --- jk_worker_ajp13.c	12 Mar 2003 00:41:32 -0000	1.47
  +++ jk_worker_ajp13.c	8 Apr 2003 03:59:01 -0000	1.48
  @@ -83,13 +83,13 @@
   
   /* -------------------- Impl -------------------- */
   static char *jk2_worker_ajp13_getAttributeInfo[]={ "lb_factor", "lb_value", "debug", "channel",
"level",
  -                                                   "route", "errorState", "graceful", "groups",
"disabled", 
  +                                                   "route", "routeRedirect", "errorState",
"graceful", "groups", "disabled", 
                                                      "epCount", "errorTime", NULL };
   
   static char *jk2_worker_ajp13_multiValueInfo[]={"group", NULL };
   
  -static char *jk2_worker_ajp13_setAttributeInfo[]={"debug", "channel", "route", "secretkey",
"group", "graceful", "disabled", 
  -                                                  "lb_factor", "level", NULL };
  +static char *jk2_worker_ajp13_setAttributeInfo[]={"debug", "channel", "route", "routeRedirect","secretkey",
"group", "graceful",
  +                                                  "disabled", "lb_factor", "level", NULL
};
   
   
   static void * JK_METHOD jk2_worker_ajp13_getAttribute(jk_env_t *env, jk_bean_t *bean, char
*name ) {
  @@ -103,6 +103,8 @@
               return worker->channelName;
       } else if (strcmp( name, "route" )==0 ) {
           return worker->route;
  +    } else if (strcmp( name, "routeRedirect" )==0 ) {
  +        return worker->routeRedirect;
       } else if (strcmp( name, "debug" )==0 ) {
           return jk2_env_itoa( env,  bean->debug );
       } else if (strcmp( name, "groups" )==0 ) {
  @@ -146,6 +148,8 @@
           ajp13->route=value;
       } else if( strcmp( name, "route" )==0 ) {
           ajp13->route=value;
  +    } else if( strcmp( name, "routeRedirect" )==0 ) {
  +        ajp13->routeRedirect=value;
       } else if( strcmp( name, "graceful" )==0 ) {
           ajp13->graceful=atoi( value );
       } else if( strcmp( name, "disabled" )==0 ) {
  
  
  
  1.33      +33 -1     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.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- jk_worker_lb.c	4 Mar 2003 07:21:00 -0000	1.32
  +++ jk_worker_lb.c	8 Apr 2003 03:59:01 -0000	1.33
  @@ -114,13 +114,18 @@
       int level;
       int currentLevel=JK_LB_LEVELS - 1;
       char *session_route = NULL;
  +    char *routeRedirect=NULL;
       time_t now = 0;
       jk_worker_lb_private_t *lb_priv = lb->worker_private;
   
       if(lb_priv->sticky_session) {
           session_route = jk2_requtil_getSessionRoute(env, s);
       }
  -       
  +
  +    if( lb->mbean->debug > 0 ) {
  +        env->l->jkLog(env, env->l, JK_LOG_DEBUG,
  +                      "lb.get_worker %d Session=%s\n", lb_priv->sticky_session, (session_route?
session_route: "NULL"));
  +    }
       if(session_route) {
           for( level=0; level<JK_LB_LEVELS; level++ ) {
               for(i = 0 ; i < lb->workerCnt[level]; i++) {
  @@ -128,6 +133,33 @@
                   
                   if(w->route != NULL &&
                      0 == strcmp(session_route, w->route)) {
  +                    if( w->routeRedirect != NULL ) {
  +                        /* Session was migrated to another worker */
  +                        routeRedirect=w->routeRedirect;
  +                        break;
  +                    }
  +                    
  +                    if(attempt > 0 && w->in_error_state) {
  +                        /* We already tried to revive this worker. */
  +                        break;
  +                    } else {
  +                        return w;
  +                    }
  +                }
  +            }
  +        }
  +    }
  +    /* We have a session - but the worker is in error state
  +       or has a "redirect".
  +       Try the new worker.
  +    */
  +    if(routeRedirect != NULL) {
  +        for( level=0; level<JK_LB_LEVELS; level++ ) {
  +            for(i = 0 ; i < lb->workerCnt[level]; i++) {
  +                jk_worker_t *w=lb->workerTables[level][i];
  +                
  +                if(w->route != NULL &&
  +                   0 == strcmp(routeRedirect, w->route)) {
                       if(attempt > 0 && w->in_error_state) {
                           /* We already tried to revive this worker. */
                           break;
  
  
  

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


Mime
View raw message