[
https://issues.apache.org/jira/browse/AMQ-6706?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16051931#comment-16051931
]
Christopher L. Shannon commented on AMQ-6706:
---------------------------------------------
Having a pre hook seems ok to me but I would modify the pull request so that it
follows the same pattern as the already existing addShutdownHook() and
removeShutdownHook() methods. So I think it should be renamed from
preStopHooks to preShutdownHooks and be made final, etc. And also have the
same synchronization that addShutdownHook() and removeShutdownHook() methods
have inside of addPreShutdownHook() and removePreShutdownHook() methods.
Lastly, the iteration over the preShutdownHooks should be moved to after the
stopping.compareAndSet(false, true) check in the stop() method and be
synchronized and have try/catch blocks. Take a look at how shutdownHooks is
iterated over inside of stop() already.
> Allow for hooks before broker stop occurs
> -----------------------------------------
>
> Key: AMQ-6706
> URL: https://issues.apache.org/jira/browse/AMQ-6706
> Project: ActiveMQ
> Issue Type: Improvement
> Components: activemq-camel, Broker
> Environment: Every ActiveMQ version with embedded Camel
> Reporter: Zoran Regvart
>
> When Camel is run embedded within ActiveMQ it's shutdown is called at the
> point the broker is already stopped, this can lead to data loss as there
> could be exchanges that have not ended.
> I propose a preStopHook(s) that can be invoked during ActiveMQ shutdown but
> before the broker is shutdown.
> This would allow Camel to gracefully shutdown while the broker is still
> started.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)