def size(cls, pid):
        """Return the number of connections in the pool

        :param str pid: The pool id
        :rtype int

        """
        with cls._lock:
            cls._ensure_pool_exists(pid)
            return len(cls._pools[pid])