class MessagePump {

  public void shutdown() {

    if (!m_shutdownTriggered) {
      // Guard against repeat invocations due to a shutdown action
      // triggering a CommunicationException.
      m_shutdownTriggered = true;

      m_receiver.shutdown();
      m_sender.shutdown();

      // Now wait for the thread pool to finish.
      m_executor.shutdownNow();
    }
  }

  public  MessagePump(Receiver receiver, Sender sender, int numberOfThreads);

}