[geotk] Can I prevent Geotoolkit from spawning new threads?

Martin Desruisseaux martin.desruisseaux at geomatys.fr
Wed Oct 14 05:28:38 EDT 2009

Hello Jon

Jon Blower a écrit :
> GAE disables the creation of any threads.  I haven't found an
> explanation but I assume it's so that they can do load-balancing
> effectively.  Perhaps it ensures that new threads are only created in
> response to HTTP requests, meaning that they can be distributed
> between machines.  I'm not sure.
> See http://code.google.com/appengine/docs/java/runtime.html#The_Sandbox.

I was not aware of such environment... In a context where no Thread spawing is 
allowed we could:

1) Disable the call to ShutdownHook.INSTANCE.register(...) in
    org.geotoolkit.factory.FactoryFinder line 198.

    Consequence: no cleanup on shutdown, but may not be a big deal if
    no database connection were fetched and no temporary file created.

2) Replace usage of Cache / WeakHashMap / WeakHashSet (all those
    classes are in the org.geotoolkit.util.collection package) by
    plain HashMap. It may force us to define a couple of new
    interfaces replacing the direct usage of WeakHashSet / Cache

However even if the Thread issue was fixed, we may be faced to an other one. I 
found in the above link a "white list" of standard Java classes allowed in GAE:


The whole java.awt.geom package is excluded from this white list. This is 
especially anoying for the following class, which is used very extensively by 
Geotk in pratically every coordinate operations:

   - java.awt.geom.AffineTransform

Is there any chances to get GAE to add AffineTransform and its dependencies 
(java.awt.geom.Point2D, java.awt.Shape) on the white list? If they can not, the 
amount of changes required for getting Geotk to run on GAE would be significant 
enough to require the creation of a separated Mercurial clone, and become a 
longer-term task.


More information about the Geotoolkit mailing list