[Bug 62895] load-on-startup of the @WebServlet does not word

2018-11-08 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=62895

richard.gang@gmail.com changed:

   What|Removed |Added

 OS||All

--- Comment #1 from richard.gang@gmail.com ---
My Servlet is very simple, the Servlet just override the init(ServletConfig)
method

public class TimerServlet extends HttpServlet
{
public void init(ServletConfig config)throws ServletException
{
super.init(config);
Timer t = new Timer(1000,new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
System.out.println(new Date());
}
});
t.start();
}
}

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 62895] New: load-on-startup of the @WebServlet does not word

2018-11-08 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=62895

Bug ID: 62895
   Summary: load-on-startup of the @WebServlet  does not word
   Product: Tomcat 9
   Version: 9.0.x
  Hardware: PC
Status: NEW
  Severity: normal
  Priority: P2
 Component: Catalina
  Assignee: dev@tomcat.apache.org
  Reporter: richard.gang@gmail.com
  Target Milestone: -

when i define a load-on-startup Servlet without url-patterns
if I use the web deployment descriptor(web.xml), I can use the below
configuration:

timerServlet
org.crazyit.TimerServlet
1

the Servlet will be created and init method will be invoked, When i started the
web app.
it means, if i use deploy the loadup-on-startup Servlet with web.xml,
everything is ok.

but, if i use @WebServlet Annotation, loadOnStartup doesnot work.
i use the same Servlet, i don't use the xml configuration,i just use 

@WebServlet(loadOnStartup=1)
init method of the servlet will not be invoked, When i started the web app.
unless i use 
@WebServlet(loadOnStartup=1, urlPatterns={}),
but it does not make sense,because i don't need any url-pattern for the servlet

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1846206 - in /tomcat/site/trunk: ./ docs/ xdocs/

2018-11-08 Thread markt
Author: markt
Date: Thu Nov  8 22:30:32 2018
New Revision: 1846206

URL: http://svn.apache.org/viewvc?rev=1846206&view=rev
Log:
Update site for 8.5.35 release

Modified:
tomcat/site/trunk/build.properties.default
tomcat/site/trunk/docs/doap_Tomcat.rdf
tomcat/site/trunk/docs/download-80.html
tomcat/site/trunk/docs/index.html
tomcat/site/trunk/docs/migration-85.html
tomcat/site/trunk/docs/oldnews.html
tomcat/site/trunk/docs/whichversion.html
tomcat/site/trunk/xdocs/doap_Tomcat.rdf
tomcat/site/trunk/xdocs/download-80.xml
tomcat/site/trunk/xdocs/index.xml
tomcat/site/trunk/xdocs/migration-85.xml
tomcat/site/trunk/xdocs/oldnews.xml
tomcat/site/trunk/xdocs/whichversion.xml

Modified: tomcat/site/trunk/build.properties.default
URL: 
http://svn.apache.org/viewvc/tomcat/site/trunk/build.properties.default?rev=1846206&r1=1846205&r2=1846206&view=diff
==
--- tomcat/site/trunk/build.properties.default (original)
+++ tomcat/site/trunk/build.properties.default Thu Nov  8 22:30:32 2018
@@ -38,7 +38,7 @@ tomcat.loc=http://www.apache.org/dist/to
 # - Tomcat versions -
 tomcat70=7.0.91
 tomcat80=8.0.53
-tomcat85=8.5.34
+tomcat85=8.5.35
 tomcat90=9.0.13
 
 # - Download destination -

Modified: tomcat/site/trunk/docs/doap_Tomcat.rdf
URL: 
http://svn.apache.org/viewvc/tomcat/site/trunk/docs/doap_Tomcat.rdf?rev=1846206&r1=1846205&r2=1846206&view=diff
==
--- tomcat/site/trunk/docs/doap_Tomcat.rdf (original)
+++ tomcat/site/trunk/docs/doap_Tomcat.rdf Thu Nov  8 22:30:32 2018
@@ -68,7 +68,7 @@
   
 Latest Stable 8.5.x Release
 2018-09-10
-8.5.34
+8.5.35
   
 
 

Modified: tomcat/site/trunk/docs/download-80.html
URL: 
http://svn.apache.org/viewvc/tomcat/site/trunk/docs/download-80.html?rev=1846206&r1=1846205&r2=1846206&view=diff
==
--- tomcat/site/trunk/docs/download-80.html (original)
+++ tomcat/site/trunk/docs/download-80.html Thu Nov  8 22:30:32 2018
@@ -225,7 +225,7 @@
 Quick Navigation
 
 
-[define v]8.5.34[end]
+[define v]8.5.35[end]
 [define w]8.0.53[end]
 https://www.apache.org/dist/tomcat/tomcat-8/KEYS";>KEYS |
 [v] |

Modified: tomcat/site/trunk/docs/index.html
URL: 
http://svn.apache.org/viewvc/tomcat/site/trunk/docs/index.html?rev=1846206&r1=1846205&r2=1846206&view=diff
==
--- tomcat/site/trunk/docs/index.html (original)
+++ tomcat/site/trunk/docs/index.html Thu Nov  8 22:30:32 2018
@@ -274,6 +274,43 @@ changelog.
 
 
 
+
+2018-11-07 Tomcat 8.5.35 Released
+
+
+
+The Apache Tomcat Project is proud to announce the release of version 8.5.35
+of Apache Tomcat. Apache Tomcat 8.5.x replaces 8.0.x and includes new features
+pulled forward from Tomcat 9.0.x. The minimum Java version and implemented
+specification versions remain unchanged. The notable changes compared
+to 8.5.34 include:
+
+
+
+support for TLSv1.3 when used with a JRE or OpenSSl version that supports
+it
+
+multiple improvements to the RewriteValve
+
+correct several regressions in the JSP compiler
+
+
+
+
+
+Full details of these changes, and all the other changes, are available in the
+Tomcat 8.5
+changelog.
+
+
+
+
+
+https://tomcat.apache.org/download-80.cgi";>Download
+
+
+
+
 
 2018-10-20 Tomcat Native 1.2.18 Released
 
@@ -341,45 +378,6 @@ Full details of these changes, and all t
 
 
 
-
-
-2018-09-10 Tomcat 8.5.34 Released
-
-
-
-The Apache Tomcat Project is proud to announce the release of version 8.5.34
-of Apache Tomcat. Apache Tomcat 8.5.x replaces 8.0.x and includes new features
-pulled forward from Tomcat 9.0.x. The minimum Java version and implemented
-specification versions remain unchanged. The notable changes compared
-to 8.5.33 include:
-
-
-
-Fix multiple issues associated with using the asynchronous Servlet API in
-combination with HTTP/2.
-
-Add recursion to rewrite substitution parsing.
-
-Expand the information in the documentation web application regarding the
-use of CATALINA_HOME and CATALINA_BASE. Patch provided by Marek
-Czernek.
-
-
-
-
-
-Full details of these changes, and all the other changes, are available in the
-Tomcat 8.5
-changelog.
-
-
-
-
-
-https://tomcat.apache.org/download-80.cgi";>Download
-
-
-
 
 
 2018-07-05 Tomcat 8.0.53 Released

Modified: tomcat/site/trunk/docs/migration-85.html
URL: 
http://svn.apache.org/viewvc/tomcat/site/trunk/docs/migration-85.html?rev=1846206&r1=1846205&r2=1846206&view=diff
==
--- tomcat/site/trunk/docs/migration-85.html (original)
+++ tomcat/site/trunk/docs/migration-85.html Thu Nov  8 22:30:32 2018
@@ -698,7 +698,8 @@ of Apache Tomcat.
   "8.5.31":"1830392",
   

[ANN] Apache Tomcat 8.5.35 available

2018-11-08 Thread Mark Thomas
The Apache Tomcat team announces the immediate availability of Apache
Tomcat 8.5.35.

Apache Tomcat 8 is an open source software implementation of the Java
Servlet, JavaServer Pages, Java Unified Expression Language, Java
WebSocket and Java Authentication Service Provider Interface for
Containers technologies.

Apache Tomcat 8.5.x replaces 8.0.x and includes new features pulled
forward from the 9.0.x branch. The notable changes since 8.5.34 include:

- support for TLSv1.3 when used with a JRE or OpenSSL version that
  supports it

- multiple improvements to the RewriteValve

- correct several regressions in the JSP compiler


Please refer to the change log for the complete list of changes:
http://tomcat.apache.org/tomcat-8.5-doc/changelog.html

Downloads:
http://tomcat.apache.org/download-80.cgi

Migration guides from Apache Tomcat 7.x and 8.0.x:
http://tomcat.apache.org/migration.html

Enjoy!

- The Apache Tomcat team


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



Re: L10n / I18n

2018-11-08 Thread Emmanuel Bourg
Le 08/11/2018 à 15:47, Mark Thomas a écrit :

> is that a reason to drop attempts to provide i10n or
> is it an indication we aren't doing nearly enough?

We can always do more, but considering our limited resources I think
it's wise to focus first on the most important areas (ie. messages
displayed in web pages vs internal log messages).


> Seriously, we (well, those in the community that speak French
> fluently - not me) could look to improve those.

FTR I did start working on the French translation for jasper this summer
but I got dragged to other duties. When looking around the other
resource bundles I really wondered if it made sense to translate very
technical messages though.


> But that brings us back to your original question of whether the
> translations are worth it. If (and it is a fairly big if) the
> translations were mostly complete and mostly of good quality, would that
> change your view? I'm thinking try and improve the translations as a
> first step and, if things don't improve, then decide what to do next.

If the translations were nearly complete and of good quality I would
definitely not suggest dropping them. Yet, I think I'd still configure
Tomcat to run in English instead of French because I'm used to the
English terminology.


> Removing the translations (apart from the UI) feels to be too big a step
> to me. That said, I can see how they would be a hindrance rather than a
> help to some. Perhaps separating the l10n JARs into user facing and
> external would give more options. Admins could remove the translated JAR
> for the internal messages and get those messages in English if they
> prefer. Or we could ship less or even no translations for internal
> messages by default and provide them as a separate download.

I don't think rearranging the JARs is necessary, it isn't difficult to
run Tomcat with a different locale. I'm more concerned about the
maintenance burden and the actual value vs the time invested.

Emmanuel Bourg

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



svn commit: r1846205 - in /tomcat/site/trunk/docs/tomcat-8.5-doc: ./ api/ api/org/apache/catalina/ api/org/apache/catalina/ant/ api/org/apache/catalina/ant/jmx/ api/org/apache/catalina/authenticator/

2018-11-08 Thread markt
Author: markt
Date: Thu Nov  8 22:29:25 2018
New Revision: 1846205

URL: http://svn.apache.org/viewvc?rev=1846205&view=rev
Log:
Update docs for 8.5.35 release


[This commit notification would consist of 63 parts, 
which exceeds the limit of 50 ones, so it was shortened to the summary.]

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



Re: L10n / I18n

2018-11-08 Thread Rémy Maucherat
On Thu, Nov 8, 2018 at 11:00 PM Marek Czernek  wrote:

> On 11/8/18 1:16 AM, Emmanuel Bourg wrote:
> > Le 07/11/2018 à 23:36, Mark Thomas a écrit :
> >
> >> WDYT?
> > What about simplifying the issue by dropping the translations of the
> > internal messages and retaining only the user facing messages (things
> > like HTTP error messages that can appear in a normal request) ?
>
> +1 to this. Not sure if I'm the target audience, but I personally get
> quite annoyed at translated error messages into my native language
> (which is not English). When I get a non-English error message, I have to:
>
>   * Think about what it means (because this is so non-standard in things
> like web-browsers)
>   * Translate it into English to the best of my abilities
>   * Search google using my sub-optimal translation, hoping I hit the
> nail on the head, and land in the correct SFO/forum answer
>
> Granted, this is a bit easier with Tomcat - I can grep the source for
> the non-English message, get the key, and grep the key for the full
> English original. Still, that's pretty annoying to me.
>

If you really dislike it, you can also delete your resource bundle from
lib.

>
> Maybe this is different for widely-spoken languages, like Chinese, or
> Spanish, where people might have their own language variant of Stack
> Overflow, and similar forums...
>

Rémy


[ANN] Apache Tomcat 9.0.13 available

2018-11-08 Thread Mark Thomas
The Apache Tomcat team announces the immediate availability of Apache
Tomcat 9.0.13.

Apache Tomcat 9 is an open source software implementation of the Java
Servlet, JavaServer Pages, Java Unified Expression Language, Java
WebSocket and JASPIC technologies.

Apache Tomcat 9.0.13 is a bugfix and feature release. The notable
changes compared to 9.0.12 include:

- support for TLSv1.3 when used with a JRE or OPenSSl version that
  supports it

- added support for encrypting cluster traffic

- added automatic reloading of tomcat-users.xml after a change


Please refer to the change log for the complete list of changes:
http://tomcat.apache.org/tomcat-9.0-doc/changelog.html


Downloads:
http://tomcat.apache.org/download-90.cgi

Migration guides from Apache Tomcat 7.x and 8.x:
http://tomcat.apache.org/migration.html

Enjoy!

- The Apache Tomcat team

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



Re: L10n / I18n

2018-11-08 Thread Marek Czernek

On 11/8/18 1:16 AM, Emmanuel Bourg wrote:

Le 07/11/2018 à 23:36, Mark Thomas a écrit :


WDYT?

What about simplifying the issue by dropping the translations of the
internal messages and retaining only the user facing messages (things
like HTTP error messages that can appear in a normal request) ?


+1 to this. Not sure if I'm the target audience, but I personally get 
quite annoyed at translated error messages into my native language 
(which is not English). When I get a non-English error message, I have to:


 * Think about what it means (because this is so non-standard in things
   like web-browsers)
 * Translate it into English to the best of my abilities
 * Search google using my sub-optimal translation, hoping I hit the
   nail on the head, and land in the correct SFO/forum answer

Granted, this is a bit easier with Tomcat - I can grep the source for 
the non-English message, get the key, and grep the key for the full 
English original. Still, that's pretty annoying to me.


Maybe this is different for widely-spoken languages, like Chinese, or 
Spanish, where people might have their own language variant of Stack 
Overflow, and similar forums...




I think it's worth considering because:
- The target audience of Tomcat is mainly developers and administrators
which are used to read English text.
- The coverage of the translations is rather low.
- Maintaining the translations, the quality and the consistency is
difficult and time consuming.
- Sometimes the translation of the technical terms are a bit unusual and
not as clear as the English counterpart. For example in French it isn't
obvious that "gestionnaire de protocole" relates to ProtocolHandler
which is an internal Tomcat concept. Other translations are even funny
like "enrobeur de conteneur" for "wrapper container" (a pastry concept
applied to a freight container?). This issue is so common with the
French translation that many messages carry the English terms in
parentheses to clarify the meaning.

Emmanuel Bourg

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


--

Marek Czernek

JWS/JBCS Associate Quality Engineer, RHCA



svn commit: r1846202 - in /tomcat/site/trunk/docs/tomcat-9.0-doc: ./ api/ api/org/apache/catalina/ api/org/apache/catalina/ant/ api/org/apache/catalina/ant/jmx/ api/org/apache/catalina/authenticator/

2018-11-08 Thread markt
Author: markt
Date: Thu Nov  8 21:56:01 2018
New Revision: 1846202

URL: http://svn.apache.org/viewvc?rev=1846202&view=rev
Log:
Update docs for 9.0.13


[This commit notification would consist of 78 parts, 
which exceeds the limit of 50 ones, so it was shortened to the summary.]

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



svn commit: r1846203 - in /tomcat/site/trunk: ./ docs/ xdocs/

2018-11-08 Thread markt
Author: markt
Date: Thu Nov  8 21:56:25 2018
New Revision: 1846203

URL: http://svn.apache.org/viewvc?rev=1846203&view=rev
Log:
Update site for 9.0.13 release

Modified:
tomcat/site/trunk/build.properties.default
tomcat/site/trunk/docs/doap_Tomcat.rdf
tomcat/site/trunk/docs/download-90.html
tomcat/site/trunk/docs/index.html
tomcat/site/trunk/docs/migration-9.html
tomcat/site/trunk/docs/oldnews.html
tomcat/site/trunk/docs/whichversion.html
tomcat/site/trunk/xdocs/doap_Tomcat.rdf
tomcat/site/trunk/xdocs/download-90.xml
tomcat/site/trunk/xdocs/index.xml
tomcat/site/trunk/xdocs/migration-9.xml
tomcat/site/trunk/xdocs/oldnews.xml
tomcat/site/trunk/xdocs/whichversion.xml

Modified: tomcat/site/trunk/build.properties.default
URL: 
http://svn.apache.org/viewvc/tomcat/site/trunk/build.properties.default?rev=1846203&r1=1846202&r2=1846203&view=diff
==
--- tomcat/site/trunk/build.properties.default (original)
+++ tomcat/site/trunk/build.properties.default Thu Nov  8 21:56:25 2018
@@ -39,7 +39,7 @@ tomcat.loc=http://www.apache.org/dist/to
 tomcat70=7.0.91
 tomcat80=8.0.53
 tomcat85=8.5.34
-tomcat90=9.0.12
+tomcat90=9.0.13
 
 # - Download destination -
 tomcat-site-docs.home=${base.path}/tomcat-site-docs/

Modified: tomcat/site/trunk/docs/doap_Tomcat.rdf
URL: 
http://svn.apache.org/viewvc/tomcat/site/trunk/docs/doap_Tomcat.rdf?rev=1846203&r1=1846202&r2=1846203&view=diff
==
--- tomcat/site/trunk/docs/doap_Tomcat.rdf (original)
+++ tomcat/site/trunk/docs/doap_Tomcat.rdf Thu Nov  8 21:56:25 2018
@@ -60,8 +60,8 @@
 
   
 Latest Stable 9.0.x Release
-2018-09-10
-9.0.12
+2018-11-07
+9.0.13
   
 
 

Modified: tomcat/site/trunk/docs/download-90.html
URL: 
http://svn.apache.org/viewvc/tomcat/site/trunk/docs/download-90.html?rev=1846203&r1=1846202&r2=1846203&view=diff
==
--- tomcat/site/trunk/docs/download-90.html (original)
+++ tomcat/site/trunk/docs/download-90.html Thu Nov  8 21:56:25 2018
@@ -217,7 +217,7 @@
 Quick Navigation
 
 
-[define v]9.0.12[end]
+[define v]9.0.13[end]
 https://www.apache.org/dist/tomcat/tomcat-9/KEYS";>KEYS |
 [v] |
 Browse |

Modified: tomcat/site/trunk/docs/index.html
URL: 
http://svn.apache.org/viewvc/tomcat/site/trunk/docs/index.html?rev=1846203&r1=1846202&r2=1846203&view=diff
==
--- tomcat/site/trunk/docs/index.html (original)
+++ tomcat/site/trunk/docs/index.html Thu Nov  8 21:56:25 2018
@@ -240,6 +240,40 @@ project logo are trademarks of the Apach
 
 
 
+
+2018-11-07 Tomcat 9.0.13 Released
+
+
+
+The Apache Tomcat Project is proud to announce the release of version 9.0.13
+of Apache Tomcat. The notable changes compared to 9.0.12 include:
+
+
+
+support for TLSv1.3 when used with a JRE or OpenSSL version that supports
+it
+
+added support for encrypting cluster traffic
+
+added automatic reloading of tomcat-users.xml after a change
+
+
+
+
+
+Full details of these changes, and all the other changes, are available in the
+Tomcat 9
+changelog.
+
+
+
+
+
+https://tomcat.apache.org/download-90.cgi";>Download
+
+
+
+
 
 2018-10-20 Tomcat Native 1.2.18 Released
 
@@ -307,42 +341,6 @@ Full details of these changes, and all t
 
 
 
-
-
-2018-09-10 Tomcat 9.0.12 Released
-
-
-
-The Apache Tomcat Project is proud to announce the release of version 9.0.12
-of Apache Tomcat. The notable changes compared to 9.0.11 include:
-
-
-
-Fix multiple issues associated with using the asynchronous Servlet API in
-combination with HTTP/2.
-
-Add recursion to rewrite substitution parsing.
-
-Expand the information in the documentation web application regarding the
-use of CATALINA_HOME and CATALINA_BASE. Patch provided by Marek
-Czernek.
-
-
-
-
-
-Full details of these changes, and all the other changes, are available in the
-Tomcat 9
-changelog.
-
-
-
-
-
-https://tomcat.apache.org/download-90.cgi";>Download
-
-
-
 
 
 2018-09-10 Tomcat 8.5.34 Released

Modified: tomcat/site/trunk/docs/migration-9.html
URL: 
http://svn.apache.org/viewvc/tomcat/site/trunk/docs/migration-9.html?rev=1846203&r1=1846202&r2=1846203&view=diff
==
--- tomcat/site/trunk/docs/migration-9.html (original)
+++ tomcat/site/trunk/docs/migration-9.html Thu Nov  8 21:56:25 2018
@@ -842,7 +842,8 @@ of Apache Tomcat.
   "9.0.8":"1830389",
   "9.0.10":"1833930",
   "9.0.11":"1837880",
-  "9.0.12":"1840069"
+  "9.0.12":"1840069",
+  "9.0.13":"1845587"
 };
 
 formSubmit.action = "http://svn.apache.org/viewvc/tomcat/trunk/"; +
@@ -898,8 +899,9 @@ of Apache Tomcat.
  

Re: Tomcat 7.0.91 : Issue with Kerberos Authentication

2018-11-08 Thread Vipul Mehta
 I made a small mistake in my query.
'javax.security.auth.kerberos.KerberosPrincipal' was added to server.xml in
userClassNames within Realm Attribute and Realm attribute looks like
following in server.xml:
=>  

In 7.0.84 version, there was no requirement to modify userClassNames.
We use Microsoft KDC. This is the case of integrated windows authentication.

Our JAAS config for tomcat web application
(tomcat/temp//conf/jaas.conf) looks like following:
com.sun.security.jgss.krb5.accept {
   com.sun.security.auth.module.Krb5LoginModule required
   doNotPrompt=true
   isInitiator=false
   principal="HTTP/
azureadlinuxvm.ispazuread.onmicrosoft@ispazuread.onmicrosoft.com"
   useKeyTab=true
   keyTab="//home//ispqa//sitekey//webapp_http.keytab"
   storeKey=true
   debug=false;
};

Tomcat {
   com.sun.security.auth.module.Krb5LoginModule required
   doNotPrompt=true
   isInitiator=false
   useKeyTab=true
   principal="HTTP/
azureadlinuxvm.ispazuread.onmicrosoft@ispazuread.onmicrosoft.com"
   keyTab="//home//ispqa//sitekey//webapp_http.keytab"
   storeKey=true
   debug=false;
};

Here's the stacktrace which I think has issue:
LoginContext.invokePriv(String) line: 679
LoginContext.login() line: 588
JAASRealm.authenticate(String, CallbackHandler) line: 427
JAASRealm.getPrincipal(String) line: 505
JAASRealm(RealmBase).getPrincipal(String, GSSCredential) line: 1374
JAASRealm(RealmBase).authenticate(GSSContext, boolean) line: 581
SpnegoAuthenticator$AuthenticateAction.run() line: 352
SpnegoAuthenticator$AuthenticateAction.run() line: 337
AccessController.doPrivileged(PrivilegedAction, AccessControlContext)
line: not available [native method]
Subject.doAs(Subject, PrivilegedAction) line: 360
SpnegoAuthenticator.authenticate(Request, HttpServletResponse, LoginConfig)
line: 251
SpnegoAuthenticator(AuthenticatorBase).invoke(Request, Response) line:
566
StandardHostValve.invoke(Request, Response) line: 169
ErrorReportValve.invoke(Request, Response) line: 104
StandardEngineValve.invoke(Request, Response) line: 116
CoyoteAdapter.service(Request, Response) line: 445
Http11Processor(AbstractHttp11Processor).process(SocketWrapper) line:
1137
Http11Protocol$Http11ConnectionHandler(AbstractProtocol$AbstractConnectionHandler).process(SocketWrapper,
SocketStatus) line: 637
JIoEndpoint$SocketProcessor.run() line: 318
ThreadPoolExecutor(ThreadPoolExecutor).runWorker(ThreadPoolExecutor$Worker)
line: 1149
ThreadPoolExecutor$Worker.run() line: 624
TaskThread$WrappingRunnable.run() line: 61
TaskThread(Thread).run() line: 748


LoginContext.invokePriv() -> this populates the Subject with subject of
server Principal "HTTP/
azureadlinuxvm.ispazuread.onmicrosoft@ispazuread.onmicrosoft.com".

Authenticating username belongs to client i.e.
infadom...@ispazuread.onmicrosoft.com.

Here's the GenericPrincipal that is return by JAASRealm.authenticate():
GenericPrincipal  (id=213)
gssCredentialnull
loginContextLoginContext  (id=218)
name"infadom...@ispazuread.onmicrosoft.com" (id=219)
passwordnull
rolesString[0]  (id=221)
userPrincipalKerberosPrincipal  (id=223)
fullName"HTTP/
azureadlinuxvm.ispazuread.onmicrosoft@ispazuread.onmicrosoft.com"
(id=225)
nameType1
realm"ISPAZUREAD.ONMICROSOFT.COM" (id=226)

I don't think it should populate server's KerberosPrincipal as
userPrincipal. Let me know if you need more information.

On Wed, Nov 7, 2018 at 2:41 PM Mark Thomas  wrote:

> On 05/11/2018 12:24, Vipul Mehta wrote:
> > We have upgraded from tomcat version 7.0.84 to 7.0.91.
> > Users authenticate with our web app service using Kerberos logged in user
> > credential. After upgrade, login started to fail.
> >
> > It was because of this change due to which the modified method started
> > returning null:
> >
> >
> https://github.com/apache/tomcat70/commit/7b7b5932b6618d13042732c77a4e19ea89b432e3#diff-6fec32edbbb606fe1d1888c99d74e665
> >
> >
> > User principal was KerberosPrincipal and the class was not specified in
> > userClassNames in JAAS config of web application for tomcat. So, I added
> > 'KerberosPrincipal' class in JAAS configuration.
> >
> > =>
> >
> "org.apache.catalina.realm.GenericPrincipal,javax.security.auth.kerberos.KerberosPrincipal"
> >
> >
> > Now we are facing new issue. The principal being returned by
> > JAASRealm->createPrincipal() is KerberosPrincipal and not
> > GenericUserPrincipal which breaks our code.
> >
> > KerberosPrincipal does not have delegated credential.
> >
> >
> > On debugging i found that, in JAASRealm->authenticate() method,
> > loginContext.getSubject() returns server's subject and not client's. So,
> > later in createPrincipal() call username is client's username but subject
> > belongs to server. Is this an issue ?
>
> I've spun up the VMs I use for testing this and checked Tomcat 7.0.88
> (the last version before the change above) and 7.0.x. The environment is
> configured as per
> http://tomcat.apache.org/tom

Re: L10n / I18n

2018-11-08 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Mark,

On 11/7/18 5:36 PM, Mark Thomas wrote:
> Hi,
> 
> After looking at bug 62843, I got thinking about tools to help
> manage translations from contributors. Something that would show
> the key, the original value and the translated value side by side.
> 
> I looked at Pootle but that was more run it yourself. My preference
> was for something that was hosted. I then looked at POEditor
> (poeditor.com) and that seemed to fit the bill.
> 
> It seems that these tools all expect a single file per language (at
> leat the two I have looked at so far do) so I wrote some code to
> merge the LocalString.properties files into a single file per
> language (I prefixed the keys with the package name to ensure they
> remained unique).
> 
> Having uploaded these, the tool identified ~20 keys that existed
> in translations but not in the original. Hence the handful of
> commits this afternoon cleaning those up.
> 
> What we are left with is the following:
> 
> French 18% German  2% Japanese   21% Portuguese  1% Russian
> 8% Spanish42%
> 
> (% is the number of keys translated into that language)
> 
> POEditor offer free unlimited plans for OSI approved licensed
> software (that includes Tomcat).
> 
> What I would like to do is announce this on the users list and
> invite contributors to start adding translations - potentially for
> new languages.
> 
> However, there is a catch. How to get the translations back into
> Tomcat? I'll need to write some more code to do this - that isn't
> an issue. The issue is that retaining the current comments and
> ordering in the translated files would be a LOT of work. It would
> be a lot easier if I could just write the keys out in alphabetical
> order with each block (determined by the key value up to the first
> period) separated by a blank line. Would that be acceptable?
> 
> If it is, I'll clean the English files up by hand so that the
> comments are retained for those files.
> 
> WDYT?

It's an offline tool, but I've always used Attesoro[1] for this
purpose. Completely free with full source code.

It handles comments, key-ordering, etc.

- -chris

[1] https://attesoro.org/ and
https://github.com/stephenostermiller/attesoro
-BEGIN PGP SIGNATURE-
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlvjggAACgkQHPApP6U8
pFheDQ/6AwaZg+M9oipgdn0wFpLvpQQLFfGF/jekzw8P5Amhrue808+lR6rvWNqk
YX+TFU8Ur0rj7IzFBGLny+pRS8UXELwvpoYF0yrm5lkmquYU/zhVaXSD3YyvBPCN
egxq1rigSQV653WpERvVvgECDSuC7uef4CKANwveQTzuLFfToCbBg7Sp1zdhpVGw
scF+J/P9wl/MJbIbopuIk21N/gxJvcRuYnX5lfrqr9WPBrN/GSniESisQ62lEvJx
dAg+D+1MmqOl4lSI0obpTphhbcsaZrl++GKwhvBSG+jaHTqvmQ6jZHveTGNkFEWD
J5nwmRzch2+gLzhDXXxPJLPbd7jP8vWaAsE8I5jdom0oGJOD0gCV2h1RcWMiQL1X
WRpisOFzeqtm8xmCdrQEfZqpHiEMEAOSEC43k4vwtQbIO9NPY61m/MEtobDjWnEx
SijQeHlS6A65Da+NY64539oXMo+nYMZBWDM3I8Nd64krNqvHU6OsKEZKAsaknK1B
YkIREvQXkrDk13WI3oiShfHysug128NuKfgIcVIBHhE5K4UZbCci6CjmNut9zD5I
5HHF/pO8YbitoQKrFQ53NhlnOwRM+HUcs66eRkSZqnhwCsurk5j2y3nocDCSwajQ
WzYQtTJED2G2x3hciK+UEOTru3lyvO+hw3iuFhIc16g7z6QoAxE=
=67dY
-END PGP SIGNATURE-

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



svn commit: r1846196 - /tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoaderBase.java

2018-11-08 Thread markt
Author: markt
Date: Thu Nov  8 21:10:43 2018
New Revision: 1846196

URL: http://svn.apache.org/viewvc?rev=1846196&view=rev
Log:
Fix comment typo

Modified:
tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoaderBase.java

Modified: 
tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoaderBase.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoaderBase.java?rev=1846196&r1=1846195&r2=1846196&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoaderBase.java 
(original)
+++ tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoaderBase.java Thu 
Nov  8 21:10:43 2018
@@ -1720,7 +1720,7 @@ public abstract class WebappClassLoaderB
 getContextName(), threadName, 
getStackTrace(thread)));
 }
 
-// Don't try an stop the threads unless explicitly
+// Don't try and stop the threads unless explicitly
 // configured to do so
 if (!clearReferencesStopThreads) {
 continue;



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



svn commit: r1846195 - /tomcat/trunk/webapps/examples/WEB-INF/classes/LocalStrings_en.properties

2018-11-08 Thread markt
Author: markt
Date: Thu Nov  8 21:07:55 2018
New Revision: 1846195

URL: http://svn.apache.org/viewvc?rev=1846195&view=rev
Log:
Remove essentially duplicate file

Removed:
tomcat/trunk/webapps/examples/WEB-INF/classes/LocalStrings_en.properties


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



Re: L10n / I18n

2018-11-08 Thread Mark Thomas

On 08/11/2018 15:32, Rémy Maucherat wrote:

On Thu, Nov 8, 2018 at 3:47 PM Mark Thomas  wrote:


On 08/11/2018 00:16, Emmanuel Bourg wrote:

Le 07/11/2018 à 23:36, Mark Thomas a écrit :


WDYT?


What about simplifying the issue by dropping the translations of the
internal messages and retaining only the user facing messages (things
like HTTP error messages that can appear in a normal request) ?


That was completely unexpected. Some serious food for thought here.



Same :D




I think it's worth considering because:
- The target audience of Tomcat is mainly developers and administrators
which are used to read English text.


My primary concern is that it could make Tomcat less accessible to
non-native Eglish speakers. Granted all of our documentation, nearly
every message on the mailing list, issue tracker, code comments etc are
all in English but is that a reason to drop attempts to provide i10n or
is it an indication we aren't doing nearly enough?

The irony of asking that question on a mailing list where messages are
in English hasn't escaped me.



Yes, the question is: is it ever going to be possible to use Tomcat for
someone who doesn't understand english at all (since the req level is
pretty low).

However, whatever happens, using a string bundle should remain mandatory.




- The coverage of the translations is rather low.


They tend to get done once at a point in time where they are close to
100% and then tail of as the code is refactored and new features added.


- Maintaining the translations, the quality and the consistency is
difficult and time consuming.


There has been very little of this. I recall a big donation of Spanish
translations, the recent Russian additions and then, apart from those,
the odd typo fix here and there. My hope was that, with a tool like
POEditor, it would be easier for contributors to improve and/or add to
the translations.


- Sometimes the translation of the technical terms are a bit unusual and
not as clear as the English counterpart. For example in French it isn't
obvious that "gestionnaire de protocole" relates to ProtocolHandler
which is an internal Tomcat concept. Other translations are even funny
like "enrobeur de conteneur" for "wrapper container" (a pastry concept
applied to a freight container?). This issue is so common with the
French translation that many messages carry the English terms in
parentheses to clarify the meaning.


If my French was a lot better, I might just start reading the
translations to enjoy the humour. Seriously, we (well, those in the
community that speak French fluently - not me) could look to improve
those. I think it might be better to not translate class/interface names
like "ProtocolHandler", "Realm" or maybe put the translations in
brackets. As for the shipping container wrapped in pastry, I assume a
better translation is possible.



It might sound funny, but the pastry thing is correct.



But that brings us back to your original question of whether the
translations are worth it. If (and it is a fairly big if) the
translations were mostly complete and mostly of good quality, would that
change your view? I'm thinking try and improve the translations as a
first step and, if things don't improve, then decide what to do next.



Ok for trying !


Just a reminder. My current plan for importing translated strings means 
that all the LocalStrings_xx.properties files (i.e. the translated files 
but not the English versions) will get re-written meaning:

- all comments will be lost
- all entries will be in alphabetical order
- groups (defined by the key value up to the first period) will be
  separated by a blank line

Mark



Removing the translations (apart from the UI) feels to be too big a step
to me. That said, I can see how they would be a hindrance rather than a
help to some. Perhaps separating the l10n JARs into user facing and
external would give more options. Admins could remove the translated JAR
for the internal messages and get those messages in English if they
prefer. Or we could ship less or even no translations for internal
messages by default and provide them as a separate download.



"apart from the UI", like the manager webapp ? It might sounds obvious, but
if Tomcat is not usable by someone who doesn't understand english, then it
will not add any value but only add confusing translations depending on the
language configured in the user browser.

Rémy



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



L10n / I18n

2018-11-08 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Mark,

(Looks like this message wasn't delivered the first time)

On 11/7/18 5:36 PM, Mark Thomas wrote:
> Hi,
> 
> After looking at bug 62843, I got thinking about tools to help 
> manage translations from contributors. Something that would show 
> the key, the original value and the translated value side by side.
> 
> I looked at Pootle but that was more run it yourself. My
> preference was for something that was hosted. I then looked at
> POEditor (poeditor.com) and that seemed to fit the bill.
> 
> It seems that these tools all expect a single file per language
> (at leat the two I have looked at so far do) so I wrote some code
> to merge the LocalString.properties files into a single file per 
> language (I prefixed the keys with the package name to ensure they 
> remained unique).
> 
> Having uploaded these, the tool identified ~20 keys that existed in
> translations but not in the original. Hence the handful of commits
> this afternoon cleaning those up.
> 
> What we are left with is the following:
> 
> French 18% German  2% Japanese   21% Portuguese  1%
> Russian 8% Spanish42%
> 
> (% is the number of keys translated into that language)
> 
> POEditor offer free unlimited plans for OSI approved licensed 
> software (that includes Tomcat).
> 
> What I would like to do is announce this on the users list and 
> invite contributors to start adding translations - potentially for 
> new languages.
> 
> However, there is a catch. How to get the translations back into 
> Tomcat? I'll need to write some more code to do this - that isn't 
> an issue. The issue is that retaining the current comments and 
> ordering in the translated files would be a LOT of work. It would 
> be a lot easier if I could just write the keys out in alphabetical 
> order with each block (determined by the key value up to the first 
> period) separated by a blank line. Would that be acceptable?
> 
> If it is, I'll clean the English files up by hand so that the 
> comments are retained for those files.
> 
> WDYT?

It's an offline tool, but I've always used Attesoro[1] for this
purpose. Completely free with full source code.

It handles comments, key-ordering, etc.

- -chris

[1] https://attesoro.org/ and
https://github.com/stephenostermiller/attesoro
-BEGIN PGP SIGNATURE-
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlvkk5EACgkQHPApP6U8
pFhCVw//fxOwZTdY5swQo9WkM/poQJs2eGSglpJEkhW6MIS1lHRYYK39Ky0Xvb3o
8JItAb/ejoUGBGTj3JDnwpZXHQua4r965DsyCj+UdRUncrk+4SqhXdVidvv/uvrQ
c+Gu/onxD86m9C2mbmtsDxjgiAtcSBOy8jQerUJSakkAdx0Kpe+akaFLE3O153cg
ENVS9fjdaYIA5yYnDBqFcs9JJVG+5iBC6OaMaw0XaErgrEm2k/69wpIbDbpnAj9O
+Nnhdc8zB4BU/ulMFY6oACUoY1BeRw1mwhcj/Zq1y92AH2sZdB+OTJqa1BNwgIoV
uGsIIdV5cr5e4FpZ8GXwEMXf/xlW2tID+JAh1EVH3g88fJXh9GL0njD42gzYyVUf
4oH03+HutMtLrG3UFWp9xhzOO2RXiq22dcToW1xwBaMawevTqYjf3djtEpTexIjI
H5YqkfSlJqmy2C+mH/ch2YN/lq+f/zqOWTiwHqwwrQPlVY/zRCaNqNrXHuuA95+D
TKAVwuJ1gwJmbji4qLdHJwh6u+dpGrqWVla+2nFrv9jdIU/v6S5RCjXPOSDnBa5c
x80DvPWJpoakmhIKdovMif6Mi+tUeVEJlYm4K/XCB1Qbl3KOrojJfKFllN8hNjON
FCfE51VE2mGA0/WkkZyAFlW/YHV6p4t7aDJ+en53PZ5gUnAfel8=
=NXxR
-END PGP SIGNATURE-

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



svn commit: r1846181 - in /tomcat/trunk/java/org/apache: catalina/core/ContainerBase.java catalina/tribes/group/GroupChannel.java coyote/AbstractProtocol.java

2018-11-08 Thread remm
Author: remm
Date: Thu Nov  8 18:51:16 2018
New Revision: 1846181

URL: http://svn.apache.org/viewvc?rev=1846181&view=rev
Log:
Simplify code.

Modified:
tomcat/trunk/java/org/apache/catalina/core/ContainerBase.java
tomcat/trunk/java/org/apache/catalina/tribes/group/GroupChannel.java
tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java

Modified: tomcat/trunk/java/org/apache/catalina/core/ContainerBase.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/ContainerBase.java?rev=1846181&r1=1846180&r2=1846181&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/core/ContainerBase.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/ContainerBase.java Thu Nov  8 
18:51:16 2018
@@ -936,11 +936,10 @@ public abstract class ContainerBase exte
 setState(LifecycleState.STARTING);
 
 // Start our thread
-threadStart();
 if (backgroundProcessorDelay > 0) {
 monitorFuture = Container.getService(ContainerBase.this)
 .getUtilityExecutor().scheduleWithFixedDelay(
-new ContainerBackgroundProcessorMonitor(), 60, 60, 
TimeUnit.SECONDS);
+new ContainerBackgroundProcessorMonitor(), 0, 60, 
TimeUnit.SECONDS);
 }
 }
 

Modified: tomcat/trunk/java/org/apache/catalina/tribes/group/GroupChannel.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/tribes/group/GroupChannel.java?rev=1846181&r1=1846180&r2=1846181&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/tribes/group/GroupChannel.java 
(original)
+++ tomcat/trunk/java/org/apache/catalina/tribes/group/GroupChannel.java Thu 
Nov  8 18:51:16 2018
@@ -479,26 +479,23 @@ public class GroupChannel extends Channe
 ownExecutor = true;
 }
 super.start(svc);
-startHeartbeat();
 monitorFuture = utilityExecutor.scheduleWithFixedDelay(
 new Runnable() {
 @Override
 public void run() {
 startHeartbeat();
 }
-}, 60, 60, TimeUnit.SECONDS);
+}, 0, 60, TimeUnit.SECONDS);
 }
 
 protected void startHeartbeat() {
 if (heartbeat && (heartbeatFuture == null || (heartbeatFuture != null 
&& heartbeatFuture.isDone( {
 if (heartbeatFuture != null && heartbeatFuture.isDone()) {
-if (heartbeatFuture != null && heartbeatFuture.isDone()) {
-// There was an error executing the scheduled task, get it 
and log it
-try {
-heartbeatFuture.get();
-} catch (InterruptedException | ExecutionException e) {
-
log.error(sm.getString("groupChannel.unable.sendHeartbeat"), e);
-}
+// There was an error executing the scheduled task, get it and 
log it
+try {
+heartbeatFuture.get();
+} catch (InterruptedException | ExecutionException e) {
+
log.error(sm.getString("groupChannel.unable.sendHeartbeat"), e);
 }
 }
 heartbeatFuture = utilityExecutor.scheduleWithFixedDelay(new 
HeartbeatRunnable(),

Modified: tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java?rev=1846181&r1=1846180&r2=1846181&view=diff
==
--- tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java (original)
+++ tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java Thu Nov  8 
18:51:16 2018
@@ -566,7 +566,6 @@ public abstract class AbstractProtocol

Re: Release script for Tomcat 8.5.x

2018-11-08 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

All,

The release script (when run as Administrator, since I think NSIS
requires it?), I was able to produce everything except signed binaries.

I'm going to compare what I built against what Mark built for 8.5.35
to see if it did a plausible job. If so, I'm pretty happy with the
results :)

Thanks,
- -chris

On 11/6/18 5:50 PM, Christopher Schultz wrote:
> All,
> 
> I've been working this afternoon on a Powershell script to do
> pretty much everything for a release. I chose Powershell because
> (a) I will have to operate on Windows for releases until I get NSIS
> working elsewhere and (b) batch scripts are The Worst.
> 
> Starting with The Process[1], I have everything working up through 
> actually invoking "ant release".
> 
> It's downloading everything it needs (except Java... grr Oracle), 
> exporting from svn, etc.
> 
> The Process says to use the latest release of the minimum Java
> version supported by the release. For 8.5.x, that means Java 7, but
> Java 7 has been EOL'd. So... should I grab an old Java 7 JDK for
> building the release, or should I use the latest supported version,
> which is Java 8?
> 
> I haven't yet dealt with the GnuPG key management... I'm not sure
> the best way to do that at this point. I think for now, I'll just
> have toe script stop and say "please install your private key in
> [file]" to continue and then proceed when it's in place.
> 
> It doesn't yet do any of the "preliminaty checks" and it doesn't 
> create svn tags.
> 
> It's not parameterized yet so it's all hard-coded for the 8.5.35 
> release and its dependencies (e.g. ant) are all version-dependent
> at this point as well.
> 
> Once I extract the script from the Windows 10 VM I'm running it in
> and verify that it's actually runnable from a fresh box, I'll post
> it here for anyone to look at. I'll probably put it on GitHub in
> this general area 
> https://github.com/ChristopherSchultz/apache-tomcat-stuff/tree/master/
bi
>
> 
n
> 
> If it makes sense to do so, we could even put it into svn, which is
> a bit of Inception.
> 
> -chris
> 
> [1] https://wiki.apache.org/tomcat/ReleaseProcess
> 
> -
>
> 
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: dev-h...@tomcat.apache.org
> 
-BEGIN PGP SIGNATURE-
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlvjgt0ACgkQHPApP6U8
pFilpA/7B6zBGeLd7gc3IFXEGKTbwgcs07VKDacMaVAbyzt8/GkLTM5UwIEJttcB
/Z1OBWRPqo0XMe5SH6+wDxsowZiG8YMj3fP9o4weYgiSgu/iST0fBoc4rhrbVuqG
sa/MPHth6GikuxhyC12wN062TmEyBVKiusu4/f80KDfUsw6pYkpj6NC9jMzAUWs5
8URoxAP7KjZ4FiavIv1vlxE5I5OXllyektZSQQKf/3TYLZcV61ZS6VIV13+RXYB9
hb6HOGMiyBx7EerUYmPdYe+btnA60BagN8qLOFztMd1QNRTFlEIE1cTTzejIoStF
yjf8SVqr9W2K74Mg/kJ1ZDn1v3vkesWwQ7Xq7iDQY8kWDK+8K5/kv+o5zlXPKJw/
sOSe2CR3Fjnl/aviYXlcxzFCobn6A73+SGcw3tmr9oVVTuyW3ZjmcaXkr2ON4VYV
dPRTQPS2PDE3272nz5vlpr6gluFLwdTMekRb8oZVJb8q5AQIi2CGsw+ybKSdddQ9
BBfxJnEBxAwRsiA7g8kwML/yTj0rW8AKM7t5LB7kV0GeN2HUbJfnpaY/rWt4ezWb
qeibp1FAlEEj4jhj73q30K5Ur3YDJoMBpNQ/xg8y6jW98xkKyOZDT4BLcDOLczFz
X9hxZgjKAQdEohsTTfFU9M8FqBlLij0cAL0txsfB+sluTImHVS0=
=8Pgu
-END PGP SIGNATURE-

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



svn commit: r1846164 - in /tomcat/trunk/java/org/apache: catalina/core/ContainerBase.java catalina/tribes/group/GroupChannel.java coyote/AbstractProtocol.java coyote/LocalStrings.properties

2018-11-08 Thread remm
Author: remm
Date: Thu Nov  8 15:49:57 2018
New Revision: 1846164

URL: http://svn.apache.org/viewvc?rev=1846164&view=rev
Log:
Add monitors to the two other scheduled tasks, and simplify a bit wherever 
possible.

Modified:
tomcat/trunk/java/org/apache/catalina/core/ContainerBase.java
tomcat/trunk/java/org/apache/catalina/tribes/group/GroupChannel.java
tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java
tomcat/trunk/java/org/apache/coyote/LocalStrings.properties

Modified: tomcat/trunk/java/org/apache/catalina/core/ContainerBase.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/ContainerBase.java?rev=1846164&r1=1846163&r2=1846164&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/core/ContainerBase.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/ContainerBase.java Thu Nov  8 
15:49:57 2018
@@ -958,6 +958,7 @@ public abstract class ContainerBase exte
 // Stop our thread
 if (monitorFuture != null) {
 monitorFuture.cancel(true);
+monitorFuture = null;
 }
 threadStop();
 

Modified: tomcat/trunk/java/org/apache/catalina/tribes/group/GroupChannel.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/tribes/group/GroupChannel.java?rev=1846164&r1=1846163&r2=1846164&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/tribes/group/GroupChannel.java 
(original)
+++ tomcat/trunk/java/org/apache/catalina/tribes/group/GroupChannel.java Thu 
Nov  8 15:49:57 2018
@@ -22,6 +22,7 @@ import java.io.Serializable;
 import java.util.Iterator;
 import java.util.List;
 import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.ExecutionException;
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.ScheduledFuture;
 import java.util.concurrent.ScheduledThreadPoolExecutor;
@@ -79,14 +80,15 @@ public class GroupChannel extends Channe
 
 /**
  * If heartbeat == true then how often do we want this
- * heartbeat to run. default is one minute
+ * heartbeat to run. The default value is 5000 milliseconds.
  */
-protected long heartbeatSleeptime = 5*1000;//every 5 seconds
+protected long heartbeatSleeptime = 5*1000;
 
 /**
  * Internal heartbeat future
  */
 protected ScheduledFuture heartbeatFuture = null;
+protected ScheduledFuture monitorFuture;
 
 /**
  * The  ChannelCoordinator coordinates the bottom layer 
components:
@@ -477,9 +479,30 @@ public class GroupChannel extends Channe
 ownExecutor = true;
 }
 super.start(svc);
-if (heartbeatFuture == null && heartbeat) {
-heartbeatFuture = utilityExecutor.scheduleWithFixedDelay
-(new HeartbeatRunnable(), heartbeatSleeptime, 
heartbeatSleeptime, TimeUnit.MILLISECONDS);
+startHeartbeat();
+monitorFuture = utilityExecutor.scheduleWithFixedDelay(
+new Runnable() {
+@Override
+public void run() {
+startHeartbeat();
+}
+}, 60, 60, TimeUnit.SECONDS);
+}
+
+protected void startHeartbeat() {
+if (heartbeat && (heartbeatFuture == null || (heartbeatFuture != null 
&& heartbeatFuture.isDone( {
+if (heartbeatFuture != null && heartbeatFuture.isDone()) {
+if (heartbeatFuture != null && heartbeatFuture.isDone()) {
+// There was an error executing the scheduled task, get it 
and log it
+try {
+heartbeatFuture.get();
+} catch (InterruptedException | ExecutionException e) {
+
log.error(sm.getString("groupChannel.unable.sendHeartbeat"), e);
+}
+}
+}
+heartbeatFuture = utilityExecutor.scheduleWithFixedDelay(new 
HeartbeatRunnable(),
+heartbeatSleeptime, heartbeatSleeptime, 
TimeUnit.MILLISECONDS);
 }
 }
 
@@ -491,6 +514,10 @@ public class GroupChannel extends Channe
  */
 @Override
 public synchronized void stop(int svc) throws ChannelException {
+if (monitorFuture != null) {
+monitorFuture.cancel(true);
+monitorFuture = null;
+}
 if (heartbeatFuture != null) {
 heartbeatFuture.cancel(true);
 heartbeatFuture = null;
@@ -804,11 +831,7 @@ public class GroupChannel extends Channe
 public class HeartbeatRunnable implements Runnable {
 @Override
 public void run() {
-try {
-heartbeat();
-} catch (Exception x) {
-log.error(sm.getString("groupChannel.unable.sendHeartbeat"), 
x);
-}
+he

Re: L10n / I18n

2018-11-08 Thread Rémy Maucherat
On Thu, Nov 8, 2018 at 3:47 PM Mark Thomas  wrote:

> On 08/11/2018 00:16, Emmanuel Bourg wrote:
> > Le 07/11/2018 à 23:36, Mark Thomas a écrit :
> >
> >> WDYT?
> >
> > What about simplifying the issue by dropping the translations of the
> > internal messages and retaining only the user facing messages (things
> > like HTTP error messages that can appear in a normal request) ?
>
> That was completely unexpected. Some serious food for thought here.
>

Same :D

>
> > I think it's worth considering because:
> > - The target audience of Tomcat is mainly developers and administrators
> > which are used to read English text.
>
> My primary concern is that it could make Tomcat less accessible to
> non-native Eglish speakers. Granted all of our documentation, nearly
> every message on the mailing list, issue tracker, code comments etc are
> all in English but is that a reason to drop attempts to provide i10n or
> is it an indication we aren't doing nearly enough?
>
> The irony of asking that question on a mailing list where messages are
> in English hasn't escaped me.
>

Yes, the question is: is it ever going to be possible to use Tomcat for
someone who doesn't understand english at all (since the req level is
pretty low).

However, whatever happens, using a string bundle should remain mandatory.

>
> > - The coverage of the translations is rather low.
>
> They tend to get done once at a point in time where they are close to
> 100% and then tail of as the code is refactored and new features added.
>
> > - Maintaining the translations, the quality and the consistency is
> > difficult and time consuming.
>
> There has been very little of this. I recall a big donation of Spanish
> translations, the recent Russian additions and then, apart from those,
> the odd typo fix here and there. My hope was that, with a tool like
> POEditor, it would be easier for contributors to improve and/or add to
> the translations.
>
> > - Sometimes the translation of the technical terms are a bit unusual and
> > not as clear as the English counterpart. For example in French it isn't
> > obvious that "gestionnaire de protocole" relates to ProtocolHandler
> > which is an internal Tomcat concept. Other translations are even funny
> > like "enrobeur de conteneur" for "wrapper container" (a pastry concept
> > applied to a freight container?). This issue is so common with the
> > French translation that many messages carry the English terms in
> > parentheses to clarify the meaning.
>
> If my French was a lot better, I might just start reading the
> translations to enjoy the humour. Seriously, we (well, those in the
> community that speak French fluently - not me) could look to improve
> those. I think it might be better to not translate class/interface names
> like "ProtocolHandler", "Realm" or maybe put the translations in
> brackets. As for the shipping container wrapped in pastry, I assume a
> better translation is possible.
>

It might sound funny, but the pastry thing is correct.

>
> But that brings us back to your original question of whether the
> translations are worth it. If (and it is a fairly big if) the
> translations were mostly complete and mostly of good quality, would that
> change your view? I'm thinking try and improve the translations as a
> first step and, if things don't improve, then decide what to do next.
>

Ok for trying !

>
> Removing the translations (apart from the UI) feels to be too big a step
> to me. That said, I can see how they would be a hindrance rather than a
> help to some. Perhaps separating the l10n JARs into user facing and
> external would give more options. Admins could remove the translated JAR
> for the internal messages and get those messages in English if they
> prefer. Or we could ship less or even no translations for internal
> messages by default and provide them as a separate download.
>

"apart from the UI", like the manager webapp ? It might sounds obvious, but
if Tomcat is not usable by someone who doesn't understand english, then it
will not add any value but only add confusing translations depending on the
language configured in the user browser.

Rémy


Re: L10n / I18n

2018-11-08 Thread Mark Thomas
On 08/11/2018 00:16, Emmanuel Bourg wrote:
> Le 07/11/2018 à 23:36, Mark Thomas a écrit :
> 
>> WDYT?
> 
> What about simplifying the issue by dropping the translations of the
> internal messages and retaining only the user facing messages (things
> like HTTP error messages that can appear in a normal request) ?

That was completely unexpected. Some serious food for thought here.

> I think it's worth considering because:
> - The target audience of Tomcat is mainly developers and administrators
> which are used to read English text.

My primary concern is that it could make Tomcat less accessible to
non-native Eglish speakers. Granted all of our documentation, nearly
every message on the mailing list, issue tracker, code comments etc are
all in English but is that a reason to drop attempts to provide i10n or
is it an indication we aren't doing nearly enough?

The irony of asking that question on a mailing list where messages are
in English hasn't escaped me.

> - The coverage of the translations is rather low.

They tend to get done once at a point in time where they are close to
100% and then tail of as the code is refactored and new features added.

> - Maintaining the translations, the quality and the consistency is
> difficult and time consuming.

There has been very little of this. I recall a big donation of Spanish
translations, the recent Russian additions and then, apart from those,
the odd typo fix here and there. My hope was that, with a tool like
POEditor, it would be easier for contributors to improve and/or add to
the translations.

> - Sometimes the translation of the technical terms are a bit unusual and
> not as clear as the English counterpart. For example in French it isn't
> obvious that "gestionnaire de protocole" relates to ProtocolHandler
> which is an internal Tomcat concept. Other translations are even funny
> like "enrobeur de conteneur" for "wrapper container" (a pastry concept
> applied to a freight container?). This issue is so common with the
> French translation that many messages carry the English terms in
> parentheses to clarify the meaning.

If my French was a lot better, I might just start reading the
translations to enjoy the humour. Seriously, we (well, those in the
community that speak French fluently - not me) could look to improve
those. I think it might be better to not translate class/interface names
like "ProtocolHandler", "Realm" or maybe put the translations in
brackets. As for the shipping container wrapped in pastry, I assume a
better translation is possible.

But that brings us back to your original question of whether the
translations are worth it. If (and it is a fairly big if) the
translations were mostly complete and mostly of good quality, would that
change your view? I'm thinking try and improve the translations as a
first step and, if things don't improve, then decide what to do next.

Removing the translations (apart from the UI) feels to be too big a step
to me. That said, I can see how they would be a hindrance rather than a
help to some. Perhaps separating the l10n JARs into user facing and
external would give more options. Admins could remove the translated JAR
for the internal messages and get those messages in English if they
prefer. Or we could ship less or even no translations for internal
messages by default and provide them as a separate download.

Mark

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



buildbot success in on tomcat-trunk

2018-11-08 Thread buildbot
The Buildbot has detected a restored build on builder tomcat-trunk while 
building . Full details are available at:
https://ci.apache.org/builders/tomcat-trunk/builds/3724

Buildbot URL: https://ci.apache.org/

Buildslave for this Build: silvanus_ubuntu

Build Reason: The AnyBranchScheduler scheduler named 'on-tomcat-commit' 
triggered this build
Build Source Stamp: [branch tomcat/trunk] 1846139
Blamelist: remm

Build succeeded!

Sincerely,
 -The Buildbot




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



svn commit: r1846139 - /tomcat/trunk/java/org/apache/catalina/startup/Tomcat.java

2018-11-08 Thread remm
Author: remm
Date: Thu Nov  8 13:57:23 2018
New Revision: 1846139

URL: http://svn.apache.org/viewvc?rev=1846139&view=rev
Log:
Javadoc.

Modified:
tomcat/trunk/java/org/apache/catalina/startup/Tomcat.java

Modified: tomcat/trunk/java/org/apache/catalina/startup/Tomcat.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/Tomcat.java?rev=1846139&r1=1846138&r2=1846139&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/startup/Tomcat.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/Tomcat.java Thu Nov  8 
13:57:23 2018
@@ -360,6 +360,7 @@ public class Tomcat {
  * SSL certificates, etc).
  * If no configuration source is specified, it will use the default
  * locations for these files.
+ * @param source The configuration source
  */
 public void init(ConfigurationSource source) {
 ConfigFileLoader.setSource(source);



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



buildbot failure in on tomcat-trunk

2018-11-08 Thread buildbot
The Buildbot has detected a new failure on builder tomcat-trunk while building 
. Full details are available at:
https://ci.apache.org/builders/tomcat-trunk/builds/3723

Buildbot URL: https://ci.apache.org/

Buildslave for this Build: silvanus_ubuntu

Build Reason: The AnyBranchScheduler scheduler named 'on-tomcat-commit' 
triggered this build
Build Source Stamp: [branch tomcat/trunk] 1846135
Blamelist: remm

BUILD FAILED: failed compile

Sincerely,
 -The Buildbot




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



svn commit: r1846135 - in /tomcat/trunk: ./ java/org/apache/catalina/realm/ java/org/apache/catalina/startup/ java/org/apache/catalina/users/ java/org/apache/catalina/valves/rewrite/ java/org/apache/t

2018-11-08 Thread remm
Author: remm
Date: Thu Nov  8 13:02:05 2018
New Revision: 1846135

URL: http://svn.apache.org/viewvc?rev=1846135&view=rev
Log:
Add ConfigurationSource to improve on ConfigFileLoader and allow more 
flexibility for configuration files, while standardizing access to most 
container configuration resources. Previously each of server.xml, web.xml and 
context.xml used specific additional secret paths and classloader lookups.
Exceptions: JASPIC (both read and write), memory user database (write), OpenSSL 
configuration (certificate files) and storeconfig (write) continue to use 
regular file access.
Add a new Tomcat.init(ConfigurationSource) that allows using the regular 
configuration "files" to configure the embedded instance rather than Java code. 
Otherwise, embedding necessarily meant lots of code and ultimately reinventing 
the content of server.xml.

Added:

tomcat/trunk/java/org/apache/catalina/startup/CatalinaBaseConfigurationSource.java
   (with props)
tomcat/trunk/java/org/apache/tomcat/util/file/ConfigurationSource.java   
(with props)
tomcat/trunk/test/org/apache/catalina/startup/TestTomcatStandalone.java
Modified:
tomcat/trunk/TOMCAT-NEXT.txt
tomcat/trunk/java/org/apache/catalina/realm/MemoryRealm.java
tomcat/trunk/java/org/apache/catalina/startup/Catalina.java
tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java
tomcat/trunk/java/org/apache/catalina/startup/LocalStrings.properties
tomcat/trunk/java/org/apache/catalina/startup/Tomcat.java
tomcat/trunk/java/org/apache/catalina/users/MemoryUserDatabase.java
tomcat/trunk/java/org/apache/catalina/valves/rewrite/RewriteValve.java
tomcat/trunk/java/org/apache/tomcat/util/file/ConfigFileLoader.java
tomcat/trunk/java/org/apache/tomcat/util/file/LocalStrings.properties
tomcat/trunk/java/org/apache/tomcat/util/net/SSLUtilBase.java
tomcat/trunk/java/org/apache/tomcat/util/net/jsse/JSSEUtil.java
tomcat/trunk/java/org/apache/tomcat/util/net/jsse/PEMFile.java
tomcat/trunk/test/org/apache/tomcat/util/file/TestConfigFileLoader.java
tomcat/trunk/webapps/docs/changelog.xml

Modified: tomcat/trunk/TOMCAT-NEXT.txt
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/TOMCAT-NEXT.txt?rev=1846135&r1=1846134&r2=1846135&view=diff
==
--- tomcat/trunk/TOMCAT-NEXT.txt (original)
+++ tomcat/trunk/TOMCAT-NEXT.txt Thu Nov  8 13:02:05 2018
@@ -37,5 +37,3 @@ New items for 10.0.x onwards:
 
 3.  Remove the ExtensionValidator and associated classes (assuming that the
 minimum Java version is Java 9 or later).
-
-4.  New embedded APIs (likely also for 9.x).

Modified: tomcat/trunk/java/org/apache/catalina/realm/MemoryRealm.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/realm/MemoryRealm.java?rev=1846135&r1=1846134&r2=1846135&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/realm/MemoryRealm.java (original)
+++ tomcat/trunk/java/org/apache/catalina/realm/MemoryRealm.java Thu Nov  8 
13:02:05 2018
@@ -239,7 +239,7 @@ public class MemoryRealm  extends RealmB
 @Override
 protected void startInternal() throws LifecycleException {
 String pathName = getPathname();
-try (InputStream is = ConfigFileLoader.getInputStream(pathName)) {
+try (InputStream is = 
ConfigFileLoader.getSource().getResource(pathName).getInputStream()) {
 // Load the contents of the database file
 if (log.isDebugEnabled()) {
 log.debug(sm.getString("memoryRealm.loadPath", pathName));

Modified: tomcat/trunk/java/org/apache/catalina/startup/Catalina.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/Catalina.java?rev=1846135&r1=1846134&r2=1846135&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/startup/Catalina.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/Catalina.java Thu Nov  8 
13:02:05 2018
@@ -45,11 +45,12 @@ import org.apache.tomcat.util.ExceptionU
 import org.apache.tomcat.util.digester.Digester;
 import org.apache.tomcat.util.digester.Rule;
 import org.apache.tomcat.util.digester.RuleSet;
+import org.apache.tomcat.util.file.ConfigFileLoader;
+import org.apache.tomcat.util.file.ConfigurationSource;
 import org.apache.tomcat.util.log.SystemLogHandler;
 import org.apache.tomcat.util.res.StringManager;
 import org.xml.sax.Attributes;
 import org.xml.sax.InputSource;
-import org.xml.sax.SAXParseException;
 
 
 /**
@@ -79,6 +80,7 @@ public class Catalina {
 protected static final StringManager sm =
 StringManager.getManager(Constants.Package);
 
+public static final String SERVER_XML = "conf/server.xml";
 
 // - Instance Variables
 
@@ -90,7 +92,7 @@ public class Catalina {

buildbot success in on tomcat-trunk

2018-11-08 Thread buildbot
The Buildbot has detected a restored build on builder tomcat-trunk while 
building . Full details are available at:
https://ci.apache.org/builders/tomcat-trunk/builds/3722

Buildbot URL: https://ci.apache.org/

Buildslave for this Build: silvanus_ubuntu

Build Reason: The AnyBranchScheduler scheduler named 'on-tomcat-commit' 
triggered this build
Build Source Stamp: [branch tomcat/trunk] 1846133
Blamelist: remm

Build succeeded!

Sincerely,
 -The Buildbot




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



svn commit: r1846133 - /tomcat/trunk/java/org/apache/catalina/core/ContainerBase.java

2018-11-08 Thread remm
Author: remm
Date: Thu Nov  8 11:56:15 2018
New Revision: 1846133

URL: http://svn.apache.org/viewvc?rev=1846133&view=rev
Log:
Fix issue with contexts and start_prep, as is done in addChildInternal.

Modified:
tomcat/trunk/java/org/apache/catalina/core/ContainerBase.java

Modified: tomcat/trunk/java/org/apache/catalina/core/ContainerBase.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/ContainerBase.java?rev=1846133&r1=1846132&r2=1846133&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/core/ContainerBase.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/ContainerBase.java Thu Nov  8 
11:56:15 2018
@@ -1267,7 +1267,8 @@ public abstract class ContainerBase exte
  * session timeouts.
  */
 protected void threadStart() {
-if (backgroundProcessorDelay > 0 && getState().isAvailable()
+if (backgroundProcessorDelay > 0
+&& (getState().isAvailable() || 
LifecycleState.STARTING_PREP.equals(getState()))
 && (backgroundProcessorFuture == null || 
backgroundProcessorFuture.isDone())) {
 if (backgroundProcessorFuture != null && 
backgroundProcessorFuture.isDone()) {
 // There was an error executing the scheduled task, get it and 
log it



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



Re: buildbot failure in on tomcat-trunk

2018-11-08 Thread Rémy Maucherat
On Thu, Nov 8, 2018 at 11:57 AM  wrote:

> The Buildbot has detected a new failure on builder tomcat-trunk while
> building . Full details are available at:
> https://ci.apache.org/builders/tomcat-trunk/builds/3719
>
> Buildbot URL: https://ci.apache.org/
>
> Buildslave for this Build: silvanus_ubuntu
>
> Build Reason: The AnyBranchScheduler scheduler named 'on-tomcat-commit'
> triggered this build
> Build Source Stamp: [branch tomcat/trunk] 1846118
> Blamelist: remm
>
> BUILD FAILED: failed compile_1
>
> One of my last minute changes to include the backgound process monitor
probably broke something. I'll fix it shortly.

Rémy


svn commit: r1846131 - in /tomcat/trunk: java/org/apache/tomcat/util/net/Acceptor.java java/org/apache/tomcat/util/net/Nio2Endpoint.java webapps/docs/changelog.xml

2018-11-08 Thread remm
Author: remm
Date: Thu Nov  8 11:29:45 2018
New Revision: 1846131

URL: http://svn.apache.org/viewvc?rev=1846131&view=rev
Log:
Remove dedicated NIO2 acceptor thread.

Modified:
tomcat/trunk/java/org/apache/tomcat/util/net/Acceptor.java
tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java
tomcat/trunk/webapps/docs/changelog.xml

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/Acceptor.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/Acceptor.java?rev=1846131&r1=1846130&r2=1846131&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/net/Acceptor.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/Acceptor.java Thu Nov  8 
11:29:45 2018
@@ -151,7 +151,7 @@ public class Acceptor implements Runn
  * @param currentErrorDelay The current delay being applied on failure
  * @return  The delay to apply on the next failure
  */
-private int handleExceptionWithDelay(int currentErrorDelay) {
+protected int handleExceptionWithDelay(int currentErrorDelay) {
 // Don't delay on first exception
 if (currentErrorDelay > 0) {
 try {

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java?rev=1846131&r1=1846130&r2=1846131&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java Thu Nov  8 
11:29:45 2018
@@ -32,6 +32,7 @@ import java.nio.channels.CompletionHandl
 import java.nio.channels.FileChannel;
 import java.nio.channels.NetworkChannel;
 import java.nio.file.StandardOpenOption;
+import java.util.ArrayList;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Future;
@@ -48,6 +49,7 @@ import org.apache.juli.logging.LogFactor
 import org.apache.tomcat.util.ExceptionUtils;
 import org.apache.tomcat.util.collections.SynchronizedStack;
 import org.apache.tomcat.util.net.AbstractEndpoint.Handler.SocketState;
+import org.apache.tomcat.util.net.Acceptor.AcceptorState;
 import org.apache.tomcat.util.net.jsse.JSSESupport;
 
 /**
@@ -86,6 +88,7 @@ public class Nio2Endpoint extends Abstra
  */
 private SynchronizedStack nioChannels;
 
+private Nio2Acceptor acceptor = null;
 
 public Nio2Endpoint() {
 // Override the defaults for NIO2
@@ -182,6 +185,28 @@ public class Nio2Endpoint extends Abstra
 }
 }
 
+@Override
+protected void startAcceptorThreads() {
+// Instead of starting a real acceptor thread, this will instead call
+// an asynchronous accept operation
+if (acceptor == null) {
+acceptors = new ArrayList<>(1);
+acceptor = new Nio2Acceptor(this);
+acceptor.setThreadName(getName() + "-Acceptor-0");
+acceptors.add(acceptor);
+}
+acceptor.state = AcceptorState.RUNNING;
+getExecutor().execute(acceptor);
+}
+
+@Override
+public void resume() {
+super.resume();
+if (isRunning()) {
+acceptor.state = AcceptorState.RUNNING;
+getExecutor().execute(acceptor);
+}
+}
 
 /**
  * Stop the endpoint. This will cause all processing threads to stop.
@@ -193,6 +218,7 @@ public class Nio2Endpoint extends Abstra
 }
 if (running) {
 running = false;
+acceptor.state = AcceptorState.ENDED;
 // Use the executor to avoid binding the main thread if something 
bad
 // occurs and unbind will also wait for a bit for it to complete
 getExecutor().execute(new Runnable() {
@@ -305,7 +331,7 @@ public class Nio2Endpoint extends Abstra
 
socketWrapper.setKeepAliveLeft(Nio2Endpoint.this.getMaxKeepAliveRequests());
 socketWrapper.setSecure(isSSLEnabled());
 // Continue processing on another thread
-return processSocket(socketWrapper, SocketEvent.OPEN_READ, true);
+return processSocket(socketWrapper, SocketEvent.OPEN_READ, false);
 } catch (Throwable t) {
 ExceptionUtils.handleThrowable(t);
 log.error("",t);
@@ -394,6 +420,89 @@ public class Nio2Endpoint extends Abstra
 }
 }
 
+protected class Nio2Acceptor extends Acceptor
+implements CompletionHandler {
+
+protected int errorDelay = 0;
+
+public Nio2Acceptor(AbstractEndpoint 
endpoint) {
+super(endpoint);
+}
+
+@Override
+public void run() {
+// The initial accept will be called in a separate utility thread
+if (!isPaused()) {
+//if we have reached max connections, wait
+

buildbot failure in on tomcat-trunk

2018-11-08 Thread buildbot
The Buildbot has detected a new failure on builder tomcat-trunk while building 
. Full details are available at:
https://ci.apache.org/builders/tomcat-trunk/builds/3719

Buildbot URL: https://ci.apache.org/

Buildslave for this Build: silvanus_ubuntu

Build Reason: The AnyBranchScheduler scheduler named 'on-tomcat-commit' 
triggered this build
Build Source Stamp: [branch tomcat/trunk] 1846118
Blamelist: remm

BUILD FAILED: failed compile_1

Sincerely,
 -The Buildbot




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



svn commit: r1846122 - in /tomcat/trunk: java/org/apache/catalina/connector/ java/org/apache/coyote/ java/org/apache/tomcat/util/net/ webapps/docs/

2018-11-08 Thread remm
Author: remm
Date: Thu Nov  8 10:51:37 2018
New Revision: 1846122

URL: http://svn.apache.org/viewvc?rev=1846122&view=rev
Log:
Refactor async timeout threads of the connectors using a scheduled executor.

Modified:
tomcat/trunk/java/org/apache/catalina/connector/Connector.java
tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java
tomcat/trunk/java/org/apache/coyote/ProtocolHandler.java
tomcat/trunk/java/org/apache/tomcat/util/net/AbstractEndpoint.java
tomcat/trunk/java/org/apache/tomcat/util/net/LocalStrings.properties
tomcat/trunk/webapps/docs/changelog.xml

Modified: tomcat/trunk/java/org/apache/catalina/connector/Connector.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/Connector.java?rev=1846122&r1=1846121&r2=1846122&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/connector/Connector.java (original)
+++ tomcat/trunk/java/org/apache/catalina/connector/Connector.java Thu Nov  8 
10:51:37 2018
@@ -948,6 +948,9 @@ public class Connector extends Lifecycle
 // Initialize adapter
 adapter = new CoyoteAdapter(this);
 protocolHandler.setAdapter(adapter);
+if (service != null) {
+protocolHandler.setUtilityExecutor(service.getUtilityExecutor());
+}
 
 // Make sure parseBodyMethodsSet has a default
 if (null == parseBodyMethodsSet) {

Modified: tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java?rev=1846122&r1=1846121&r2=1846122&view=diff
==
--- tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java (original)
+++ tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java Thu Nov  8 
10:51:37 2018
@@ -23,6 +23,9 @@ import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.Executor;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.ScheduledFuture;
+import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicLong;
 
@@ -90,12 +93,10 @@ public abstract class AbstractProtocol waitingProcessors =
 Collections.newSetFromMap(new ConcurrentHashMap());
 
-
 /**
- * The async timeout thread.
+ * Controller for the async timeout scheduling.
  */
-private AsyncTimeout asyncTimeout = null;
-
+private ScheduledFuture asyncTimeoutFuture = null;
 
 public AbstractProtocol(AbstractEndpoint endpoint) {
 this.endpoint = endpoint;
@@ -201,20 +202,24 @@ public abstract class AbstractProtocol Thread.MAX_PRIORITY) {
-priority = Thread.NORM_PRIORITY;
-}
-timeoutThread.setPriority(priority);
-timeoutThread.setDaemon(true);
-timeoutThread.start();
+}, 1, 1, TimeUnit.SECONDS);
 }
 
+protected void stopAsyncTimeout() {
+if (asyncTimeoutFuture == null) {
+return;
+}
+asyncTimeoutFuture.cancel(false);
+asyncTimeoutFuture = null;
+}
 
 @Override
 public void pause() throws Exception {
@@ -579,6 +601,7 @@ public abstract class AbstractProtocolhttp://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ProtocolHandler.java?rev=1846122&r1=1846121&r2=1846122&view=diff
==
--- tomcat/trunk/java/org/apache/coyote/ProtocolHandler.java (original)
+++ tomcat/trunk/java/org/apache/coyote/ProtocolHandler.java Thu Nov  8 
10:51:37 2018
@@ -17,15 +17,14 @@
 package org.apache.coyote;
 
 import java.util.concurrent.Executor;
+import java.util.concurrent.ScheduledExecutorService;
 
 import org.apache.tomcat.util.net.SSLHostConfig;
 
 /**
  * Abstract the protocol implementation, including threading, etc.
- * Processor is single threaded and specific to stream-based protocols,
- * will not fit Jk protocols like JNI.
  *
- * This is the main interface to be implemented by a coyote connector.
+ * This is the main interface to be implemented by a coyote protocol.
  * Adapter is the main interface to be implemented by a coyote servlet
  * container.
  *
@@ -36,12 +35,18 @@ import org.apache.tomcat.util.net.SSLHos
 public interface ProtocolHandler {
 
 /**
+ * Return the adapter associated with the protocol handler.
+ * @return the adapter
+ */
+public Adapter getAdapter();
+
+
+/**
  * The adapter, used to call the connector.
  *
  * @param adapter The adapter to associate
  */
 public void setAdapter(Adapter adapter);
-public Adapter getAdapter();
 
 
 /**
@@ -53,6 +58,27 @@ public interface ProtocolHandler {
 
 
 /**
+ * Set the optional executor that will be used by the connector.
+ * @param exec

svn commit: r1846121 - /tomcat/trunk/java/org/apache/catalina/ha/tcp/SimpleTcpCluster.java

2018-11-08 Thread remm
Author: remm
Date: Thu Nov  8 10:49:14 2018
New Revision: 1846121

URL: http://svn.apache.org/viewvc?rev=1846121&view=rev
Log:
Set the utility executor from the Service on the Tribes Channel.

Modified:
tomcat/trunk/java/org/apache/catalina/ha/tcp/SimpleTcpCluster.java

Modified: tomcat/trunk/java/org/apache/catalina/ha/tcp/SimpleTcpCluster.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/ha/tcp/SimpleTcpCluster.java?rev=1846121&r1=1846120&r2=1846121&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/ha/tcp/SimpleTcpCluster.java 
(original)
+++ tomcat/trunk/java/org/apache/catalina/ha/tcp/SimpleTcpCluster.java Thu Nov  
8 10:49:14 2018
@@ -499,7 +499,6 @@ public class SimpleTcpCluster extends Li
  * throwables will be caught and logged.
  * @see org.apache.catalina.ha.deploy.FarmWarDeployer#backgroundProcess()
  * @see org.apache.catalina.tribes.group.GroupChannel#heartbeat()
- * @see org.apache.catalina.tribes.group.GroupChannel.HeartbeatThread#run()
  *
  */
 @Override
@@ -528,6 +527,7 @@ public class SimpleTcpCluster extends Li
 name.append(",component=Deployer");
 onameClusterDeployer = register(clusterDeployer, name.toString());
 }
+
channel.setUtilityExecutor(Container.getService(getContainer()).getUtilityExecutor());
 }
 
 



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



svn commit: r1846119 - in /tomcat/trunk: java/org/apache/catalina/tribes/ java/org/apache/catalina/tribes/group/ java/org/apache/catalina/tribes/group/interceptors/ java/org/apache/catalina/tribes/mem

2018-11-08 Thread remm
Author: remm
Date: Thu Nov  8 10:43:00 2018
New Revision: 1846119

URL: http://svn.apache.org/viewvc?rev=1846119&view=rev
Log:
Refactor various operations performed in tribes using a scheduled executor.
When tribes is not running standalone, it will use the executor from the 
Catalina Service.
If running independently (like in the testsuite), the Channel will provide the 
executor.

Modified:
tomcat/trunk/java/org/apache/catalina/tribes/Channel.java
tomcat/trunk/java/org/apache/catalina/tribes/group/GroupChannel.java
tomcat/trunk/java/org/apache/catalina/tribes/group/LocalStrings.properties

tomcat/trunk/java/org/apache/catalina/tribes/group/interceptors/StaticMembershipInterceptor.java

tomcat/trunk/java/org/apache/catalina/tribes/membership/MembershipProviderBase.java
tomcat/trunk/webapps/docs/changelog.xml

Modified: tomcat/trunk/java/org/apache/catalina/tribes/Channel.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/tribes/Channel.java?rev=1846119&r1=1846118&r2=1846119&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/tribes/Channel.java (original)
+++ tomcat/trunk/java/org/apache/catalina/tribes/Channel.java Thu Nov  8 
10:43:00 2018
@@ -18,6 +18,7 @@ package org.apache.catalina.tribes;
 
 import java.io.Serializable;
 import java.util.StringJoiner;
+import java.util.concurrent.ScheduledExecutorService;
 
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
@@ -374,6 +375,18 @@ public interface Channel {
 public void setName(String name);
 
 /**
+ * Return executor that can be used for utility tasks.
+ * @return the executor
+ */
+public ScheduledExecutorService getUtilityExecutor();
+
+/**
+ * Set the executor that can be used for utility tasks.
+ * @param utilityExecutor the executor
+ */
+public void setUtilityExecutor(ScheduledExecutorService utilityExecutor);
+
+/**
  * Translates the name of an option to its integer value.  Valid option 
names are "asynchronous" (alias "async"),
  * "byte_message" (alias "byte"), "multicast", "secure", 
"synchronized_ack" (alias "sync"), "udp", "use_ack"
  * @param opt The name of the option

Modified: tomcat/trunk/java/org/apache/catalina/tribes/group/GroupChannel.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/tribes/group/GroupChannel.java?rev=1846119&r1=1846118&r2=1846119&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/tribes/group/GroupChannel.java 
(original)
+++ tomcat/trunk/java/org/apache/catalina/tribes/group/GroupChannel.java Thu 
Nov  8 10:43:00 2018
@@ -22,6 +22,10 @@ import java.io.Serializable;
 import java.util.Iterator;
 import java.util.List;
 import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.ScheduledFuture;
+import java.util.concurrent.ScheduledThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
 
 import javax.management.MBeanServer;
 import javax.management.ObjectName;
@@ -72,6 +76,7 @@ public class GroupChannel extends Channe
  * If set to true, the channel will start a local thread for the heart 
beat.
  */
 protected boolean heartbeat = true;
+
 /**
  * If heartbeat == true then how often do we want this
  * heartbeat to run. default is one minute
@@ -79,9 +84,9 @@ public class GroupChannel extends Channe
 protected long heartbeatSleeptime = 5*1000;//every 5 seconds
 
 /**
- * Internal heartbeat thread
+ * Internal heartbeat future
  */
-protected HeartbeatThread hbthread = null;
+protected ScheduledFuture heartbeatFuture = null;
 
 /**
  * The  ChannelCoordinator coordinates the bottom layer 
components:
@@ -134,6 +139,11 @@ public class GroupChannel extends Channe
 private boolean jmxEnabled = true;
 
 /**
+ * Executor service.
+ */
+protected ScheduledExecutorService utilityExecutor = null;
+
+/**
  * the ObjectName of this channel.
  */
 private ObjectName oname = null;
@@ -446,6 +456,8 @@ public class GroupChannel extends Channe
 
 }
 
+protected boolean ownExecutor = false;
+
 /**
  * Starts the channel.
  * @param svc int - what service to start
@@ -459,10 +471,15 @@ public class GroupChannel extends Channe
 // register jmx
 JmxRegistry jmxRegistry = JmxRegistry.getRegistry(this);
 if (jmxRegistry != null) this.oname = 
jmxRegistry.registerJmx(",component=Channel", this);
+if (utilityExecutor == null) {
+log.warn(sm.getString("groupChannel.warn.noUtilityExecutor"));
+utilityExecutor = new ScheduledThreadPoolExecutor(1);
+ownExecutor = true;
+}
 super.start(svc);
-if ( hbthread == null && heartbeat ) {
-  

svn commit: r1846118 - in /tomcat/trunk: java/org/apache/catalina/core/ContainerBase.java java/org/apache/catalina/core/LocalStrings.properties webapps/docs/changelog.xml webapps/docs/config/host.xml

2018-11-08 Thread remm
Author: remm
Date: Thu Nov  8 10:29:24 2018
New Revision: 1846118

URL: http://svn.apache.org/viewvc?rev=1846118&view=rev
Log:
Refactor container level threads using the Service executor.
Add additional monitoring of the main container background processor to 
reschedule it when needed.

Modified:
tomcat/trunk/java/org/apache/catalina/core/ContainerBase.java
tomcat/trunk/java/org/apache/catalina/core/LocalStrings.properties
tomcat/trunk/webapps/docs/changelog.xml
tomcat/trunk/webapps/docs/config/host.xml

Modified: tomcat/trunk/java/org/apache/catalina/core/ContainerBase.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/ContainerBase.java?rev=1846118&r1=1846117&r2=1846118&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/core/ContainerBase.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/ContainerBase.java Thu Nov  8 
10:29:24 2018
@@ -24,16 +24,13 @@ import java.security.PrivilegedAction;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
-import java.util.concurrent.BlockingQueue;
 import java.util.concurrent.Callable;
 import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.ExecutionException;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Future;
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.ThreadFactory;
-import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.ScheduledFuture;
 import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReadWriteLock;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
@@ -55,6 +52,7 @@ import org.apache.catalina.LifecycleStat
 import org.apache.catalina.Loader;
 import org.apache.catalina.Pipeline;
 import org.apache.catalina.Realm;
+import org.apache.catalina.Service;
 import org.apache.catalina.Valve;
 import org.apache.catalina.Wrapper;
 import org.apache.catalina.connector.Request;
@@ -172,6 +170,12 @@ public abstract class ContainerBase exte
 
 
 /**
+ * The future allowing control of the background processor.
+ */
+protected ScheduledFuture backgroundProcessorFuture;
+protected ScheduledFuture monitorFuture;
+
+/**
  * The container event listeners for this Container. Implemented as a
  * CopyOnWriteArrayList since listeners may invoke methods to add/remove
  * themselves or other listeners and with a ReadWriteLock that would 
trigger
@@ -254,18 +258,6 @@ public abstract class ContainerBase exte
 
 
 /**
- * The background thread.
- */
-private Thread thread = null;
-
-
-/**
- * The background thread completion semaphore.
- */
-private volatile boolean threadDone = false;
-
-
-/**
  * The access log to use for requests normally handled by this container
  * that have been handled earlier in the processing chain.
  */
@@ -288,27 +280,6 @@ public abstract class ContainerBase exte
 return startStopThreads;
 }
 
-/**
- * Handles the special values.
- */
-private int getStartStopThreadsInternal() {
-int result = getStartStopThreads();
-
-// Positive values are unchanged
-if (result > 0) {
-return result;
-}
-
-// Zero == Runtime.getRuntime().availableProcessors()
-// -ve  == Runtime.getRuntime().availableProcessors() + value
-// These two are the same
-result = Runtime.getRuntime().availableProcessors() + result;
-if (result < 1) {
-result = 1;
-}
-return result;
-}
-
 @Override
 public void setStartStopThreads(int startStopThreads) {
 int oldStartStopThreads = this.startStopThreads;
@@ -316,7 +287,7 @@ public abstract class ContainerBase exte
 
 // Use local copies to ensure thread safety
 if (oldStartStopThreads != startStopThreads && startStopExecutor != 
null) {
-reconfigureStartStopExecutor(getStartStopThreadsInternal());
+reconfigureStartStopExecutor(getStartStopThreads());
 }
 }
 
@@ -884,7 +855,7 @@ public abstract class ContainerBase exte
 
 @Override
 protected void initInternal() throws LifecycleException {
-reconfigureStartStopExecutor(getStartStopThreadsInternal());
+reconfigureStartStopExecutor(getStartStopThreads());
 super.initInternal();
 }
 
@@ -896,21 +867,15 @@ public abstract class ContainerBase exte
  */
 private void reconfigureStartStopExecutor(int threads) {
 if (threads == 1) {
+// Use a fake executor
 if (!(startStopExecutor instanceof InlineExecutorService)) {
 startStopExecutor = new InlineExecutorService();
 }
 } else {
-if (startStopExecuto

svn commit: r1846116 - in /tomcat/trunk: java/org/apache/catalina/ java/org/apache/catalina/core/ java/org/apache/tomcat/util/threads/ test/org/apache/catalina/mbeans/ webapps/docs/ webapps/docs/confi

2018-11-08 Thread remm
Author: remm
Date: Thu Nov  8 10:17:43 2018
New Revision: 1846116

URL: http://svn.apache.org/viewvc?rev=1846116&view=rev
Log:
Add a scheduled executor service to the Service, which can be used to process 
utility tasks including periodic ones.
Add a simple wrapper to prevent random lifecycle and configuration operations.
Add a bean for it.

Added:

tomcat/trunk/java/org/apache/tomcat/util/threads/ScheduledThreadPoolExecutor.java
   (with props)
Modified:
tomcat/trunk/java/org/apache/catalina/Service.java
tomcat/trunk/java/org/apache/catalina/core/StandardService.java
tomcat/trunk/test/org/apache/catalina/mbeans/TestRegistration.java
tomcat/trunk/webapps/docs/changelog.xml
tomcat/trunk/webapps/docs/config/service.xml

Modified: tomcat/trunk/java/org/apache/catalina/Service.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/Service.java?rev=1846116&r1=1846115&r2=1846116&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/Service.java (original)
+++ tomcat/trunk/java/org/apache/catalina/Service.java Thu Nov  8 10:17:43 2018
@@ -18,6 +18,8 @@
 
 package org.apache.catalina;
 
+import java.util.concurrent.ScheduledExecutorService;
+
 import org.apache.catalina.connector.Connector;
 import org.apache.catalina.mapper.Mapper;
 
@@ -96,6 +98,20 @@ public interface Service extends Lifecyc
 public String getDomain();
 
 
+/**
+ * Get the utility thread count.
+ * @return the thread count
+ */
+public int getUtilityThreads();
+
+
+/**
+ * Set the utility thread count.
+ * @param utilityThreads the new thread count
+ */
+public void setUtilityThreads(int utilityThreads);
+
+
 // - Public Methods
 
 /**
@@ -151,4 +167,10 @@ public interface Service extends Lifecyc
  * @return the mapper associated with this Service.
  */
 Mapper getMapper();
+
+/**
+ * @return the utility executor managed by the Service.
+ */
+ScheduledExecutorService getUtilityExecutor();
+
 }

Modified: tomcat/trunk/java/org/apache/catalina/core/StandardService.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/StandardService.java?rev=1846116&r1=1846115&r2=1846116&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/core/StandardService.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/StandardService.java Thu Nov  8 
10:17:43 2018
@@ -20,6 +20,11 @@ package org.apache.catalina.core;
 import java.beans.PropertyChangeListener;
 import java.beans.PropertyChangeSupport;
 import java.util.ArrayList;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.ScheduledThreadPoolExecutor;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
 
 import javax.management.ObjectName;
 
@@ -85,10 +90,25 @@ public class StandardService extends Lif
 private final Object connectorsLock = new Object();
 
 /**
- *
+ * The list of executors held by the service.
  */
 protected final ArrayList executors = new ArrayList<>();
 
+/**
+ * The number of threads available to process utility tasks in this 
service.
+ */
+protected int utilityThreads = 0;
+
+/**
+ * Utility executor with scheduling capabilities.
+ */
+private ScheduledThreadPoolExecutor utilityExecutor = null;
+
+/**
+ * Utility executor wrapper.
+ */
+private ScheduledExecutorService utilityExecutorWrapper = null;
+
 private Engine engine = null;
 
 private ClassLoader parentClassLoader = null;
@@ -202,8 +222,65 @@ public class StandardService extends Lif
 }
 
 
+@Override
+public int getUtilityThreads() {
+return utilityThreads;
+}
+
+
+/**
+ * Handles the special values.
+ */
+private int getUtilityThreadsInternal() {
+int result = getUtilityThreads();
+if (result > 0) {
+return result;
+}
+
+// Zero == Runtime.getRuntime().availableProcessors()
+// -ve  == Runtime.getRuntime().availableProcessors() + value
+// These two are the same
+result = (Runtime.getRuntime().availableProcessors() / 2) + result;
+if (result < 1) {
+result = 1;
+}
+return result;
+}
+
+@Override
+public void setUtilityThreads(int utilityThreads) {
+if (utilityThreads < getUtilityThreadsInternal()) {
+return;
+}
+int oldUtilityThreads = this.utilityThreads;
+this.utilityThreads = utilityThreads;
+
+// Use local copies to ensure thread safety
+if (oldUtilityThreads != utilityThreads && utilityExecutor != null) {
+reconfigureUtilityExecutor(getUtility

svn commit: r1846112 - in /tomcat/trunk/java/org/apache/catalina: Container.java util/LifecycleMBeanBase.java

2018-11-08 Thread remm
Author: remm
Date: Thu Nov  8 10:10:00 2018
New Revision: 1846112

URL: http://svn.apache.org/viewvc?rev=1846112&view=rev
Log:
Add a few additional utility methods to reduce code duplication: get the 
default config path of a container, unregister bean based on properties and get 
the Service.

Modified:
tomcat/trunk/java/org/apache/catalina/Container.java
tomcat/trunk/java/org/apache/catalina/util/LifecycleMBeanBase.java

Modified: tomcat/trunk/java/org/apache/catalina/Container.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/Container.java?rev=1846112&r1=1846111&r2=1846112&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/Container.java (original)
+++ tomcat/trunk/java/org/apache/catalina/Container.java Thu Nov  8 10:10:00 
2018
@@ -297,6 +297,56 @@ public interface Container extends Lifec
 public void setRealm(Realm realm);
 
 
+/**
+ * Find the configuration path where a configuration resource
+ * is located.
+ * @param container The container
+ * @param resourceName The resource file name
+ * @return the configuration path
+ */
+public static String getConfigPath(Container container, String 
resourceName) {
+StringBuffer result = new StringBuffer();
+Container host = null;
+Container engine = null;
+while (container != null) {
+if (container instanceof Host) {
+host = container;
+} else if (container instanceof Engine) {
+engine = container;
+}
+container = container.getParent();
+}
+if (host != null && ((Host) host).getXmlBase() != null) {
+result.append(((Host) host).getXmlBase()).append('/');
+} else {
+if (engine != null) {
+result.append(engine.getName()).append('/');
+}
+if (host != null) {
+result.append(host.getName()).append('/');
+}
+}
+result.append(resourceName);
+return result.toString();
+}
+
+
+/**
+ * Return the Service to which this container belongs.
+ * @param container The container to start from
+ * @return the Service, or null if not found
+ */
+public static Service getService(Container container) {
+while (container != null && !(container instanceof Engine)) {
+container = container.getParent();
+}
+if (container == null) {
+return null;
+}
+return ((Engine) container).getService();
+}
+
+
 // - Public Methods
 
 

Modified: tomcat/trunk/java/org/apache/catalina/util/LifecycleMBeanBase.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/util/LifecycleMBeanBase.java?rev=1846112&r1=1846111&r2=1846112&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/util/LifecycleMBeanBase.java 
(original)
+++ tomcat/trunk/java/org/apache/catalina/util/LifecycleMBeanBase.java Thu Nov  
8 10:10:00 2018
@@ -178,6 +178,36 @@ public abstract class LifecycleMBeanBase
  * Note: This method should only be used once {@link #initInternal()} has
  * been called and before {@link #destroyInternal()} has been called.
  *
+ * @param objectNameKeyProperties   The key properties component of the
+ *  object name to use to unregister the
+ *  object
+ */
+protected final void unregister(String objectNameKeyProperties) {
+// Construct an object name with the right domain
+StringBuilder name = new StringBuilder(getDomain());
+name.append(':');
+name.append(objectNameKeyProperties);
+
+ObjectName on = null;
+
+try {
+on = new ObjectName(name.toString());
+Registry.getRegistry(null, null).unregisterComponent(on);
+} catch (MalformedObjectNameException e) {
+log.warn(sm.getString("lifecycleMBeanBase.unregisterFail", name), 
e);
+} catch (Exception e) {
+log.warn(sm.getString("lifecycleMBeanBase.unregisterFail", name), 
e);
+}
+}
+
+
+/**
+ * Utility method to enable sub-classes to easily unregister additional
+ * components that don't implement {@link JmxEnabled} with an MBean server.
+ * 
+ * Note: This method should only be used once {@link #initInternal()} has
+ * been called and before {@link #destroyInternal()} has been called.
+ *
  * @param onThe name of the component to unregister
  */
 protected final void unregister(ObjectName on) {



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