Class: Async::Service::Supervisor::Service
- Inherits:
-
Managed::Service
- Object
- Managed::Service
- Async::Service::Supervisor::Service
- Defined in:
- lib/async/service/supervisor/service.rb
Overview
The supervisor service implementation.
Manages the lifecycle of the supervisor server and its monitors.
Instance Method Summary collapse
-
#endpoint ⇒ Object
The endpoint which the supervisor will bind to.
-
#initialize ⇒ Service
constructor
Initialize the supervisor using the given environment.
-
#run(instance, evaluator) ⇒ Object
Run the supervisor server.
-
#start ⇒ Object
Bind the supervisor to the specified endpoint.
-
#stop ⇒ Object
Release the bound endpoint.
Constructor Details
#initialize ⇒ Service
Initialize the supervisor using the given environment.
19 20 21 22 23 |
# File 'lib/async/service/supervisor/service.rb', line 19 def initialize(...) super @bound_endpoint = nil end |
Instance Method Details
#endpoint ⇒ Object
The endpoint which the supervisor will bind to. Typically a unix pipe in the same directory as the host.
27 28 29 |
# File 'lib/async/service/supervisor/service.rb', line 27 def endpoint @evaluator.endpoint end |
#run(instance, evaluator) ⇒ Object
Run the supervisor server.
52 53 54 55 56 57 58 59 60 61 |
# File 'lib/async/service/supervisor/service.rb', line 52 def run(instance, evaluator) server = evaluator.make_server(@bound_endpoint) Async do |task| server.run end # Return the server for health checking and process title formatting server end |
#start ⇒ Object
Bind the supervisor to the specified endpoint.
32 33 34 35 36 |
# File 'lib/async/service/supervisor/service.rb', line 32 def start @bound_endpoint = self.endpoint.bound super end |
#stop ⇒ Object
Release the bound endpoint.
64 65 66 67 68 69 |
# File 'lib/async/service/supervisor/service.rb', line 64 def stop @bound_endpoint&.close @bound_endpoint = nil super end |