lib/mongo/server/connection_pool.rb
# Create a connection, connect it, and add it to the pool.
#
# @return [ true | false ] True if a connection was created and
#    added to the pool, false otherwise
# @raise [ Mongo::Error ] An error encountered during connection connect
Create a connection, connect it, and add it to the pool.
Create a connection connect it and add it to the pool .
def create_and_add_connection
        connection = nil
        @lock.synchronize do
          if !closed? && unsynchronized_size < min_size
            connection = create_connection
            @pending_connections << connection
          else
            return false
          end
        end
        begin
          connect_connection(connection)
        rescue Exception
          @lock.synchronize do
            @pending_connections.delete(connection)
          end
          raise
        end
        @lock.synchronize do
          @available_connections << connection
          @pending_connections.delete(connection)
          @available_semaphore.signal
        end
        true
      end
def create_and_add_connection connection = nil @lock . synchronize do if ! closed? && unsynchronized_size < min_size connection = create_connection @pending_connections << connection else return false end end begin connect_connection ( connection ) rescue Exception @lock . synchronize do @pending_connections . delete ( connection ) end raise end @lock . synchronize do @available_connections << connection @pending_connections . delete ( connection ) @available_semaphore . signal end true end
Create a connection, connect it, and add it to the pool.
Create a connection connect it and add it to the pool .
# wake up one thread waiting for connections, since one was created
True if a connection was created and added to the pool, false otherwise
True if a connection was created and added to the pool false otherwise
 true | false 
[ Mongo::Error ] An error encountered during connection connect
[ Mongo :: Error ] An error encountered during connection connect