Jody Garnett ha scritto:
> Thanks for the background Andrea - I was able to sort things out. It 
> involved messing with uDig start up sequence a fair bit; you will find I 
> added a method to your factory in order to perform a quick check; and 
> based on the feedback manage to open a dialog letting the user know what 
> is going it. Your code review/feedback would of course be welcome.

The method you added is "isUnpacked", right?
It seems to me it has a long window of time in which it won't
work properly.
The method just checks the directory has been created, which happens
right before starting to create the database.
So for all the time it takes to populate the db (15-30 seconds) that 
method will return an invalid response, the db is not really unpacked
until everything is done.

A better solution would be to add a marker file when the database
has been fully created and turned read-only. Checking the existence
of that file would be a better way to check if the database has
been unpacked.

That file could also be used as part of the solution that detects
a database that has not been completely unpacked and is left on
the disk incomplete, think for example a user killing the process
while it's unpacking the database.

However there is something I'm not sure how to handle: two
processes trying to create the same database in parallel.
I guess another file marking the start of the creation could
be used as a lock file, along with this recipe:
http://www.exampledepot.com/egs/java.nio/SetFileLock.html

If we bundle that with the idea of using a pre-made database
that has been stored as a resource we should get a epsg database
that unpacks quick and safely.

Cheers
Andrea

-- 
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Geotools-devel mailing list
Geotools-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to