Author: rjung Date: Mon Nov 27 04:22:29 2006 New Revision: 479601 URL: http://svn.apache.org/viewvc?view=rev&rev=479601 Log: Making uriworkermap reload time configurable, at the moment only for Apache.
Modified: tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c tomcat/connectors/trunk/jk/native/common/jk_global.h tomcat/connectors/trunk/jk/native/common/jk_uri_worker_map.c tomcat/connectors/trunk/jk/native/common/jk_uri_worker_map.h tomcat/connectors/trunk/jk/native/iis/jk_isapi_plugin.c tomcat/connectors/trunk/jk/native/netscape/jk_nsapi_plugin.c tomcat/connectors/trunk/jk/xdocs/changelog.xml tomcat/connectors/trunk/jk/xdocs/config/apache.xml tomcat/connectors/trunk/jk/xdocs/config/uriworkermap.xml Modified: tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c?view=diff&rev=479601&r1=479600&r2=479601 ============================================================================== --- tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c (original) +++ tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c Mon Nov 27 04:22:29 2006 @@ -121,6 +121,7 @@ jk_map_t *worker_properties; char *worker_file; char *mount_file; + char *mount_file_reload; jk_map_t *uri_to_context; int mountcopy; @@ -934,6 +935,32 @@ } /* + * JkMountFileReload Directive Handling + * + * JkMountFileReload seconds + */ + +static const char *jk_set_mount_file_reload(cmd_parms * cmd, + void *dummy, char *mount_file_reload) +{ + server_rec *s = cmd->server; + int interval; + + jk_server_conf_t *conf = + (jk_server_conf_t *) ap_get_module_config(s->module_config, + &jk_module); + + interval = atoi(mount_file_reload); + if (interval < 0) { + interval = 0; + } + + conf->mount_file_reload = interval; + + return NULL; +} + +/* * JkLogFile Directive Handling * * JkLogFile file @@ -1702,6 +1729,16 @@ "the name of a mount file for the Tomcat servlet uri mappings"}, /* + * JkMountFileReload specifies the reload check interval for the + * uriworker properties file. + * + * Default value is: JK_URIMAP_DEF_RELOAD + */ + {"JkMountFileReload", jk_set_mount_file_reload, NULL, RSRC_CONF, TAKE1, + "the reload check interval of the mount file"}, + + /* + * JkAutoMount specifies that the list of handled URLs must be * JkAutoMount specifies that the list of handled URLs must be * asked to the servlet engine (autoconf feature) */ @@ -2056,6 +2093,7 @@ c->exclude_options = 0; if (s->is_virtual) { + c->mount_file_reload = JK_UNSET; c->log_level = JK_UNSET; c->options = 0; c->worker_indicator = NULL; @@ -2066,6 +2104,7 @@ c->session_indicator = NULL; c->key_size_indicator = NULL; } else { + c->mount_file_reload = JK_URIMAP_DEF_RELOAD; c->log_level = JK_LOG_DEF_LEVEL; c->options = JK_OPT_FWDURIDEFAULT; c->worker_indicator = JK_ENV_WORKER_NAME; @@ -2163,6 +2202,8 @@ base->envvars); } + if (overrides->mount_file_reload == JK_UNSET) + overrides->mount_file_reload = base->mount_file_reload; if (overrides->mountcopy) { copy_jk_map(p, overrides->s, base->uri_to_context, overrides->uri_to_context); @@ -2328,6 +2369,7 @@ p, "Memory error"); if (sconf->mount_file) { sconf->uw_map->fname = sconf->mount_file; + sconf->uw_map->reload = sconf->mount_file_reload; uri_worker_map_load(sconf->uw_map, sconf->log); } if (sconf->format_string) { Modified: tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c?view=diff&rev=479601&r1=479600&r2=479601 ============================================================================== --- tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c (original) +++ tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c Mon Nov 27 04:22:29 2006 @@ -153,6 +153,7 @@ jk_map_t *worker_properties; char *worker_file; char *mount_file; + char *mount_file_reload; jk_map_t *uri_to_context; int mountcopy; @@ -956,6 +957,32 @@ } /* + * JkMountFileReload Directive Handling + * + * JkMountFileReload seconds + */ + +static const char *jk_set_mount_file_reload(cmd_parms * cmd, + void *dummy, const char *mount_file_reload) +{ + server_rec *s = cmd->server; + int interval; + + jk_server_conf_t *conf = + (jk_server_conf_t *) ap_get_module_config(s->module_config, + &jk_module); + + interval = atoi(mount_file_reload); + if (interval < 0) { + interval = 0; + } + + conf->mount_file_reload = interval; + + return NULL; +} + +/* * JkLogFile Directive Handling * * JkLogFile file @@ -1737,6 +1764,15 @@ "the name of a mount file for the Tomcat servlet uri mapping"), /* + * JkMountFileReload specifies the reload check interval for the + * uriworker properties file. + * + * Default value is: JK_URIMAP_DEF_RELOAD + */ + AP_INIT_TAKE1("JkMountFileReload", jk_set_mount_file_reload, NULL, RSRC_CONF, + "the reload check interval of the mount file"), + + /* * JkAutoMount specifies that the list of handled URLs must be * asked to the servlet engine (autoconf feature) */ @@ -2177,6 +2213,7 @@ c->was_initialized = JK_FALSE; if (s->is_virtual) { + c->mount_file_reload = JK_UNSET; c->log_level = JK_UNSET; c->options = 0; c->worker_indicator = NULL; @@ -2187,6 +2224,7 @@ c->session_indicator = NULL; c->key_size_indicator = NULL; } else { + c->mount_file_reload = JK_URIMAP_DEF_RELOAD; c->log_level = JK_LOG_DEF_LEVEL; c->options = JK_OPT_FWDURIDEFAULT; c->worker_indicator = JK_ENV_WORKER_NAME; @@ -2290,6 +2328,8 @@ base->envvars); } + if (overrides->mount_file_reload == JK_UNSET) + overrides->mount_file_reload = base->mount_file_reload; if (overrides->mountcopy) { copy_jk_map(p, overrides->s, base->uri_to_context, overrides->uri_to_context); @@ -2607,6 +2647,7 @@ srv->process->pool, "Memory error"); if (sconf->mount_file) { sconf->uw_map->fname = sconf->mount_file; + sconf->uw_map->reload = sconf->mount_file_reload; uri_worker_map_load(sconf->uw_map, sconf->log); } if (sconf->format_string) { Modified: tomcat/connectors/trunk/jk/native/common/jk_global.h URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_global.h?view=diff&rev=479601&r1=479600&r2=479601 ============================================================================== --- tomcat/connectors/trunk/jk/native/common/jk_global.h (original) +++ tomcat/connectors/trunk/jk/native/common/jk_global.h Mon Nov 27 04:22:29 2006 @@ -168,6 +168,10 @@ #define JK_WORKER_FILE_DEF ("workers.properties") +/* Urimap reload check time. Use 60 seconds by default. + */ +#define JK_URIMAP_DEF_RELOAD (60) + #define JK_TRUE (1) #define JK_FALSE (0) Modified: tomcat/connectors/trunk/jk/native/common/jk_uri_worker_map.c URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_uri_worker_map.c?view=diff&rev=479601&r1=479600&r2=479601 ============================================================================== --- tomcat/connectors/trunk/jk/native/common/jk_uri_worker_map.c (original) +++ tomcat/connectors/trunk/jk/native/common/jk_uri_worker_map.c Mon Nov 27 04:22:29 2006 @@ -647,7 +647,8 @@ int i; if (JK_IS_DEBUG_LEVEL(l)) jk_log(l, JK_LOG_DEBUG, - "Loading urimaps from %s", uw_map->fname); + "Loading urimaps from %s with reload check interval %d seconds", + uw_map->fname, uw_map->reload); uri_worker_map_clear(uw_map, SOURCE_TYPE_URIMAP, l); for (i = 0; i < jk_map_size(map); i++) { const char *u = jk_map_name_at(map, i); @@ -697,7 +698,7 @@ int rc = JK_TRUE; time_t now = time(NULL); - if (difftime(now, uw_map->checked) > JK_URIMAP_RELOAD) { + if (uw_map->reload > 0 && difftime(now, uw_map->checked) > uw_map->reload) { struct stat statbuf; uw_map->checked = now; if ((rc = stat(uw_map->fname, &statbuf)) == -1) { Modified: tomcat/connectors/trunk/jk/native/common/jk_uri_worker_map.h URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_uri_worker_map.h?view=diff&rev=479601&r1=479600&r2=479601 ============================================================================== --- tomcat/connectors/trunk/jk/native/common/jk_uri_worker_map.h (original) +++ tomcat/connectors/trunk/jk/native/common/jk_uri_worker_map.h Mon Nov 27 04:22:29 2006 @@ -35,10 +35,6 @@ #include "jk_logger.h" #include "jk_mt.h" -/* Urimap reload time. Use 60 seconds by default. - */ -#define JK_URIMAP_RELOAD 60 - #define MATCH_TYPE_EXACT 0x0001 /* deprecated #define MATCH_TYPE_CONTEXT 0x0002 @@ -117,6 +113,8 @@ JK_CRIT_SEC cs; /* uriworkermap filename */ const char *fname; + /* uriworkermap reload check interval */ + int reload; /* Last modified time */ time_t modified; /* Last checked time */ Modified: tomcat/connectors/trunk/jk/native/iis/jk_isapi_plugin.c URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/iis/jk_isapi_plugin.c?view=diff&rev=479601&r1=479600&r2=479601 ============================================================================== --- tomcat/connectors/trunk/jk/native/iis/jk_isapi_plugin.c (original) +++ tomcat/connectors/trunk/jk/native/iis/jk_isapi_plugin.c Mon Nov 27 04:22:29 2006 @@ -1258,6 +1258,7 @@ if (uri_worker_map_alloc(&uw_map, NULL, logger)) { rc = JK_FALSE; uw_map->fname = worker_mount_file; + uw_map->reload = JK_URIMAP_DEF_RELOAD; if (worker_mount_file[0]) rc = uri_worker_map_load(uw_map, logger); } Modified: tomcat/connectors/trunk/jk/native/netscape/jk_nsapi_plugin.c URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/netscape/jk_nsapi_plugin.c?view=diff&rev=479601&r1=479600&r2=479601 ============================================================================== --- tomcat/connectors/trunk/jk/native/netscape/jk_nsapi_plugin.c (original) +++ tomcat/connectors/trunk/jk/native/netscape/jk_nsapi_plugin.c Mon Nov 27 04:22:29 2006 @@ -93,6 +93,7 @@ if (wc_open(init_map, &worker_env, logger)) { if (uri_worker_map_alloc(&uw_map, NULL, logger)) { uw_map->fname = ""; + uw_map->reload = JK_URIMAP_DEF_RELOAD; worker_env.uri_to_worker = uw_map; init_on_other_thread_is_ok = JK_TRUE; } Modified: tomcat/connectors/trunk/jk/xdocs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/xdocs/changelog.xml?view=diff&rev=479601&r1=479600&r2=479601 ============================================================================== --- tomcat/connectors/trunk/jk/xdocs/changelog.xml (original) +++ tomcat/connectors/trunk/jk/xdocs/changelog.xml Mon Nov 27 04:22:29 2006 @@ -27,6 +27,9 @@ <subsection name="Native"> <changelog> <update> + Apache: Make uriworkermap file reload check interval configurable. (rjung) + </update> + <update> Status Worker: Add directives for customizing the XML output (ns, xmlns, doctype). (mturk) </update> Modified: tomcat/connectors/trunk/jk/xdocs/config/apache.xml URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/xdocs/config/apache.xml?view=diff&rev=479601&r1=479600&r2=479601 ============================================================================== --- tomcat/connectors/trunk/jk/xdocs/config/apache.xml (original) +++ tomcat/connectors/trunk/jk/xdocs/config/apache.xml Mon Nov 27 04:22:29 2006 @@ -77,6 +77,16 @@ <br/> There is no default value. </p></attribute> +<attribute name="JkMountFileReload" required="false"><p> +This directive configures the reload check interval in seconds. +The JkMountFile is checked periodically for changes. +A changed file gets reloaded automatically. If you set +this directive to "0", reload checking is turned off. +<br/> +The default value is 60 seconds. +<br/> +This directive has been added in version 1.2.20 of mod_jk. +</p></attribute> <attribute name="JkMount" required="false"><p> A mount point from a context to a Tomcat worker. <br/> Modified: tomcat/connectors/trunk/jk/xdocs/config/uriworkermap.xml URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/xdocs/config/uriworkermap.xml?view=diff&rev=479601&r1=479600&r2=479601 ============================================================================== --- tomcat/connectors/trunk/jk/xdocs/config/uriworkermap.xml (original) +++ tomcat/connectors/trunk/jk/xdocs/config/uriworkermap.xml Mon Nov 27 04:22:29 2006 @@ -47,7 +47,7 @@ The details are web server specific though. </li> <li> -Dynamic reloading: The file gets checked every 60 seconds for changes. +Dynamic reloading: The file gets checked periodically for changes. New versions are automatically reloaded without web server restarts. </li> <li> @@ -222,6 +222,11 @@ When a request is being processed, tomcat connectors check the file modification time of the uriworkermap file. To keep the performance penalty low, this happens only, if the last check happened at least 60 seconds ago. +</p> +<p> +IIS does the check every 60 seconds. For Apache you can configure the +interval using the directive JkMountFile. The default value is also 60 seconds. +A value of "0" turns off the reloading. </p> <p> If the file changed, it gets reloaded completely. If there exist rules coming --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]