class Mongo::Cluster::SocketReaper
A manager that calls a method on each of a cluster's pools to close stale
sockets.
@api private
@since 2.5.0
Public Class Methods
new(cluster)
click to toggle source
Initialize the SocketReaper
object.
@example Initialize the socket reaper.
SocketReaper.new(cluster)
@param [ Mongo::Cluster
] cluster The cluster whose pools' stale sockets
need to be reaped at regular intervals.
@since 2.5.0
# File lib/mongo/cluster/reapers/socket_reaper.rb, line 36 def initialize(cluster) @cluster = cluster end
Public Instance Methods
execute()
click to toggle source
Execute the operation to close the pool's stale sockets.
@example Close the stale sockets in each of the cluster's pools.
socket_reaper.execute
@since 2.5.0
# File lib/mongo/cluster/reapers/socket_reaper.rb, line 46 def execute @cluster.servers.each do |server| server.pool.close_stale_sockets! end and true end
flush()
click to toggle source
When the socket reaper is garbage-collected, there's no need to close stale sockets;
sockets will be closed anyway when the pools are garbage-collected.
@since 2.5.0
# File lib/mongo/cluster/reapers/socket_reaper.rb, line 56 def flush; end