lib/mongo/cluster.rb in mongo-2.14.0 vs lib/mongo/cluster.rb in mongo-2.14.1

- old
+ new

@@ -197,13 +197,10 @@ @socket_reaper = SocketReaper.new(self) @periodic_executor = PeriodicExecutor.new([ @cursor_reaper, @socket_reaper, ], options) - ObjectSpace.define_finalizer(self, self.class.finalize( - {}, @periodic_executor, @session_pool)) - @periodic_executor.run! end # Need to record start time prior to starting monitoring start_time = Time.now @@ -443,29 +440,10 @@ end # @api private attr_reader :server_selection_semaphore - # Finalize the cluster for garbage collection. - # - # @example Finalize the cluster. - # Cluster.finalize(pools) - # - # @param [ Hash<Address, Server::ConnectionPool> ] pools Ignored. - # @param [ PeriodicExecutor ] periodic_executor The periodic executor. - # @param [ SessionPool ] session_pool The session pool. - # - # @return [ Proc ] The Finalizer. - # - # @since 2.2.0 - def self.finalize(pools, periodic_executor, session_pool) - proc do - session_pool.end_sessions - periodic_executor.stop! - end - end - # Closes the cluster. # # @note Applications should call Client#close to disconnect from # the cluster rather than calling this method. This method is for # internal driver use only. @@ -951,13 +929,9 @@ @srv_monitor_lock.synchronize do unless @srv_monitor monitor_options = Utils.shallow_symbolize_keys(options.merge( timeout: options[:connect_timeout] || Server::CONNECT_TIMEOUT)) @srv_monitor = _srv_monitor = Srv::Monitor.new(self, **monitor_options) - finalizer = lambda do - _srv_monitor.stop! - end - ObjectSpace.define_finalizer(self, finalizer) end @srv_monitor.run! end else # Stop SRV monitor if running. This path is taken when the client