tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier ...@ice-sa.com>
Subject Re: Problem with threads in stage Service (Tomcat 7.0.14)
Date Fri, 29 Jul 2011 21:25:10 GMT
Alejandro Henao González wrote:
> I'm not sure that the problem is this.
> And, many JSPs have this line. 

Well, that would certainly multiply the problem, wouldn't it ?
Do you have any idea what these "system.gc()" were meant to achieve ?

Anyway, nothing that find and grep and a good text editor can't solve.

> may be origin of problem is the hashmap static, because the method HTMLEncoder.encode
not is static and the construct of HTMLEncoder initialize the object. 

If you are not sure of your HTMLEncoder class, there are quite a few available that are 
fully-tested.
A short search in Google for "java html encoder" shows a few, such as this one :

http://jtidy.sourceforge.net/multiproject/jtidyservlet/clover/org/w3c/tidy/servlet/util/HTMLEncode.html
(and there is another one in the Jakarta Commons).

Personally, instead of some kind of HashMap, I would just use a preset array of 
String[128] with the translations of the first 128 char values (translating the inocuous 
characters by themselves), and then translate everything else above 128 to "&#(char 
value);".  Intuitively, it would seem much faster than the complicated logic I see in 
these classes (and yours).
But then, since I am no great Java expert, I may be missing something.

Getting back to the "system.gc()" however, I am pretty sure that if every access to a JSP

page on that system triggers a major GC, then there is no wonder about where your system's

CPU time is being spent.
That is also what Philip seemed to say in his comment to your thread dump.  And he 
definitely is a Java and Tomcat expert.




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message