Class Mongo::Pool
In: lib/mongo/util/pool.rb
Parent: Object

Methods

Included Modules

ThreadLocalVariableManager

Constants

PING_ATTEMPTS = 6
MAX_PING_TIME = 1_000_000

Attributes

address  [RW] 
checked_out  [RW] 
client  [RW] 
host  [RW] 
port  [RW] 
size  [RW] 
timeout  [RW] 

Public Class methods

Create a new pool of connections.

Public Instance methods

If a user calls DB#authenticate, and several sockets exist, then we need a way to apply the authentication on each socket. So we store the apply_authentication method, and this will be applied right before the next use of each socket.

Return a socket to the pool.

Check out an existing socket or create a new socket if the maximum pool size has not been exceeded. Otherwise, wait for the next available socket.

Checks out the first available socket from the pool.

If the pid has changed, remove the socket and check out new one.

This method is called exclusively from checkout; therefore, it runs within a mutex.

Adds a new socket to the pool and checks it out.

This method is called exclusively from checkout; therefore, it runs within a mutex.

Close this pool.

@option opts [Boolean]:soft (false) If true,

  close only those sockets that are not checked out.

Store the logout op for each existing socket to be applied before the next use of each socket.

Refresh ping time only if we haven‘t checked within the last five minutes.

Return the time it takes on average to do a round-trip against this node.

[Validate]