Jody Garnett ha scritto:
> Thinking about that; I don't see a problem but kind of wish the
> shutdown was a bit more fine grained then that (ie datastore dispose
> cleaning up everything it is responsible for).
> 
> I do like the idea of having the shutdown hook and us using it to
> catch leaks.

Hmmm... ok, shutdown() is probably a misnomer.

The method I have in mind has nothing to do with shutting down GeoTools
in a desktop or command line application: for that use case the
user already has the explicit close methods for any resource it grabs 
(datastores, iterators, coverage readers and whatnot) and for
every thread GeoTools creates there are no problems either
because they are daemon threads (i.e., they don't prevent the
JVM from being shut down).

However, to release a web application being undeployed there is much
more to do.
Those daemon threads have to be manually stopped, otherwise they
will keep the classloader up.
All the custom JAI readers, stream, operations and whatnot have
to be un-registered.
All the JDBC drivers loaded by the datastores have to be unregistered
as well.

All of the above has in common one thing: you have no explicit way
to locate and properly close/unregister any of the above because
they all are implementation details of one or the other subsystem
(99% of the issues come from referencing and coverage subsystems
actually).

So this "shutdown" method is not about closing datastores, or whatever
you have that explicitly and clearly gives you resource handling methods.
It's J2EE specific, and should handle all those nitty gritty details
that are spread out thought the library and that prevent a proper
undeploy of a web application.

Shall we call it GeoTools.undeploy()? onWebApplicationUnload()?

Cheers
Andrea


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

------------------------------------------------------------------------------

_______________________________________________
Geotools-devel mailing list
Geotools-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to