Hi Andreas, Sorry about stealing this thread. You suggestion is a big help
-D On Thu, Nov 29, 2012 at 9:36 PM, Andreas Pieber <[email protected]> wrote: > OK, I think this is a completely different problem I would rather > like to discuss on a different thread. But my short analyses here: if > you give main a shot, you'll notice that there's already some > exit-code/restart logic... a new var cold_restart which will set a > fixed exit code (e.g. 99) would do the job. WDYT? > > Kind regards, > Andreas > > On Fri, Nov 30, 2012 at 5:35 AM, Dan Tran <[email protected]> wrote: >> In the same line i also like to see this >> https://issues.apache.org/jira/browse/KARAF-1180 but not sure how to >> implement it >> >> -D >> >> On Thu, Nov 29, 2012 at 8:24 PM, Andreas Pieber <[email protected]> wrote: >>> Short answer: why not :-) >>> >>> Longer answer: I've though about it for some time now (since you >>> provided this proposal on the user list) but I cannot really come up >>> with a counter argument speaking against this. >>> >>> So, from my point of view it's definitely worth giving this a shot! >>> >>> Kind regards, >>> Andreas >>> >>> On Fri, Nov 30, 2012 at 5:15 AM, Raman Gupta <[email protected]> wrote: >>>> I sent this to the users mailing list, but it probably belongs more on >>>> dev. I'd like to hook into the Karaf shutdown process at a higher >>>> level than the OSGi bundle shutdown. The bundle shutdown starts >>>> prematurely shutting down services and such that are necessary for >>>> work in progress to complete. >>>> >>>> For now, I've implemented this with a custom Karaf command that >>>> executes my application shutdown, and then delegates to the Karaf >>>> StopCommand to shutdown Karaf itself. However, this is not an ideal >>>> solution as it requires my custom command to be explicitly executed. >>>> For example, it will not run when a user does a normal kill or Ctrl-D >>>> in the console. >>>> >>>> Ideally, Karaf would have a "ShutdownHook" interface/service I could >>>> implement in my bundles -- for each one of these registered, Karaf >>>> would execute them before stopping the framework bundles. Based on an >>>> initial look at the Karaf source, I'm thinking the best place to do >>>> this is: >>>> >>>> ./main/src/main/java/org/apache/karaf/main/Main.java >>>> >>>> Just before the call to framework.stop(), we use the BundleContext to >>>> obtain and execute a shutdown method on all services that implement a >>>> new "FrameworkShutdownHook" interface. >>>> >>>> Then, proceed to framework.stop(). >>>> >>>> Thoughts on this approach? If the devs are OK with it, I can >>>> implement this. >>>> >>>> Regards, >>>> Raman Gupta >>>> Principal >>>> VIVO Systems
