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<[Zoidberg::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
65 66 67 |
# File 'lib/carnivore/supervisor.rb', line 65 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<[Zoidberg::Registry, Carnivore::Supervisor]>
Create a new supervisor
19 20 21 22 |
# File 'lib/carnivore/supervisor.rb', line 19 def create! s = Carnivore::Supervisor.new [s.registry, s] end |
.registry ⇒ Celluloid::Registry, NilClass
Get the registry of the default supervisor
41 42 43 44 45 |
# File 'lib/carnivore/supervisor.rb', line 41 def registry if(supervisor) supervisor.registry end end |
.supervisor(sup = nil) ⇒ Carnivore::Supervisor
Get/set the default supervisor
28 29 30 31 32 33 34 35 36 |
# File 'lib/carnivore/supervisor.rb', line 28 def supervisor(sup=nil) if(sup) @supervisor = sup end unless(@supervisor) raise Zoidberg::DeadException.new('Instance in terminated state!') end @supervisor end |
.terminate! ⇒ TrueClass
Destroy the registered default supervisor
50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/carnivore/supervisor.rb', line 50 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 |