You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by mt...@apache.org on 2012/03/28 13:49:55 UTC

svn commit: r1306271 - in /tomcat/jk/trunk/native/common: jk_uri_worker_map.c jk_uri_worker_map.h

Author: mturk
Date: Wed Mar 28 11:49:55 2012
New Revision: 1306271

URL: http://svn.apache.org/viewvc?rev=1306271&view=rev
Log:
Add global uriworker_map id. We'll use this a parent for workers so we can find multiple workers having the same name but belonging to a different uw map

Modified:
    tomcat/jk/trunk/native/common/jk_uri_worker_map.c
    tomcat/jk/trunk/native/common/jk_uri_worker_map.h

Modified: tomcat/jk/trunk/native/common/jk_uri_worker_map.c
URL: http://svn.apache.org/viewvc/tomcat/jk/trunk/native/common/jk_uri_worker_map.c?rev=1306271&r1=1306270&r2=1306271&view=diff
==============================================================================
--- tomcat/jk/trunk/native/common/jk_uri_worker_map.c (original)
+++ tomcat/jk/trunk/native/common/jk_uri_worker_map.c Wed Mar 28 11:49:55 2012
@@ -56,6 +56,8 @@
 
 #define STRNULL_FOR_NULL(x) ((x) ? (x) : "(null)")
 
+static volatile int map_id_counter = 0;
+
 static const char *uri_worker_map_source_type[] = {
     "unknown",
     SOURCE_TYPE_TEXT_WORKERDEF,
@@ -169,30 +171,34 @@ static void uri_worker_map_dump(jk_uri_w
 {
     JK_TRACE_ENTER(l);
     if (uw_map) {
-        int i, off, k;
-        uri_worker_record_t *uwr = NULL;
-        char buf[32];
-        jk_log(l, JK_LOG_DEBUG, "uri map dump %s: index=%d file='%s' reject_unsafe=%d "
-               "reload=%d modified=%d checked=%d",
-               reason, uw_map->index, STRNULL_FOR_NULL(uw_map->fname), uw_map->reject_unsafe,
-               uw_map->reload, uw_map->modified, uw_map->checked);
-        for(i=0;i<=1;i++) {
+        int i, off;
+        if (JK_IS_DEBUG_LEVEL(l)) {
+            jk_log(l, JK_LOG_DEBUG, "uri map dump %s: id=%d, index=%d file='%s' reject_unsafe=%d "
+                  "reload=%d modified=%d checked=%d",
+                   reason, uw_map->id, uw_map->index, STRNULL_FOR_NULL(uw_map->fname),
+                   uw_map->reject_unsafe, uw_map->reload, uw_map->modified, uw_map->checked);
+        }
+        for (i = 0; i <= 1; i++) {
             jk_log(l, JK_LOG_DEBUG, "generation %d: size=%d nosize=%d capacity=%d",
                    i, uw_map->size[i], uw_map->nosize[i], uw_map->capacity[i], uw_map->maps[i]);
         }
 
         off = uw_map->index;
-        for(i=0;i<=1;i++) {
+        for (i = 0; i <= 1; i++) {
+            char buf[32];
+            int k;
             unsigned int j;
             k = (i + off) % 2;
             for (j = 0; j < uw_map->size[k]; j++) {
-                uwr = uw_map->maps[k][j];
-                jk_log(l, JK_LOG_DEBUG, "%s (%d) map #%d: uri=%s worker=%s context=%s "
-                       "source=%s type=%s len=%d",
-                       i ? "NEXT" : "THIS", i, j,
-                       STRNULL_FOR_NULL(uwr->uri), STRNULL_FOR_NULL(uwr->worker_name),
-                       STRNULL_FOR_NULL(uwr->context), STRNULL_FOR_NULL(uri_worker_map_get_source(uwr,l)),
-                       STRNULL_FOR_NULL(uri_worker_map_get_match(uwr,buf,l)), uwr->context_len);
+                uri_worker_record_t *uwr = uw_map->maps[k][j];
+                if (uwr && JK_IS_DEBUG_LEVEL(l)) {
+                    jk_log(l, JK_LOG_DEBUG, "%s (%d) map #%d: uri=%s worker=%s context=%s "
+                           "source=%s type=%s len=%d",
+                           i ? "NEXT" : "THIS", i, j,
+                           STRNULL_FOR_NULL(uwr->uri), STRNULL_FOR_NULL(uwr->worker_name),
+                           STRNULL_FOR_NULL(uwr->context), STRNULL_FOR_NULL(uri_worker_map_get_source(uwr,l)),
+                           STRNULL_FOR_NULL(uri_worker_map_get_match(uwr,buf,l)), uwr->context_len);
+                }
             }
         }
     }
@@ -224,7 +230,7 @@ int uri_worker_map_alloc(jk_uri_worker_m
 
         jk_open_pool(&(uw_map->p),
                      uw_map->buf, sizeof(jk_pool_atom_t) * BIG_POOL_SIZE);
-        for(i=0;i<=1;i++) {
+        for (i = 0; i <= 1; i++) {
             jk_open_pool(&(uw_map->p_dyn[i]),
                          uw_map->buf_dyn[i], sizeof(jk_pool_atom_t) * BIG_POOL_SIZE);
             uw_map->size[i] = 0;
@@ -232,6 +238,7 @@ int uri_worker_map_alloc(jk_uri_worker_m
             uw_map->capacity[i] = 0;
             uw_map->maps[i] = NULL;
         }
+        uw_map->id = 0;
         uw_map->index = 0;
         uw_map->fname = NULL;
         uw_map->reject_unsafe = 0;
@@ -241,6 +248,8 @@ int uri_worker_map_alloc(jk_uri_worker_m
 
         if (init_data)
             rc = uri_worker_map_open(uw_map, init_data, l);
+        if (rc == JK_TRUE)
+            uw_map->id = ++map_id_counter;
         JK_TRACE_EXIT(l);
         return rc;
     }

Modified: tomcat/jk/trunk/native/common/jk_uri_worker_map.h
URL: http://svn.apache.org/viewvc/tomcat/jk/trunk/native/common/jk_uri_worker_map.h?rev=1306271&r1=1306270&r2=1306271&view=diff
==============================================================================
--- tomcat/jk/trunk/native/common/jk_uri_worker_map.h (original)
+++ tomcat/jk/trunk/native/common/jk_uri_worker_map.h Wed Mar 28 11:49:55 2012
@@ -138,6 +138,11 @@ struct jk_uri_worker_map
     /* Needed to make map reload more atomically */
     int index;
 
+    /* map Id.
+     * Unique value which gets incremented each time we
+     * call uri_worker_map_alloc
+     */
+    int id;
     /* Memory Pool - cleared when doing reload */
     /* Use this pool to allocate objects, that are deleted */
     /* when the map gets dynamically reloaded from uriworkermap.properties. */
@@ -146,7 +151,7 @@ struct jk_uri_worker_map
 
     /* map URI->WORKER */
     uri_worker_record_t **maps[2];
-    
+
     /* Map Number */
     unsigned int size[2];
 



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