[activemq-dev] How to terminate standalone broker from remotely

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

[activemq-dev] How to terminate standalone broker from remotely

Dennis Cook
I had added the terminateBrokerVM() method to ActiveMQConnetion in v3
until there was a better way to terminate, from a remote location, the
JVM running a broker.  This has been removed from v4 source, but still I
cannot find a way to tell the broker JVM to shutdown cleanly.

What is the intention for this this vesion? Is it intended that this be
accomplished via JMX? I have already tried JConsole and issued STOP on
both the broker and connector objects, but the JVM did not stop.

Reply | Threaded
Open this post in threaded view
|

[activemq-dev] Re: How to terminate standalone broker from remotely

Dennis Cook
Okay I thought I had figured out how to cause a broker shutdown.

I found the onControlCommand method in the ActiveMQConnection class.
Great figured just asyncSendPacket() a ControlCommand with "shutdown" as
command.

First problem found and fixed was command member of ControlCommand was
not marshalled.  Next found that the ActiveMQConnection is not part of
the filter chain on the broker side.

It seems that an anonymous TransportListener is created, in the
TransportConnection contructor, to perform the dispatch. On the surface
this seems to me like the appropriate place to replicate the
onControlCommand method that I found in the ActiveMQConnection class.

Is the the correct approach or am I off base here?



Dennis Cook wrote:

> I had added the terminateBrokerVM() method to ActiveMQConnetion in v3
> until there was a better way to terminate, from a remote location, the
> JVM running a broker.  This has been removed from v4 source, but still I
> cannot find a way to tell the broker JVM to shutdown cleanly.
>
> What is the intention for this this vesion? Is it intended that this be
> accomplished via JMX? I have already tried JConsole and issued STOP on
> both the broker and connector objects, but the JVM did not stop.
>
>

Reply | Threaded
Open this post in threaded view
|

[activemq-dev] Re: How to terminate standalone broker from remotely

Dennis Cook
I think I can answer my own question.  The test of the command should be
in the ControlCommand.visit() method.  The CommandVisitor interface of
implemented by the TransportConnection already has a processShutdown()
method, but I don't think this was meant for JVM level termination.

Dennis Cook wrote:

> Okay I thought I had figured out how to cause a broker shutdown.
>
> I found the onControlCommand method in the ActiveMQConnection class.
> Great figured just asyncSendPacket() a ControlCommand with "shutdown" as
> command.
>
> First problem found and fixed was command member of ControlCommand was
> not marshalled.  Next found that the ActiveMQConnection is not part of
> the filter chain on the broker side.
>
> It seems that an anonymous TransportListener is created, in the
> TransportConnection contructor, to perform the dispatch. On the surface
> this seems to me like the appropriate place to replicate the
> onControlCommand method that I found in the ActiveMQConnection class.
>
> Is the the correct approach or am I off base here?
>
>
>
> Dennis Cook wrote:
>
>> I had added the terminateBrokerVM() method to ActiveMQConnetion in v3
>> until there was a better way to terminate, from a remote location, the
>> JVM running a broker.  This has been removed from v4 source, but still
>> I cannot find a way to tell the broker JVM to shutdown cleanly.
>>
>> What is the intention for this this vesion? Is it intended that this
>> be accomplished via JMX? I have already tried JConsole and issued STOP
>> on both the broker and connector objects, but the JVM did not stop.
>>
>>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: [activemq-dev] How to terminate standalone broker from remotely

chirino
In reply to this post by Dennis Cook
Hi Dennis,

I actually think that JMX is the best avenue for this kinda  
management kinda of stuff.  So I've just added a terminateJVM  
operation to the broker objects.

Regards,
Hiram



On Nov 16, 2005, at 3:21 PM, Dennis Cook wrote:

> I had added the terminateBrokerVM() method to ActiveMQConnetion in  
> v3 until there was a better way to terminate, from a remote  
> location, the JVM running a broker.  This has been removed from v4  
> source, but still I cannot find a way to tell the broker JVM to  
> shutdown cleanly.
>
> What is the intention for this this vesion? Is it intended that  
> this be accomplished via JMX? I have already tried JConsole and  
> issued STOP on both the broker and connector objects, but the JVM  
> did not stop.
>

Reply | Threaded
Open this post in threaded view
|

[activemq-dev] Re: How to terminate standalone broker from remotely

Dennis Cook
Hi Hiram,

Oops, I was a bit to quick on the draw.  I updated the
ControlCommand.visit() method already.  When get my admin client code to
  use the JMX interfaces I will back out that change.

Dennis

Hiram Chirino wrote:

> Hi Dennis,
>
> I actually think that JMX is the best avenue for this kinda  management
> kinda of stuff.  So I've just added a terminateJVM  operation to the
> broker objects.
>
> Regards,
> Hiram
>
>
>
> On Nov 16, 2005, at 3:21 PM, Dennis Cook wrote:
>
>> I had added the terminateBrokerVM() method to ActiveMQConnetion in  v3
>> until there was a better way to terminate, from a remote  location,
>> the JVM running a broker.  This has been removed from v4  source, but
>> still I cannot find a way to tell the broker JVM to  shutdown cleanly.
>>
>> What is the intention for this this vesion? Is it intended that  this
>> be accomplished via JMX? I have already tried JConsole and  issued
>> STOP on both the broker and connector objects, but the JVM  did not stop.
>>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: [activemq-dev] How to terminate standalone broker from remotely

Adrian Co
In reply to this post by chirino
Hi Hiram,

I have a related question, I was just wondering why in JMX we terminate
the Broker, but not the BrokerService? Shouldn't the connectors,
persistence adapter, etc be terminated also? or are they terminated
manually? I haven't really dived into the code, yet, so I'm not sure of
the overall implementation, but this was my first impression. :-)  

Although I did briefly tried creating a JMX for the BrokerService, and
stopping it, seems to stop the VM nicely, except for a socket close
exception.

Thanks for your thoughts. :-)

Regards,
Adrian Co

Hiram Chirino wrote:

> Hi Dennis,
>
> I actually think that JMX is the best avenue for this kinda  
> management kinda of stuff.  So I've just added a terminateJVM  
> operation to the broker objects.
>
> Regards,
> Hiram
>
>
>
> On Nov 16, 2005, at 3:21 PM, Dennis Cook wrote:
>
>> I had added the terminateBrokerVM() method to ActiveMQConnetion in  
>> v3 until there was a better way to terminate, from a remote  
>> location, the JVM running a broker.  This has been removed from v4  
>> source, but still I cannot find a way to tell the broker JVM to  
>> shutdown cleanly.
>>
>> What is the intention for this this vesion? Is it intended that  this
>> be accomplished via JMX? I have already tried JConsole and  issued
>> STOP on both the broker and connector objects, but the JVM  did not
>> stop.
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: [activemq-dev] How to terminate standalone broker from remotely

chirino
Hi Adrian,

The terminateJVM method just does a System.exit() which executes the  
shutdown hook the broker installed that then stops all it's running  
parts in the right order.

Regards,
Hiram


On Nov 23, 2005, at 8:30 PM, Adrian Co wrote:

> Hi Hiram,
>
> I have a related question, I was just wondering why in JMX we  
> terminate the Broker, but not the BrokerService? Shouldn't the  
> connectors, persistence adapter, etc be terminated also? or are  
> they terminated manually? I haven't really dived into the code,  
> yet, so I'm not sure of the overall implementation, but this was my  
> first impression. :-)
> Although I did briefly tried creating a JMX for the BrokerService,  
> and stopping it, seems to stop the VM nicely, except for a socket  
> close exception.
>
> Thanks for your thoughts. :-)
>
> Regards,
> Adrian Co
>
> Hiram Chirino wrote:
>
>
>> Hi Dennis,
>>
>> I actually think that JMX is the best avenue for this kinda  
>> management kinda of stuff.  So I've just added a terminateJVM  
>> operation to the broker objects.
>>
>> Regards,
>> Hiram
>>
>>
>>
>> On Nov 16, 2005, at 3:21 PM, Dennis Cook wrote:
>>
>>
>>> I had added the terminateBrokerVM() method to ActiveMQConnetion  
>>> in  v3 until there was a better way to terminate, from a remote  
>>> location, the JVM running a broker.  This has been removed from  
>>> v4  source, but still I cannot find a way to tell the broker JVM  
>>> to  shutdown cleanly.
>>>
>>> What is the intention for this this vesion? Is it intended that  
>>> this be accomplished via JMX? I have already tried JConsole and  
>>> issued STOP on both the broker and connector objects, but the  
>>> JVM  did not stop.
>>>
>>>
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: [activemq-dev] How to terminate standalone broker from remotely

Adrian Co
I see. Thanks Hiram.

Just a follow up question, does this imply that if useJmx is true, then
useShutdownHook should be true also for it to work appropriately in JMX?

Thanks again.

Hiram Chirino wrote:

> Hi Adrian,
>
> The terminateJVM method just does a System.exit() which executes the  
> shutdown hook the broker installed that then stops all it's running  
> parts in the right order.
>
> Regards,
> Hiram
>
>
> On Nov 23, 2005, at 8:30 PM, Adrian Co wrote:
>
>> Hi Hiram,
>>
>> I have a related question, I was just wondering why in JMX we  
>> terminate the Broker, but not the BrokerService? Shouldn't the  
>> connectors, persistence adapter, etc be terminated also? or are  they
>> terminated manually? I haven't really dived into the code,  yet, so
>> I'm not sure of the overall implementation, but this was my  first
>> impression. :-)
>> Although I did briefly tried creating a JMX for the BrokerService,  
>> and stopping it, seems to stop the VM nicely, except for a socket  
>> close exception.
>>
>> Thanks for your thoughts. :-)
>>
>> Regards,
>> Adrian Co
>>
>> Hiram Chirino wrote:
>>
>>
>>> Hi Dennis,
>>>
>>> I actually think that JMX is the best avenue for this kinda  
>>> management kinda of stuff.  So I've just added a terminateJVM  
>>> operation to the broker objects.
>>>
>>> Regards,
>>> Hiram
>>>
>>>
>>>
>>> On Nov 16, 2005, at 3:21 PM, Dennis Cook wrote:
>>>
>>>
>>>> I had added the terminateBrokerVM() method to ActiveMQConnetion  
>>>> in  v3 until there was a better way to terminate, from a remote  
>>>> location, the JVM running a broker.  This has been removed from  
>>>> v4  source, but still I cannot find a way to tell the broker JVM  
>>>> to  shutdown cleanly.
>>>>
>>>> What is the intention for this this vesion? Is it intended that  
>>>> this be accomplished via JMX? I have already tried JConsole and  
>>>> issued STOP on both the broker and connector objects, but the  JVM  
>>>> did not stop.
>>>>
>>>>
>>>
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: [activemq-dev] How to terminate standalone broker from remotely

chirino
Yes.  But someone might want to disable the shutdown hook too see how  
the broker handles an ungraceful shutdown (for testing purposes).

Regards,
Hiram

On Nov 23, 2005, at 8:48 PM, Adrian Co wrote:

> I see. Thanks Hiram.
>
> Just a follow up question, does this imply that if useJmx is true,  
> then useShutdownHook should be true also for it to work  
> appropriately in JMX?
>
> Thanks again.
>
> Hiram Chirino wrote:
>
>
>> Hi Adrian,
>>
>> The terminateJVM method just does a System.exit() which executes  
>> the  shutdown hook the broker installed that then stops all it's  
>> running  parts in the right order.
>>
>> Regards,
>> Hiram
>>
>>
>> On Nov 23, 2005, at 8:30 PM, Adrian Co wrote:
>>
>>
>>> Hi Hiram,
>>>
>>> I have a related question, I was just wondering why in JMX we  
>>> terminate the Broker, but not the BrokerService? Shouldn't the  
>>> connectors, persistence adapter, etc be terminated also? or are  
>>> they terminated manually? I haven't really dived into the code,  
>>> yet, so I'm not sure of the overall implementation, but this was  
>>> my  first impression. :-)
>>> Although I did briefly tried creating a JMX for the  
>>> BrokerService,  and stopping it, seems to stop the VM nicely,  
>>> except for a socket  close exception.
>>>
>>> Thanks for your thoughts. :-)
>>>
>>> Regards,
>>> Adrian Co
>>>
>>> Hiram Chirino wrote:
>>>
>>>
>>>
>>>> Hi Dennis,
>>>>
>>>> I actually think that JMX is the best avenue for this kinda    
>>>> management kinda of stuff.  So I've just added a terminateJVM    
>>>> operation to the broker objects.
>>>>
>>>> Regards,
>>>> Hiram
>>>>
>>>>
>>>>
>>>> On Nov 16, 2005, at 3:21 PM, Dennis Cook wrote:
>>>>
>>>>
>>>>
>>>>> I had added the terminateBrokerVM() method to  
>>>>> ActiveMQConnetion  in  v3 until there was a better way to  
>>>>> terminate, from a remote   location, the JVM running a broker.  
>>>>> This has been removed from  v4  source, but still I cannot find  
>>>>> a way to tell the broker JVM  to  shutdown cleanly.
>>>>>
>>>>> What is the intention for this this vesion? Is it intended  
>>>>> that   this be accomplished via JMX? I have already tried  
>>>>> JConsole and   issued STOP on both the broker and connector  
>>>>> objects, but the  JVM  did not stop.
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>