Martin Desruisseaux wrote:
> Hello Andrea
> 
> The problem you are pointing can be solved in a simplier way...
> 
> 
>> A deeper analysis shows an architectural problem with the sql
>> based EPSG factories, in particular, they get a hold on a single
>> SQL connection and try to perform every operation against it,
>> without any possibility to recover from corruptions.
> 
> Actually there is already a timeout (30-60 minutes in current default) 
> after which the connection is closed and will be reopened later when 
> needed. This timeout is probably way too long for server environment and 
> can be reduced. The only thing you need to do for solving the first part 
> of the problem is to change that timeout. The easiest way is to just 
> change the default value:
> 
>   * Open ThreadedEpsgFactory class. At line 194, change the timeout for a
>     small value (e.g. 30 seconds).

Hmm... for a server that is in actual production, and busy, even 30 
seconds downtime can be questionable.
The patch I cooked up basically results
in no downtime, and very little performance degradation if the
validation query is fast (and it should be, it's just asking the
server about the current time).

> 
>> Checking is done as in most connection pools, by running a user
>> provided statement , different for every database, that is at the
>> same time fast, while forcing a communication with the server.
> 
> In Java 6 there is method for that:
> 
> http://java.sun.com/javase/6/docs/api/java/sql/Connection.html#isValid(int)
> 
> But I realize that you are restricted to Java 5...

Indeed we are. Mind also that I'm proposing to merge the change in 
2.5.x, since that's were I'm affected the most. Given it's just internal
implementation change and the public api is not broken it seems
the patch is applicable there too.

Cheers
Andrea

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to