Hi Yeah that makes sense to allow calling cancel(true) to interrupt and do the forced shutdown. I added a code comment and revised the code.
On Wed, Feb 5, 2014 at 8:20 AM, Antoine DESSAIGNE <antoine.dessai...@gmail.com> wrote: > Hi, > > It was the point of this patch that the logic of the force shutdown was > also executed when you cancel the future. > > Consider a product that uses camel in order to deal with all its data > inputs and outputs, it has multiple CamelContext defined. > You can provide to the administrator the ability to control the lifecycle > of each context through a user interface. For instance he can: > * start the context that provides a REST API; > * stop the context that reads from a database; > * force the shutdown if he consider that the shutdown process is too long, > that there is an issue preventing the normal shutdown. > > In the original patch calling future.cancel() interrupt the normal shutdown > process thread and perform the force-shutdown logic the same way than the > timeout did. > > Having the timeout is an essential future but currently there's no way to > shorten this timeout after calling context.stop(). That's where > future.cancel() applies > > But maybe, there's something I don't know, or a consequence I didn't saw > for this patch. > > Thanks a lot for your help on this matter, > > Antoine. > > > > 2014-02-04 Claus Ibsen <claus.ib...@gmail.com>: > >> Polishing your patch as the timeout logic should only happen if a >> timeout exception was thrown, as the original code. >> >> Will commit the revised code in a bit. Is there a JIRA ticket? >> >> On Mon, Feb 3, 2014 at 3:52 PM, Antoine DESSAIGNE >> <antoine.dessai...@gmail.com> wrote: >> > Hi, >> > >> > Do you have any concerns or suggestions about these changes ? Right now, >> > I've copy/pasted the DefaultShutdownStrategy and added those changes on >> > order to make it work (and it's working nicely). >> > >> > Also, if you don't like this public getter, we can also make it >> protected. >> > >> > Thanks for the feedback. >> > >> > Antoine >> > >> > >> > 2014-01-23 adessaigne <g...@git.apache.org>: >> > >> >> GitHub user adessaigne opened a pull request: >> >> >> >> https://github.com/apache/camel/pull/90 >> >> >> >> Provide access to the shutdown task Future in order to have more >> >> control over it >> >> >> >> I'm submitting this patch in order to have a greater control over >> the >> >> shutdown task. >> >> It's very useful when integrating Camel in another product. >> Therefore >> >> you can have a user interface for controlling the life-cycle of a >> context. >> >> The user can start or stop a context and if it takes too much time to >> stop >> >> he can force it by calling getCurrentShutdownFuture().cancel(true) >> >> >> >> You can merge this pull request into a Git repository by running: >> >> >> >> $ git pull https://github.com/adessaigne/camel master >> >> >> >> Alternatively you can review and apply these changes as the patch at: >> >> >> >> https://github.com/apache/camel/pull/90.patch >> >> >> >> ---- >> >> commit 65dc45d9ac0cfd5ed7f2567d93f59b97885274dc >> >> Author: Antoine DESSAIGNE <antoine.dessai...@gmail.com> >> >> Date: 2014-01-23T11:16:02Z >> >> >> >> Provide access to the shutdown task Future in order to have more >> >> control over it >> >> >> >> ---- >> >> >> >> >> >> >> >> -- >> Claus Ibsen >> ----------------- >> Red Hat, Inc. >> Email: cib...@redhat.com >> Twitter: davsclaus >> Blog: http://davsclaus.com >> Author of Camel in Action: http://www.manning.com/ibsen >> Make your Camel applications look hawt, try: http://hawt.io >> -- Claus Ibsen ----------------- Red Hat, Inc. Email: cib...@redhat.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen Make your Camel applications look hawt, try: http://hawt.io