You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Keith W <ke...@gmail.com> on 2012/10/01 10:50:10 UTC

Re: How to remove Qpid Broker Shutdown hook

Hi Sajith

There is currently no way to avoid the registration of the Shutdown hook.
The shutdown hook is used to perform clean-up work in the event that the
Broker is shutdown unexpectedly.  Why would you want to avoid it?

0.16 (QPID-3325) changed the responsibilties for the registration of the
Shutdown hook.
>From that point foward, the Broker class has the responsibility for
registration of the shutdown hook on startup and the removal of shutdown
hook on shutdown.  This was done to better support use cases where the
Broker is deployed within a Container and many instances of the Broker need
to be created/destoyed (serially) over the lifetime of the single JVM.

Assuming you are using 0.16+, rather than calling Main.main(), create the
broker programatically by creating a Broker instance passing a
BrokerOptions instance.  This is the intended use of these class.

Hope this helps,

Keith.


On 30 September 2012 09:28, Sajith Kariyawasam <sa...@gmail.com> wrote:

> Hi all,
>
> I'm trying to startup Qpid broker programatically, through my Java code,
> using Main.main(args);
>
> There I can see a shutdown hook is added..
>
> Is there anyway I can remove it .. ?
> using Runtime.getRuntime().removeShutdownHook(<what to pass here ? >);
>
> --
> Best Regards
> Sajith
>

Re: How to remove Qpid Broker Shutdown hook

Posted by Sajith Kariyawasam <sa...@gmail.com>.
Hi Keith,

Thanks for the response..

On Mon, Oct 1, 2012 at 2:20 PM, Keith W <ke...@gmail.com> wrote:

> Hi Sajith
>
> There is currently no way to avoid the registration of the Shutdown hook.
> The shutdown hook is used to perform clean-up work in the event that the
> Broker is shutdown unexpectedly.  Why would you want to avoid it?
>
>
I was able to start the broker using a simple Java class, but when I moved
my logic into an OSGi runtime, I couldn't get that started up
programatically. So I was just thought may be the shutdown hook which
caused the issue..



> 0.16 (QPID-3325) changed the responsibilties for the registration of the
> Shutdown hook.
> From that point foward, the Broker class has the responsibility for
> registration of the shutdown hook on startup and the removal of shutdown
> hook on shutdown.  This was done to better support use cases where the
> Broker is deployed within a Container and many instances of the Broker need
> to be created/destoyed (serially) over the lifetime of the single JVM.
>
> Assuming you are using 0.16+, rather than calling Main.main(), create the
> broker programatically by creating a Broker instance passing a
> BrokerOptions instance.  This is the intended use of these class.
>


Yes, I'm using version 0.18, ok I will try out that way.. thanks


>
> Hope this helps,
>
> Keith.
>
>
> On 30 September 2012 09:28, Sajith Kariyawasam <sa...@gmail.com> wrote:
>
> > Hi all,
> >
> > I'm trying to startup Qpid broker programatically, through my Java code,
> > using Main.main(args);
> >
> > There I can see a shutdown hook is added..
> >
> > Is there anyway I can remove it .. ?
> > using Runtime.getRuntime().removeShutdownHook(<what to pass here ? >);
> >
> > --
> > Best Regards
> > Sajith
> >
>



-- 
Best Regards
Sajith