Ema Bakar created SIS-640:
-----------------------------

             Summary: Public API to stop SIS's background threads when an 
application is undeployed
                 Key: SIS-640
                 URL: https://issues.apache.org/jira/browse/SIS-640
             Project: Spatial Information Systems
          Issue Type: Improvement
          Components: Referencing
    Affects Versions: 1.7
         Environment: SIS 1.7, JBoss EAP 7.4 (Java EE 8, javax.servlet), 
OpenJDK 11 and 17
            Reporter: Ema Bakar


When SIS is bundled in a web application (WAR or EAR), its background threads 
({{DelayedExecutor}}, {{ReferenceQueueConsumer}}) keep running after the 
application is undeployed. They keep the undeployed application's class loader 
in memory, and later work fails against it. For example, when 
{{DelayedExecutor}} closes the idle EPSG connection after an undeploy, the 
server logs:

{noformat}
WARNING [org.apache.sis.system] (DelayedExecutor) NoClassDefFoundError: 
org/apache/sis/pending/jdk/JDK16
{noformat}

{{org.apache.sis.system.Shutdown.stop(Class)}} does what is needed, but 
{{org.apache.sis.system}} is exported only to SIS modules, so applications have 
no supported way to call it. On the class path it is reachable, and we 
currently call it from our own undeploy hooks, but it is internal API that may 
change without notice.

SIS's own {{ServletListener}} (which also calls {{Shutdown.setContainer}}) is 
in the incubator {{org.apache.sis.webapp}} module, which is not released and 
uses {{jakarta.servlet}}, so containers on {{javax.servlet}} (Java EE 8) can't 
use it either.

*Request*

A public, supported way to stop SIS's threads and release its resources when 
the hosting application shuts down, for example a method in 
{{org.apache.sis.setup}}, usable from any container lifecycle hook (servlet 
listener, EJB {{@PreDestroy}}, CDI). Optionally, the same for 
{{Shutdown.setContainer}}.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to