@Override
  public void stop() {
    this.releaseListeners();

    // when stopping connection manager we need to stop all active connections as well
    for (IO service : services.values()) {
      service.forceStop();
    }
    super.stop();
  }
  /**
   * Method description
   *
   * @param serv
   * @return a value of <code>boolean</code>
   */
  public boolean checkTrafficLimits(IO serv) {
    boolean xmppLimitHit = false;

    if (last_minute_packets_limit > 0) {
      xmppLimitHit = (serv.getPacketsReceived(false) >= last_minute_packets_limit)
      //							|| (serv.getPacketsSent(false) >= last_minute_packets_limit)
      ;
    }
    if (!xmppLimitHit && (total_packets_limit > 0)) {
      xmppLimitHit = (serv.getTotalPacketsReceived() >= total_packets_limit)
      //							|| (serv.getTotalPacketsSent() >= total_packets_limit)
      ;
    }
    if (xmppLimitHit) {
      Level level = Level.FINER;

      if (isHighThroughput()) {
        level = Level.WARNING;
      }
      switch (xmppLimitAction) {
        case DROP_PACKETS:
          if (log.isLoggable(level)) {
            log.log(
                level,
                "[[{0}]] XMPP Limits exceeded on connection {1}" + " dropping pakcets: {2}",
                new Object[] {getName(), serv, serv.getReceivedPackets()});
          }
          while (serv.getReceivedPackets().poll() != null) ;

          break;

        default:
          if (log.isLoggable(level)) {
            log.log(
                level,
                "[[{0}]] XMPP Limits exceeded on connection {1}"
                    + " stopping, packets dropped: {2}",
                new Object[] {getName(), serv, serv.getReceivedPackets()});
          }
          serv.forceStop();

          break;
      }

      return false;
    }

    boolean binLimitHit = false;
    long bytesSent = serv.getBytesSent(false);
    long bytesReceived = serv.getBytesReceived(false);

    if (last_minute_bin_limit > 0) {
      binLimitHit =
          (bytesSent >= last_minute_bin_limit) || (bytesReceived >= last_minute_bin_limit);
    }

    long totalSent = serv.getTotalBytesSent();
    long totalReceived = serv.getTotalBytesReceived();

    if (!binLimitHit && (total_bin_limit > 0)) {
      binLimitHit = (totalReceived >= total_bin_limit) || (totalSent >= total_bin_limit);
    }
    if (binLimitHit) {
      if (log.isLoggable(Level.FINE)) {
        log.log(
            Level.FINE,
            "[[{0}]] Binary Limits exceeded ({1}:{2}:{3}:{4}) on"
                + " connection {5} stopping, packets dropped: {6}",
            new Object[] {
              getName(),
              bytesSent,
              bytesReceived,
              totalSent,
              totalReceived,
              serv,
              serv.getReceivedPackets()
            });
      }
      serv.forceStop();

      return false;
    }

    return true;
  }