Class: Carnivore::Supervisor
- Inherits:
-
Zoidberg::Supervisor
- Object
- Zoidberg::Supervisor
- Carnivore::Supervisor
- Defined in:
- lib/carnivore/supervisor.rb
Class Method Summary collapse
-
.alive? ⇒ TrueClass, FalseClass
Check if default supervisor is alive.
-
.build! ⇒ Carinvore::Supervisor
Build a new supervisor.
-
.create! ⇒ Array<[Celluloid::Registry, Carnivore::Supervisor]>
Create a new supervisor.
-
.registry ⇒ Celluloid::Registry, NilClass
Get the registry of the default supervisor.
-
.supervisor(sup = nil) ⇒ Carnivore::Supervisor
Get/set the default supervisor.
-
.terminate! ⇒ TrueClass
Destroy the registered default supervisor.
Class Method Details
.alive? ⇒ TrueClass, FalseClass
Check if default supervisor is alive
62 63 64 |
# File 'lib/carnivore/supervisor.rb', line 62 def alive? supervisor && supervisor.alive? end |
.build! ⇒ Carinvore::Supervisor
Build a new supervisor
11 12 13 14 |
# File 'lib/carnivore/supervisor.rb', line 11 def build! _, s = create! supervisor(s) end |
.create! ⇒ Array<[Celluloid::Registry, Carnivore::Supervisor]>
Create a new supervisor
19 20 21 22 |
# File 'lib/carnivore/supervisor.rb', line 19 def create! s = Zoidberg::Supervisor.new [s.registry, s] end |
.registry ⇒ Celluloid::Registry, NilClass
Get the registry of the default supervisor
38 39 40 41 42 |
# File 'lib/carnivore/supervisor.rb', line 38 def registry if(supervisor) supervisor.registry end end |
.supervisor(sup = nil) ⇒ Carnivore::Supervisor
Get/set the default supervisor
28 29 30 31 32 33 |
# File 'lib/carnivore/supervisor.rb', line 28 def supervisor(sup=nil) if(sup) @supervisor = sup end @supervisor end |
.terminate! ⇒ TrueClass
Destroy the registered default supervisor
47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/carnivore/supervisor.rb', line 47 def terminate! if(supervisor) begin supervisor.terminate rescue Zoidberg::DeadException => e Carnivore::Logger.warn "Default supervisor is already in dead state (#{e.class}: #{e})" end @supervisor = nil end true end |