tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rj...@apache.org
Subject svn commit: r611602 - in /tomcat/connectors/trunk/jk/native/common: jk_lb_worker.c jk_lb_worker.h jk_status.c
Date Sun, 13 Jan 2008 17:20:49 GMT
Author: rjung
Date: Sun Jan 13 09:20:47 2008
New Revision: 611602

URL: http://svn.apache.org/viewvc?rev=611602&view=rev
Log:
Rename worker_record into lb_sub_worker and
make order of struct members more consistent.
No functional change.

Modified:
    tomcat/connectors/trunk/jk/native/common/jk_lb_worker.c
    tomcat/connectors/trunk/jk/native/common/jk_lb_worker.h
    tomcat/connectors/trunk/jk/native/common/jk_status.c

Modified: tomcat/connectors/trunk/jk/native/common/jk_lb_worker.c
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_lb_worker.c?rev=611602&r1=611601&r2=611602&view=diff
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_lb_worker.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_lb_worker.c Sun Jan 13 09:20:47 2008
@@ -180,7 +180,7 @@
 }
 
 /* Return the string representation of the balance worker state */
-const char *jk_lb_get_state(worker_record_t *p, jk_logger_t *l)
+const char *jk_lb_get_state(lb_sub_worker_t *p, jk_logger_t *l)
 {
     return lb_state_type[p->s->state];
 }
@@ -209,7 +209,7 @@
 }
 
 /* Return the string representation of the balance worker activation */
-const char *jk_lb_get_activation(worker_record_t *p, jk_logger_t *l)
+const char *jk_lb_get_activation(lb_sub_worker_t *p, jk_logger_t *l)
 {
     return lb_activation_type[p->activation];
 }
@@ -284,7 +284,7 @@
     p->sequence = p->s->h.sequence;
 
     for (i = 0; i < p->num_of_workers; i++) {
-        worker_record_t *w = &p->lb_workers[i];
+        lb_sub_worker_t *w = &p->lb_workers[i];
         if (w->sequence != w->s->h.sequence) {
             if (JK_IS_DEBUG_LEVEL(l))
                 jk_log(l, JK_LOG_DEBUG,
@@ -325,7 +325,7 @@
     p->s->h.sequence = p->sequence;
 
     for (i = 0; i < p->num_of_workers; i++) {
-        worker_record_t *w = &p->lb_workers[i];
+        lb_sub_worker_t *w = &p->lb_workers[i];
         if (w->sequence != w->s->h.sequence) {
             if (JK_IS_DEBUG_LEVEL(l))
                 jk_log(l, JK_LOG_DEBUG,
@@ -461,7 +461,7 @@
 {
     int i = 0;
     for (i = 0; i < num_of_workers; i++) {
-        p->lb_workers[i].w->destroy(&(p->lb_workers[i].w), l);
+        p->lb_workers[i].worker->destroy(&(p->lb_workers[i].worker), l);
     }
 }
 
@@ -483,7 +483,7 @@
     unsigned int i;
     int non_error = 0;
     int elapsed;
-    worker_record_t *w = NULL;
+    lb_sub_worker_t *w = NULL;
     JK_TRACE_ENTER(l);
 
     if (p->sequence != p->s->h.sequence)
@@ -528,7 +528,7 @@
 {
     unsigned int i;
     int forced = 0;
-    worker_record_t *w = NULL;
+    lb_sub_worker_t *w = NULL;
     JK_TRACE_ENTER(l);
 
     for (i = 0; i < p->num_of_workers; i++) {
@@ -583,8 +583,8 @@
         lb_worker_t *lb = (lb_worker_t *)p->worker_private;
 
         for (i = 0; i < lb->num_of_workers; i++) {
-            if (lb->lb_workers[i].w->maintain) {
-                lb->lb_workers[i].w->maintain(lb->lb_workers[i].w, now, l);
+            if (lb->lb_workers[i].worker->maintain) {
+                lb->lb_workers[i].worker->maintain(lb->lb_workers[i].worker, now,
l);
             }
         }
 
@@ -621,12 +621,12 @@
     return JK_TRUE;
 }
 
-static worker_record_t *find_by_session(lb_worker_t *p,
+static lb_sub_worker_t *find_by_session(lb_worker_t *p,
                                         const char *name,
                                         jk_logger_t *l)
 {
 
-    worker_record_t *rc = NULL;
+    lb_sub_worker_t *rc = NULL;
     unsigned int i;
 
     for (i = 0; i < p->num_of_workers; i++) {
@@ -638,7 +638,7 @@
     return rc;
 }
 
-static worker_record_t *find_best_bydomain(lb_worker_t *p,
+static lb_sub_worker_t *find_best_bydomain(lb_worker_t *p,
                                            const char *domain,
                                            jk_logger_t *l)
 {
@@ -646,7 +646,7 @@
     int d = 0;
     jk_uint64_t curmin = 0;
 
-    worker_record_t *candidate = NULL;
+    lb_sub_worker_t *candidate = NULL;
 
     /* First try to see if we have available candidate */
     for (i = 0; i < p->num_of_workers; i++) {
@@ -672,7 +672,7 @@
 }
 
 
-static worker_record_t *find_best_byvalue(lb_worker_t *p,
+static lb_sub_worker_t *find_best_byvalue(lb_worker_t *p,
                                           jk_logger_t *l)
 {
     unsigned int i;
@@ -682,7 +682,7 @@
     jk_uint64_t curmin = 0;
 
     /* find the least busy worker */
-    worker_record_t *candidate = NULL;
+    lb_sub_worker_t *candidate = NULL;
 
     offset = p->next_offset;
 
@@ -707,13 +707,13 @@
     return candidate;
 }
 
-static worker_record_t *find_bysession_route(lb_worker_t *p,
+static lb_sub_worker_t *find_bysession_route(lb_worker_t *p,
                                              const char *name,
                                              int *route_is_domain,
                                              jk_logger_t *l)
 {
     int uses_domain  = 0;
-    worker_record_t *candidate = NULL;
+    lb_sub_worker_t *candidate = NULL;
 
     candidate = find_by_session(p, name, l);
     if (!candidate) {
@@ -746,11 +746,11 @@
     return candidate;
 }
 
-static worker_record_t *find_failover_worker(lb_worker_t * p,
+static lb_sub_worker_t *find_failover_worker(lb_worker_t * p,
                                              int *route_is_domain,
                                              jk_logger_t *l)
 {
-    worker_record_t *rc = NULL;
+    lb_sub_worker_t *rc = NULL;
     unsigned int i;
     const char *redirect = NULL;
 
@@ -765,11 +765,11 @@
     return rc;
 }
 
-static worker_record_t *find_best_worker(lb_worker_t * p,
+static lb_sub_worker_t *find_best_worker(lb_worker_t * p,
                                          int *route_is_domain,
                                          jk_logger_t *l)
 {
-    worker_record_t *rc = NULL;
+    lb_sub_worker_t *rc = NULL;
 
     rc = find_best_byvalue(p, l);
     /* By default use worker route as session route */
@@ -778,12 +778,12 @@
     return rc;
 }
 
-static worker_record_t *get_most_suitable_worker(lb_worker_t * p,
+static lb_sub_worker_t *get_most_suitable_worker(lb_worker_t * p,
                                                  char *sessionid,
                                                  int *route_is_domain,
                                                  jk_logger_t *l)
 {
-    worker_record_t *rc = NULL;
+    lb_sub_worker_t *rc = NULL;
     int r;
 
     JK_TRACE_ENTER(l);
@@ -882,7 +882,7 @@
 
 static void lb_add_log_items(jk_ws_service_t *s,
                              const char *const *log_names,
-                             worker_record_t *w,
+                             lb_sub_worker_t *w,
                              jk_logger_t *l)
 {
     const char **log_values = jk_pool_alloc(s->pool, sizeof(char *) * JK_LB_NOTES_COUNT);
@@ -927,7 +927,7 @@
 {
     lb_endpoint_t *p;
     int attempt = 1;
-    worker_record_t *prec = NULL;
+    lb_sub_worker_t *prec = NULL;
     int num_of_workers;
     int first = 1;
     int was_forced = 0;
@@ -988,7 +988,7 @@
 
     while (attempt <= num_of_workers && recoverable == JK_TRUE) {
         int route_is_domain = JK_FALSE;
-        worker_record_t *rec =
+        lb_sub_worker_t *rec =
             get_most_suitable_worker(p->worker, sessionid, &route_is_domain, l);
         rc = JK_FALSE;
         *is_error = JK_HTTP_SERVER_BUSY;
@@ -1019,7 +1019,7 @@
             if (p->worker->lblock == JK_LB_LOCK_PESSIMISTIC)
                 jk_shm_unlock();
                        
-            while ((!(r=rec->w->get_endpoint(rec->w, &end, l)) || !end) &&
(retry < p->worker->retries)) {
+            while ((!(r=rec->worker->get_endpoint(rec->worker, &end, l)) ||
!end) && (retry < p->worker->retries)) {
                 retry++;
                 retry_wait *=2;
 
@@ -1346,7 +1346,7 @@
             p->max_packet_size = DEF_BUFFER_SZ;
             p->lb_workers = jk_pool_alloc(&p->p,
                                           num_of_workers *
-                                          sizeof(worker_record_t));
+                                          sizeof(lb_sub_worker_t));
             if (!p->lb_workers) {
                 JK_TRACE_EXIT(l);
                 return JK_FALSE;
@@ -1400,13 +1400,13 @@
                     jk_get_worker_activation(props, worker_names[i]);
                 if (!wc_create_worker(p->lb_workers[i].name, 0,
                                       props,
-                                      &(p->lb_workers[i].w),
-                                      we, l) || !p->lb_workers[i].w) {
+                                      &(p->lb_workers[i].worker),
+                                      we, l) || !p->lb_workers[i].worker) {
                     break;
                 }
-                if (secret && (p->lb_workers[i].w->type == JK_AJP13_WORKER_TYPE
||
-                    p->lb_workers[i].w->type == JK_AJP14_WORKER_TYPE)) {
-                    ajp_worker_t *aw = (ajp_worker_t *)p->lb_workers[i].w->worker_private;
+                if (secret && (p->lb_workers[i].worker->type == JK_AJP13_WORKER_TYPE
||
+                    p->lb_workers[i].worker->type == JK_AJP14_WORKER_TYPE)) {
+                    ajp_worker_t *aw = (ajp_worker_t *)p->lb_workers[i].worker->worker_private;
                     if (!aw->secret)
                         aw->secret = secret;
                 }

Modified: tomcat/connectors/trunk/jk/native/common/jk_lb_worker.h
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_lb_worker.h?rev=611602&r1=611601&r2=611602&view=diff
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_lb_worker.h (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_lb_worker.h Sun Jan 13 09:20:47 2008
@@ -119,12 +119,18 @@
 /* The exponent x is JK_LB_DECAY_MULT*#MAINT_INTV_SINCE_LAST_MAINT */
 #define JK_LB_DECAY_MULT         (1)
 
-struct worker_record
+struct lb_sub_worker
 {
-    jk_worker_t           *w;
+    jk_worker_t *worker;
     /* Shared memory worker data */
     jk_shm_lb_sub_worker_t *s;
+
     char         name[JK_SHM_STR_SIZ+1];
+    /* Sequence counter starting at 0 and increasing
+     * every time we change the config
+     */
+    volatile unsigned int sequence;
+
     /* route */
     char    route[JK_SHM_STR_SIZ+1];
     /* worker domain */
@@ -139,18 +145,28 @@
     int lb_factor;
     /* Current lb reciprocal factor */
     jk_uint64_t lb_mult;
+};
+typedef struct lb_sub_worker lb_sub_worker_t;
+
+struct lb_worker
+{
+    jk_worker_t worker;
+    /* Shared memory worker data */
+    jk_shm_lb_worker_t *s;
+
+    char         name[JK_SHM_STR_SIZ+1];
     /* Sequence counter starting at 0 and increasing
      * every time we change the config
      */
     volatile unsigned int sequence;
-};
-typedef struct worker_record worker_record_t;
 
-struct lb_worker
-{
-    worker_record_t *lb_workers;
+    jk_pool_t p;
+    jk_pool_atom_t buf[TINY_POOL_SIZE];
+
+    JK_CRIT_SEC cs;
+
+    lb_sub_worker_t *lb_workers;
     unsigned int num_of_workers;
-    char         name[JK_SHM_STR_SIZ+1];
     int          sticky_session;
     int          sticky_session_force;
     int          recover_wait_time;
@@ -160,17 +176,8 @@
     int          lblock;
     int          maintain_time;
     unsigned int max_packet_size;
-    unsigned int sequence;
     unsigned int next_offset;
 
-    jk_pool_t p;
-    jk_pool_atom_t buf[TINY_POOL_SIZE];
-
-    jk_worker_t worker;
-    JK_CRIT_SEC cs;
-
-    /* Shared memory worker data */
-    jk_shm_lb_worker_t *s;
 };
 typedef struct lb_worker lb_worker_t;
 
@@ -181,9 +188,9 @@
 int jk_lb_get_lock_code(const char *v);
 const char *jk_lb_get_method(lb_worker_t *p, jk_logger_t *l);
 int jk_lb_get_method_code(const char *v);
-const char *jk_lb_get_state(worker_record_t *p, jk_logger_t *l);
+const char *jk_lb_get_state(lb_sub_worker_t *p, jk_logger_t *l);
 int jk_lb_get_state_code(const char *v);
-const char *jk_lb_get_activation(worker_record_t *p, jk_logger_t *l);
+const char *jk_lb_get_activation(lb_sub_worker_t *p, jk_logger_t *l);
 int jk_lb_get_activation_code(const char *v);
 void reset_lb_values(lb_worker_t *p, jk_logger_t *l);
 void jk_lb_pull(lb_worker_t * p, jk_logger_t *l);

Modified: tomcat/connectors/trunk/jk/native/common/jk_status.c
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_status.c?rev=611602&r1=611601&r2=611602&view=diff
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_status.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_status.c Sun Jan 13 09:20:47 2008
@@ -579,7 +579,7 @@
     } while (1);
 }
 
-static int status_rate(worker_record_t *wr, status_worker_t *w,
+static int status_rate(lb_sub_worker_t *wr, status_worker_t *w,
                        jk_logger_t *l)
 {
     jk_uint32_t mask = 0;
@@ -1199,12 +1199,12 @@
                              status_endpoint_t *p,
                              jk_worker_t *jw,
                              const char *worker,
-                             worker_record_t **wrp,
+                             lb_sub_worker_t **wrp,
                              const char *sub_worker,
                              jk_logger_t *l)
 {
     lb_worker_t *lb = NULL;
-    worker_record_t *wr = NULL;
+    lb_sub_worker_t *wr = NULL;
     status_worker_t *w = p->worker;
     unsigned int i;
 
@@ -1488,7 +1488,7 @@
     jk_shm_unlock();
 
     for (j = 0; j < lb->num_of_workers; j++) {
-        worker_record_t *wr = &(lb->lb_workers[j]);
+        lb_sub_worker_t *wr = &(lb->lb_workers[j]);
         int rate;
         rate = status_rate(wr, w, l);
         if (rate > 0 )
@@ -1644,8 +1644,8 @@
         }
 
         for (j = 0; j < lb->num_of_workers; j++) {
-            worker_record_t *wr = &(lb->lb_workers[j]);
-            ajp_worker_t *a = (ajp_worker_t *)wr->w->worker_private;
+            lb_sub_worker_t *wr = &(lb->lb_workers[j]);
+            ajp_worker_t *a = (ajp_worker_t *)wr->worker->worker_private;
             int rs_min = 0;
             int rs_max = 0;
             if (wr->s->state == JK_LB_STATE_ERROR) {
@@ -1679,7 +1679,7 @@
                 jk_puts(s, "&nbsp;</td>");
                 jk_printf(s, JK_STATUS_SHOW_MEMBER_ROW,
                           wr->name,
-                          status_worker_type(wr->w->type),
+                          status_worker_type(wr->worker->type),
                           a->host, a->port,
                           jk_dump_hinfo(&a->worker_inet_addr, buf),
                           jk_lb_get_activation(wr, l),
@@ -1707,7 +1707,7 @@
 
                 jk_print_xml_start_elt(s, w, 6, 0, "member");
                 jk_print_xml_att_string(s, 8, "name", wr->name);
-                jk_print_xml_att_string(s, 8, "type", status_worker_type(wr->w->type));
+                jk_print_xml_att_string(s, 8, "type", status_worker_type(wr->worker->type));
                 jk_print_xml_att_string(s, 8, "host", a->host);
                 jk_print_xml_att_int(s, 8, "port", a->port);
                 jk_print_xml_att_string(s, 8, "address", jk_dump_hinfo(&a->worker_inet_addr,
buf));
@@ -1738,7 +1738,7 @@
 
                 jk_puts(s, "Member:");
                 jk_printf(s, " name=%s", wr->name);
-                jk_printf(s, " type=%s", status_worker_type(wr->w->type));
+                jk_printf(s, " type=%s", status_worker_type(wr->worker->type));
                 jk_printf(s, " host=%s", a->host);
                 jk_printf(s, " port=%d", a->port);
                 jk_printf(s, " address=%s", jk_dump_hinfo(&a->worker_inet_addr, buf));
@@ -1767,7 +1767,7 @@
             else if (mime == JK_STATUS_MIME_PROP) {
 
                 jk_print_prop_att_string(s, w, name, "balance_workers", wr->name);
-                jk_print_prop_att_string(s, w, wr->name, "type", status_worker_type(wr->w->type));
+                jk_print_prop_att_string(s, w, wr->name, "type", status_worker_type(wr->worker->type));
                 jk_print_prop_att_string(s, w, wr->name, "host", a->host);
                 jk_print_prop_att_int(s, w, wr->name, "port", a->port);
                 jk_print_prop_att_string(s, w, wr->name, "address", jk_dump_hinfo(&a->worker_inet_addr,
buf));
@@ -2100,7 +2100,7 @@
 
 static void form_member(jk_ws_service_t *s,
                         status_endpoint_t *p,
-                        worker_record_t *wr,
+                        lb_sub_worker_t *wr,
                         const char *lb_name,
                         jk_logger_t *l)
 {
@@ -2234,7 +2234,7 @@
                 "</tr>", NULL);
 
         for (i = 0; i < lb->num_of_workers; i++) {
-            worker_record_t *wr = &(lb->lb_workers[i]);
+            lb_sub_worker_t *wr = &(lb->lb_workers[i]);
 
             jk_putv(s, "<tr><td>", wr->name, "</td><td>\n", NULL);
 
@@ -2397,7 +2397,7 @@
 }
 
 static int set_int_if_changed(status_endpoint_t *p,
-                              worker_record_t *wr,
+                              lb_sub_worker_t *wr,
                               const char *att,
                               const char *arg,
                               int min,
@@ -2421,7 +2421,7 @@
 
 static int commit_member(jk_ws_service_t *s,
                          status_endpoint_t *p,
-                         worker_record_t *wr,
+                         lb_sub_worker_t *wr,
                          const char *lb_name,
                          jk_logger_t *l)
 {
@@ -2561,7 +2561,7 @@
     if (lb) {
         for (j = 0; j < lb->num_of_workers; j++) {
             int sync_needed = JK_FALSE;
-            worker_record_t *wr = &(lb->lb_workers[j]);
+            lb_sub_worker_t *wr = &(lb->lb_workers[j]);
             snprintf(vname, 32-1, "" JK_STATUS_ARG_MULT_VALUE_BASE "%d", j);
 
             if (!strcmp(attribute, JK_STATUS_ARG_LBM_FACTOR)) {
@@ -2723,7 +2723,7 @@
     const char *worker;
     const char *sub_worker;
     jk_worker_t *jw = NULL;
-    worker_record_t *wr = NULL;
+    lb_sub_worker_t *wr = NULL;
 
     JK_TRACE_ENTER(l);
     fetch_worker_and_sub_worker(p, "checking", &worker, &sub_worker, l);
@@ -2969,7 +2969,7 @@
             form_worker(s, p, jw, l);
     }
     else  {
-        worker_record_t *wr = NULL;
+        lb_sub_worker_t *wr = NULL;
         if (jw->type != JK_LB_WORKER_TYPE) {
             jk_log(l, JK_LOG_WARNING,
                    "Status worker '%s' worker type not implemented",
@@ -3013,7 +3013,7 @@
     }
     else  {
         lb_worker_t *lb = NULL;
-        worker_record_t *wr = NULL;
+        lb_sub_worker_t *wr = NULL;
         int rc = 0;
         if (check_valid_lb(s, p, jw, worker, &lb, 0, l) == JK_FALSE) {
             JK_TRACE_EXIT(l);
@@ -3047,7 +3047,7 @@
     const char *sub_worker;
     jk_worker_t *jw = NULL;
     lb_worker_t *lb = NULL;
-    worker_record_t *wr = NULL;
+    lb_sub_worker_t *wr = NULL;
 
     JK_TRACE_ENTER(l);
     fetch_worker_and_sub_worker(p, "resetting", &worker, &sub_worker, l);
@@ -3110,7 +3110,7 @@
     const char *worker;
     const char *sub_worker;
     jk_worker_t *jw = NULL;
-    worker_record_t *wr = NULL;
+    lb_sub_worker_t *wr = NULL;
     status_worker_t *w = p->worker;
 
     JK_TRACE_ENTER(l);



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


Mime
View raw message