Author: rjung Date: Wed Jun 26 20:17:05 2013 New Revision: 1497071 URL: http://svn.apache.org/r1497071 Log: Add a flag to pass status, whether a request could be handled in a sticky way.
Modified: tomcat/jk/trunk/native/common/jk_lb_worker.c tomcat/jk/trunk/native/common/jk_service.h Modified: tomcat/jk/trunk/native/common/jk_lb_worker.c URL: http://svn.apache.org/viewvc/tomcat/jk/trunk/native/common/jk_lb_worker.c?rev=1497071&r1=1497070&r2=1497071&view=diff ============================================================================== --- tomcat/jk/trunk/native/common/jk_lb_worker.c (original) +++ tomcat/jk/trunk/native/common/jk_lb_worker.c Wed Jun 26 20:17:05 2013 @@ -877,6 +877,8 @@ static int find_bysession_route(jk_ws_se if (candidate < 0) { uses_domain = 1; candidate = find_best_bydomain(s, p, session_route, states, l); + } else { + s->sticky = JK_TRUE; } if (candidate >= 0) { lb_sub_worker_t wr = p->lb_workers[candidate]; @@ -939,8 +941,10 @@ static int find_failover_worker(jk_ws_se break; } } - if (redirect) + if (redirect) { rc = find_bysession_route(s, p, redirect, states, l); + s->sticky = JK_FALSE; + } return rc; } @@ -967,6 +971,7 @@ static int get_most_suitable_worker(jk_w int rc = -1; JK_TRACE_ENTER(l); + s->sticky = JK_FALSE; if (p->num_of_workers == 1) { /* No need to find the best worker * if there is a single one @@ -978,6 +983,7 @@ static int get_most_suitable_worker(jk_w activation = p->lb_workers[0].activation; if (JK_WORKER_USABLE_STICKY(states[0], activation)) { if (activation != JK_LB_ACTIVATION_DISABLED) { + s->sticky = JK_TRUE; JK_TRACE_EXIT(l); return 0; } @@ -1240,8 +1246,8 @@ static int JK_METHOD service(jk_endpoint if (JK_IS_DEBUG_LEVEL(l)) jk_log(l, JK_LOG_DEBUG, - "service worker=%s route=%s", - rec->name, s->route); + "service worker=%s route=%s failover=%s", + rec->name, s->route, s->sticky ? "false" : "true"); if (p->worker->lblock == JK_LB_LOCK_PESSIMISTIC) jk_shm_lock(); Modified: tomcat/jk/trunk/native/common/jk_service.h URL: http://svn.apache.org/viewvc/tomcat/jk/trunk/native/common/jk_service.h?rev=1497071&r1=1497070&r2=1497071&view=diff ============================================================================== --- tomcat/jk/trunk/native/common/jk_service.h (original) +++ tomcat/jk/trunk/native/common/jk_service.h Wed Jun 26 20:17:05 2013 @@ -224,6 +224,12 @@ struct jk_ws_service unsigned num_attributes; /* Number of request attributes */ /* + * JK_TRUE iff handled by a load balancer, the request + * contained a route and it is the route of the current worker. + */ + int sticky; + + /* * The route is in use when the adapter load balance among * several workers. It is the ID of a specific target in the load balance * group. We are using this variable to implement target session --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org