Author: kfujino Date: Wed Mar 28 02:55:37 2012 New Revision: 1306131 URL: http://svn.apache.org/viewvc?rev=1306131&view=rev Log: Add support for multi-thread deployment in UserConfig.
Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/LocalStrings.properties tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/UserConfig.java tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/LocalStrings.properties URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/LocalStrings.properties?rev=1306131&r1=1306130&r2=1306131&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/LocalStrings.properties (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/LocalStrings.properties Wed Mar 28 02:55:37 2012 @@ -128,6 +128,7 @@ userConfig.deploying=Deploying user web userConfig.error=Error deploying web application for user {0} userConfig.start=UserConfig: Processing START userConfig.stop=UserConfig: Processing STOP +userConfig.deploy.threaded.error=Error waiting for multi-thread deployment of user directories to complete webRuleSet.absoluteOrdering=<absolute-ordering> element not valid in web-fragment.xml and will be ignored webRuleSet.absoluteOrderingCount=<absolute-ordering> element is limited to 1 occurrence webRuleSet.nameCount=<name> element is limited to 1 occurrence Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/UserConfig.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/UserConfig.java?rev=1306131&r1=1306130&r2=1306131&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/UserConfig.java (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/UserConfig.java Wed Mar 28 02:55:37 2012 @@ -20,7 +20,11 @@ package org.apache.catalina.startup; import java.io.File; +import java.util.ArrayList; import java.util.Enumeration; +import java.util.List; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Future; import org.apache.catalina.Context; import org.apache.catalina.Host; @@ -258,14 +262,24 @@ public final class UserConfig return; } + ExecutorService executor = host.getStartStopExecutor(); + List<Future<?>> results = new ArrayList<Future<?>>(); + // Deploy the web application (if any) for each defined user Enumeration<String> users = database.getUsers(); while (users.hasMoreElements()) { String user = users.nextElement(); String home = database.getHome(user); - deploy(user, home); + results.add(executor.submit(new DeployUserDirectory(this, user, home))); } + for (Future<?> result : results) { + try { + result.get(); + } catch (Exception e) { + host.getLogger().error(sm.getString("userConfig.deploy.threaded.error"), e); + } + } } @@ -334,5 +348,22 @@ public final class UserConfig } + private static class DeployUserDirectory implements Runnable { + + private UserConfig config; + private String user; + private String home; + + public DeployUserDirectory(UserConfig config, String user, String home) { + this.config = config; + this.user = user; + this.home= home; + } + + @Override + public void run() { + config.deploy(user, home); + } + } } Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1306131&r1=1306130&r2=1306131&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Wed Mar 28 02:55:37 2012 @@ -147,6 +147,9 @@ field/method is annotated with <code>@Resource</code> annotation. Patch provided by Violet Agg. (markt) </fix> + <add> + Add support for multi-thread deployment in UserConfig. (kfujino) + </add> </changelog> </subsection> <subsection name="Coyote"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org