RE: Re: Inefficient parsing of date header clientresource 2.0.3

2011-01-25 Thread Chris Davis
I see after more digging that InternetDateFormat was added in 2.0, if I do 
upgrade the server side will it use an offset timezone rather than a timezone 
code by default?

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2700337


Re: Inefficient parsing of date header clientresource 2.0.3

2011-01-24 Thread Tal Liron
SimpleDateFormat is not thread-safe -- you have no choice but to 1) 
re-create it per request, or 2) use thread-locals.

-Tal

On 01/24/2011 09:05 AM, Chris Davis wrote:
> Hello,
>
> I have been profiling my android app that uses android restlet client 
> 2.0.3.
> I can see from the profile (image attached see the cornflower blue 
> section on the right hand side of the restlet thread) and subsequent 
> tracing that when DateUtils is used to parse the date header it 
> creates a new SimpleDateFormat object that then has to load all the 
> timezone names from android. This loading takes considerable time and 
> uses a lot of memory and as far as I can tell is done each time a 
> client resource is handled.
>
> At first I thought that the client should cache the dateformat object 
> but that too would hold onto memory (unless it held a weak reference?)
> but I also see from DateUtils that if the format is RFC 3339 then an 
> InternetDateFormat parser is used which I'm guessing wont need to load 
> the timezone names as the timezone is specified in hours
>
> So I am wondering that if I can configure my server resources to 
> return the date header in a format that required less processing? We 
> are using restlet 1.1.9 (I know we need to upgrade, we will get around 
> to it eventually) on the server side can I force it to use RFC 3339?
>
> kind regards
> Chris
>
>
>
>

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2700256