Class: Thin::Server
- Inherits:
-
Object
- Object
- Thin::Server
- Defined in:
- lib/garbageman/ext/thin.rb
Constant Summary collapse
- @@before_startup_callbacks =
[]
- @@after_startup_callbacks =
[]
- @@close_callbacks =
[]
Class Method Summary collapse
-
.add_after_startup_callback(proc = nil, &block) ⇒ Object
this is excepting requests and has written the socket file.
-
.add_before_startup_callback(proc = nil, &block) ⇒ Object
thin is not yet excepting requests, but EM has started.
-
.add_close_callback(proc = nil, &block) ⇒ Object
these callbacks are called after all the requests have been processed.
- .run_after_startup_callbacks ⇒ Object
- .run_before_startup_callbacks ⇒ Object
Instance Method Summary collapse
- #stop_with_callbacks ⇒ Object (also: #stop)
Class Method Details
.add_after_startup_callback(proc = nil, &block) ⇒ Object
this is excepting requests and has written the socket file
60 61 62 |
# File 'lib/garbageman/ext/thin.rb', line 60 def self.add_after_startup_callback(proc=nil, &block) @@after_startup_callbacks << (proc || block) end |
.add_before_startup_callback(proc = nil, &block) ⇒ Object
thin is not yet excepting requests, but EM has started
55 56 57 |
# File 'lib/garbageman/ext/thin.rb', line 55 def self.add_before_startup_callback(proc=nil, &block) @@before_startup_callbacks << (proc || block) end |
.add_close_callback(proc = nil, &block) ⇒ Object
these callbacks are called after all the requests have been processed
65 66 67 |
# File 'lib/garbageman/ext/thin.rb', line 65 def self.add_close_callback(proc=nil, &block) @@close_callbacks << (proc || block) end |
.run_after_startup_callbacks ⇒ Object
74 75 76 77 |
# File 'lib/garbageman/ext/thin.rb', line 74 def self.run_after_startup_callbacks @@after_startup_callbacks.each { |c| c.call } if @@after_startup_callbacks @@after_startup_callbacks = nil end |
.run_before_startup_callbacks ⇒ Object
69 70 71 72 |
# File 'lib/garbageman/ext/thin.rb', line 69 def self.run_before_startup_callbacks @@before_startup_callbacks.each { |c| c.call } if @@before_startup_callbacks @@before_startup_callbacks = nil end |
Instance Method Details
#stop_with_callbacks ⇒ Object Also known as: stop
79 80 81 82 83 84 |
# File 'lib/garbageman/ext/thin.rb', line 79 def stop_with_callbacks stop_without_callbacks.tap do @@close_callbacks.each { |c| c.call } if @@close_callbacks @@close_callbacks = nil end end |