Class: GoodJob::ProbeServer::WebrickHandler
- Inherits:
-
Object
- Object
- GoodJob::ProbeServer::WebrickHandler
- Defined in:
- lib/good_job/probe_server/webrick_handler.rb
Instance Method Summary collapse
- #build_future ⇒ Object
-
#initialize(app, options = {}) ⇒ WebrickHandler
constructor
A new instance of WebrickHandler.
- #running? ⇒ Boolean
- #stop ⇒ Object
Constructor Details
#initialize(app, options = {}) ⇒ WebrickHandler
Returns a new instance of WebrickHandler.
6 7 8 9 10 11 |
# File 'lib/good_job/probe_server/webrick_handler.rb', line 6 def initialize(app, = {}) @app = app @port = [:port] @logger = [:logger] @handler = ::Rack::Handler.get('webrick') end |
Instance Method Details
#build_future ⇒ Object
21 22 23 24 25 |
# File 'lib/good_job/probe_server/webrick_handler.rb', line 21 def build_future Concurrent::Future.new(args: [@handler, @port, GoodJob.logger]) do |thr_handler, thr_port, thr_logger| thr_handler.run(@app, Port: thr_port, Host: '0.0.0.0', Logger: thr_logger, AccessLog: []) end end |
#running? ⇒ Boolean
17 18 19 |
# File 'lib/good_job/probe_server/webrick_handler.rb', line 17 def running? @handler&.instance_variable_get(:@server)&.status == :Running end |
#stop ⇒ Object
13 14 15 |
# File 'lib/good_job/probe_server/webrick_handler.rb', line 13 def stop @handler&.shutdown end |