Class: Mongo::Server::ConnectionPool::Populator Private
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Instance Chain:
|
|
Inherits: | Object |
Defined in: | lib/mongo/server/connection_pool/populator.rb |
Overview
A manager that maintains the invariant that the size of a connection pool is at least minPoolSize.
Constant Summary
::Mongo::Loggable
- Included
Class Method Summary
- .new(pool, options = {}) ⇒ Populator constructor Internal use only
Instance Attribute Summary
Instance Method Summary
::Mongo::BackgroundThread
- Included
#run! | Start the background thread. |
#stop! | Stop the background thread and wait for to terminate for a reasonable amount of time. |
#do_work | Override this method to do the work in the background thread. |
#pre_stop | Override this method to perform additional signaling for the background thread to stop. |
#start!, | |
#wait_for_stop | Waits for the thread to die, with a timeout. |
::Mongo::Loggable
- Included
#log_debug | Convenience method to log debug messages with the standard prefix. |
#log_error | Convenience method to log error messages with the standard prefix. |
#log_fatal | Convenience method to log fatal messages with the standard prefix. |
#log_info | Convenience method to log info messages with the standard prefix. |
#log_warn | Convenience method to log warn messages with the standard prefix. |
#logger | Get the logger instance. |
#_mongo_log_prefix, #format_message |
Instance Attribute Details
#options (readonly)
# File 'lib/mongo/server/connection_pool/populator.rb', line 38
attr_reader :
Instance Method Details
#do_work (private)
# File 'lib/mongo/server/connection_pool/populator.rb', line 46
def do_work throw(:done) if @pool.closed? begin unless @pool.populate @pool.populate_semaphore.wait end rescue Error::AuthError, Error => e # Errors encountered when trying to add connections to # pool; try again later log_warn("Populator failed to connect a connection for #{@pool.address}: #{e.class}: #{e}.") @pool.populate_semaphore.wait(5) end end
#pre_stop
# File 'lib/mongo/server/connection_pool/populator.rb', line 40
def pre_stop @pool.populate_semaphore.signal end