RE: svn commit: r1306130 - in /tomcat/trunk/java/org/apache/catalina/startup: LocalStrings.properties UserConfig.java
-Original Message- From: kfuj...@apache.org [mailto:kfuj...@apache.org] Sent: Tuesday, March 27, 2012 8:51 PM To: dev@tomcat.apache.org Subject: svn commit: r1306130 - in /tomcat/trunk/java/org/apache/catalina/startup: LocalStrings.properties UserConfig.java + for (Future? result : results) { + try { + result.get(); + } catch (Exception e) { + host.getLogger().error(sm.getString(userConfig.deploy.threaded.error), e); + } + } } [Filip Hanik] If results[0].get() fails, are you not going to wait for the others to complete? If results[0].get() fails, I am going to wait for the others to complete. Thus I implemented try-catch inside a loop. Is there wrong code in this rev? Or don't I understand your comment correctly? [Filip Hanik] You got it right, I just misread the location of the try-catch - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org -- Keiichi.Fujino - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
RE: svn commit: r1306130 - in /tomcat/trunk/java/org/apache/catalina/startup: LocalStrings.properties UserConfig.java
-Original Message- From: kfuj...@apache.org [mailto:kfuj...@apache.org] Sent: Tuesday, March 27, 2012 8:51 PM To: dev@tomcat.apache.org Subject: svn commit: r1306130 - in /tomcat/trunk/java/org/apache/catalina/startup: LocalStrings.properties UserConfig.java +for (Future? result : results) { +try { +result.get(); +} catch (Exception e) { + host.getLogger().error(sm.getString(userConfig.deploy.threaded.error), e); +} +} } [Filip Hanik] If results[0].get() fails, are you not going to wait for the others to complete? - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: svn commit: r1306130 - in /tomcat/trunk/java/org/apache/catalina/startup: LocalStrings.properties UserConfig.java
2012/3/29 Filip Hanik (mailing lists) devli...@hanik.com: -Original Message- From: kfuj...@apache.org [mailto:kfuj...@apache.org] Sent: Tuesday, March 27, 2012 8:51 PM To: dev@tomcat.apache.org Subject: svn commit: r1306130 - in /tomcat/trunk/java/org/apache/catalina/startup: LocalStrings.properties UserConfig.java + for (Future? result : results) { + try { + result.get(); + } catch (Exception e) { + host.getLogger().error(sm.getString(userConfig.deploy.threaded.error), e); + } + } } [Filip Hanik] If results[0].get() fails, are you not going to wait for the others to complete? If results[0].get() fails, I am going to wait for the others to complete. Thus I implemented try-catch inside a loop. Is there wrong code in this rev? Or don't I understand your comment correctly? - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org -- Keiichi.Fujino - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1306130 - in /tomcat/trunk/java/org/apache/catalina/startup: LocalStrings.properties UserConfig.java
Author: kfujino Date: Wed Mar 28 02:51:21 2012 New Revision: 1306130 URL: http://svn.apache.org/viewvc?rev=1306130view=rev Log: Add support for multi-thread deployment in UserConfig. Modified: tomcat/trunk/java/org/apache/catalina/startup/LocalStrings.properties tomcat/trunk/java/org/apache/catalina/startup/UserConfig.java Modified: tomcat/trunk/java/org/apache/catalina/startup/LocalStrings.properties URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/LocalStrings.properties?rev=1306130r1=1306129r2=1306130view=diff == --- tomcat/trunk/java/org/apache/catalina/startup/LocalStrings.properties (original) +++ tomcat/trunk/java/org/apache/catalina/startup/LocalStrings.properties Wed Mar 28 02:51:21 2012 @@ -121,6 +121,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/trunk/java/org/apache/catalina/startup/UserConfig.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/UserConfig.java?rev=1306130r1=1306129r2=1306130view=diff == --- tomcat/trunk/java/org/apache/catalina/startup/UserConfig.java (original) +++ tomcat/trunk/java/org/apache/catalina/startup/UserConfig.java Wed Mar 28 02:51:21 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(); +ListFuture? results = new ArrayListFuture?(); + // Deploy the web application (if any) for each defined user EnumerationString 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); +} +} } - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org