Re: RE: [ADMIN] High memory usage [PATCH] - Mailing list pgsql-jdbc

From Michael Stephenson
Subject Re: RE: [ADMIN] High memory usage [PATCH]
Date
Msg-id Pine.LNX.4.30.0106261432330.21133-100000@tirin.openworld.co.uk
Whole thread Raw
In response to Re: RE: [ADMIN] High memory usage [PATCH]  (Gunnar Rønning <gunnar@polygnosis.com>)
Responses Re: Re: RE: [ADMIN] High memory usage [PATCH]  (Gunnar Rønning <gunnar@polygnosis.com>)
List pgsql-jdbc
> I only briefly reviewd the code in PreparedStatement yeaterday with respect
> to the usage of the SimpleDateFormat, my comments :
>
> - Why the ThreadLocal usage, and not just syncronize on the same
>   SimpleDateFormat ?

This won't scale. :o)

> - It seems to that the SimpleDateFormat is never modified after creation.
>   Wouldn't this mean that we actually could assign the SimpleDateFormat
>   object to a static member, so we only had to create the object once.
>   Or is concurrent usage of SimpleDateFormat.format() unsafe ?

SimpleDateFormat.format() and SimpleDateFormat.parse() are not threadsafe,
I believe the relevant 'bug' is 4228335.

> I would prefer the latter if safe, as we would get less object creation and
> synchronization.

The latter is what we used to have until it became clear that it wasn't
threadsafe.

I think the ThreadLocal solution is the best one available in the
circumstances.

Michael xxx


pgsql-jdbc by date:

Previous
From: Gunnar Rønning
Date:
Subject: Re: RE: [ADMIN] High memory usage [PATCH]
Next
From: Gunnar Rønning
Date:
Subject: Re: Re: RE: [ADMIN] High memory usage [PATCH]