tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Luehe <Jan.Lu...@Sun.COM>
Subject Re: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/connector Request.java
Date Mon, 09 Aug 2004 18:07:51 GMT
Jan.Luehe@Sun.COM
>> The DateFormat[] passed in from Request.parseDate() is *identical* to
>> the static "formats" in FHDF, so why are we not just passing "null"
>> from Request.parseDate() and leverage FHDF.formats (instead of having
>> each Request object provide its own SimpleDateFormat[] instance var)?
>>
>> Is it to avoid that the potentially expensive date parsing is
>> performed inside the synchronized block?
> 
> 
> Yes, it's sort of obvious ;)
> How much memory does a formatter uses ? I'd like to point out that 
> pasing of dates will happen relatively often (last modified headers in 
> requests, etc).
> 
> To summarize:
> - passing null is correct, but syncs (otherwise it wouldn't work)
> - passing a thread local formatter is correct
> - passing a shared formatter isn't correct (as there would be thread 
> safety issues)

Agreed.

I stumbled across mem usage as I was running a stress test
under OptimizeIt (and eventually getting OutOfMemory errors from
Servlets), and noticed a large number of char[] instances had been
allocated due to each Request creating its own SimpleDateFormat[].


Jan


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


Mime
View raw message