code: @Override
      public void stop() throws JMSException {
          checkClosed();
                  
          if (!running) {
              return;
          }
          actionOnConnectionTaken = true;
          
          if (SQSSession.SESSION_THREAD_FACTORY.wasThreadCreatedWithThisThreadGroup(Thread.currentThread())) {
              throw new IllegalStateException(
                      "MessageListener must not attempt to stop its own Connection to prevent potential deadlock issues");
          }
  
          synchronized (stateLock) {
              checkClosing();
              if (running) {
                  try {
                      for (Session session : sessions) {
                          SQSSession sqsSession = (SQSSession) session;
                          /**
                           * Session stop call blocks until receives and/or
                           * message listeners in progress have completed.
                           */
                          sqsSession.stop();
                      }
                  } finally {
                      running = false;
                  }
  
              }
          }
      }
docs: Stops a connection's delivery of incoming messages. A call to
  <code>stop</code> on a connection that has already been stopped is
  ignored.
  <P>
  This will not return until all the sessions stop internally, which blocks
  until receives and/or message listeners in progress have completed. While
  these message listeners are completing, they must have the full services
  of the connection available to them.
  <P>
  A call to stop must not return until delivery of messages has paused.
  This means that a client can rely on the fact that none of its message
  listeners will be called and that all threads of control waiting for
  receive calls to return will not return with a message until the
  connection is restarted. The receive timers for a stopped connection
  continue to advance, so receives may time out while the connection is
  stopped.
  <P>
  A message listener must not attempt to stop its own connection; otherwise
  throws a IllegalStateException.
  
  @throws IllegalStateException
  If called by a message listener on its own
  <code>Connection</code>.
  @throws JMSException
  On internal error or called if close is in progress.