[ 
https://issues.apache.org/jira/browse/SLING-2791?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13602235#comment-13602235
 ] 

Philipp Marx commented on SLING-2791:
-------------------------------------

Yes, we have our own shutdown hook which should be called before the one of 
sling. But all JVM shutdown hooks are called in parallel.

Basically what we want to archive is to gracefully shutdown our Jetty-Server, 
i.e. all current connections will be handled and only after that the server 
should continue to shutdown. As part of our own shutdown hook we will shutdown 
the Framework as well.

Basically this is what we have in our Shutdown Hook:

Runtime.getRuntime().addShutdownHook(new Thread("Custom Shutdown Hook")
{
        @Override
        public void run()
        {
                stopWebApi();
                stopMessaging();
                shutdownFramework();
        }
}

                
> No way for graceful server shutdown
> -----------------------------------
>
>                 Key: SLING-2791
>                 URL: https://issues.apache.org/jira/browse/SLING-2791
>             Project: Sling
>          Issue Type: Bug
>          Components: Launchpad
>    Affects Versions: Launchpad Base 2.5.0
>            Reporter: Philipp Marx
>            Priority: Minor
>
> The main class of the launchpad-base will register a shutdown hook on the JVM 
> to tear down the felix framework properly (Framework#shutdown). There are 
> certain situation where a client wants to have a different behaviour, i.e. to 
> implement a graceful server shutdown.
> In Felix itself you can set the "felix.shutdown.hook=false" to prevent Felix 
> from registering its own shutdown hook. It would be great if Sling would 
> provide the same functionality.
> I have already a patch in place which will search for the same property as 
> Felix and in case this is set to true will not create its own shutdown hook 
> but will rely on the client to properly shutdown the framework. I know there 
> are more actions which Sling is doing upon JVM shutdown but since there is 
> also a listener on the Framework shutdown itself these actions will still be 
> performed.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to