*/
public void closeConnection() throws JMException
{
MethodRegistry methodRegistry = _protocolSession.getMethodRegistry();
ConnectionCloseBody responseBody =
methodRegistry.createConnectionCloseBody(AMQConstant.REPLY_SUCCESS.getCode(),
// replyCode
BROKER_MANAGEMENT_CONSOLE_HAS_CLOSED_THE_CONNECTION,
// replyText,
0,
0);
// This seems ugly but because we use closeConnection in both normal
// broker operation and as part of the management interface it cannot
// be avoided. The Current Actor will be null when this method is
// called via the Management interface. This is because we allow the
// Local API connection with JConsole. If we did not allow that option
// then the CurrentActor could be set in our JMX Proxy object.
// As it is we need to set the CurrentActor on all MBean methods
// Ideally we would not have a single method that can be called from
// two contexts.
boolean removeActor = false;
if (CurrentActor.get() == null)
{
removeActor = true;
CurrentActor.set(new ManagementActor(_logActor.getRootMessageLogger()));
}
try
{
_protocolSession.writeFrame(responseBody.generateFrame(0));
try
{
_protocolSession.closeSession();