public void shutdown() throws MessageServiceException {
  LOGGER.warn("Shutdown Signal Received. Shutting down.");
  m_shutdown.set(true);
  Request shutdownRequest=new AbortRequest();
  m_requestQueue.offer(shutdownRequest);
  while (m_requestQueue.size() != 0) {
    try {
      Thread.sleep(100);
    }
 catch (    InterruptedException e) {
      LOGGER.error("Exception while draining requests from queue",e);
    }
  }
  closeConnection();
  if (pingerTask != null)   pingerTask.cancel();
  boolean status=Management.removeBeanOrFolder("MessageService/Transport/ZooKeeper/context/" + m_context + "/stats");
  if (status)   LOGGER.info("stop monitoring MessageService/Transport/ZooKeeper/context/" + m_context + "/stats");
  status=Management.removeBeanOrFolder("MessageService/Transport/ZooKeeper/context/" + m_context + "/registry");
  if (status)   LOGGER.info("stop monitoring MessageService/Transport/ZooKeeper/context/" + m_context + "/registry");
}

public void shutdown ( ) throws MessageServiceException { LOGGER . warn ( "Shutdown Signal Received. Shutting down." ) ; m_shutdown . set ( true ) ; Request shutdownRequest = new AbortRequest ( ) ; m_requestQueue . offer ( shutdownRequest ) ; while ( m_requestQueue . size ( ) != 0 ) { try { Thread . sleep ( 100 ) ; } catch ( InterruptedException e ) { LOGGER . error ( "Exception while draining requests from queue" , e ) ; } } closeConnection ( ) ; if ( pingerTask != null ) pingerTask . cancel ( ) ; boolean status = Management . removeBeanOrFolder ( "MessageService/Transport/ZooKeeper/context/" + m_context + "/stats" ) ; if ( status ) LOGGER . info ( "stop monitoring MessageService/Transport/ZooKeeper/context/" + m_context + "/stats" ) ; status = Management . removeBeanOrFolder ( "MessageService/Transport/ZooKeeper/context/" + m_context + "/registry" ) ; if ( status ) LOGGER . info ( "stop monitoring MessageService/Transport/ZooKeeper/context/" + m_context + "/registry" ) ; }
upon shutdown signal , close the connection to zookeeper and come out
