class MotherBrain::Application::SupervisionGroup
Attributes
interrupt_mutex[R]
interrupted[R]
Public Class Methods
new(config)
click to toggle source
Calls superclass method
# File lib/mb/application.rb, line 136 def initialize(config) super(MB::Application.registry) supervise_as(:config_manager, MB::ConfigManager, config) supervise_as(:ridley, Ridley::Client, config.to_ridley) supervise_as(:job_manager, MB::JobManager) supervise_as(:lock_manager, MB::LockManager) supervise_as(:plugin_manager, MB::PluginManager) supervise_as(:command_invoker, MB::CommandInvoker) supervise_as(:node_querier, MB::NodeQuerier) supervise_as(:environment_manager, MB::EnvironmentManager) supervise_as(:bootstrap_manager, MB::Bootstrap::Manager) supervise_as(:provisioner_manager, MB::Provisioner::Manager) supervise_as(:upgrade_manager, MB::Upgrade::Manager) if config.rest_gateway.enable supervise_as(:rest_gateway, MB::RestGateway, config.to_rest_gateway) end @interrupt_mutex = Mutex.new @interrupted = false subscribe(ConfigManager::UPDATE_MSG, :reconfigure) MB::Test.mock(:init) if MB.testing? end
Public Instance Methods
async_interrupt(delay = 0)
click to toggle source
# File lib/mb/application.rb, line 166 def async_interrupt(delay = 0) future.interrupt(delay) end
interrupt(delay = 0)
click to toggle source
# File lib/mb/application.rb, line 170 def interrupt(delay = 0) Celluloid.sleep(delay) if delay > 0 interrupt_mutex.synchronize do unless interrupted @interrupted = true terminate end end end
reconfigure(_msg, new_config)
click to toggle source
# File lib/mb/application.rb, line 161 def reconfigure(_msg, new_config) log.debug { "[Application] ConfigManager has changed: re-configuring components..." } @registry[:ridley].async.configure(new_config.to_ridley) end