Class: MongoKeepAlive::Handle
- Inherits:
-
Object
- Object
- MongoKeepAlive::Handle
- Defined in:
- lib/keepalive.rb
Overview
Control handle returned by start_keep_alive.
Instance Method Summary collapse
-
#initialize(client, thread) ⇒ Handle
constructor
A new instance of Handle.
-
#stop ⇒ Object
Stop the keep-alive loop and close the connection.
- #stopped? ⇒ Boolean
Constructor Details
#initialize(client, thread) ⇒ Handle
Returns a new instance of Handle.
14 15 16 17 18 |
# File 'lib/keepalive.rb', line 14 def initialize(client, thread) @client = client @thread = thread @stopped = false end |
Instance Method Details
#stop ⇒ Object
Stop the keep-alive loop and close the connection.
21 22 23 24 25 26 |
# File 'lib/keepalive.rb', line 21 def stop @stopped = true @thread.kill @client.close MongoKeepAlive.logger.info("[mongo-keepalive] Stopped and disconnected.") end |
#stopped? ⇒ Boolean
28 29 30 |
# File 'lib/keepalive.rb', line 28 def stopped? @stopped end |