Class: RProxy::MasterProcess

Inherits:
Object
  • Object
show all
Defined in:
lib/r_proxy/master_process.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMasterProcess

Returns a new instance of MasterProcess.



8
9
10
11
12
13
14
# File 'lib/r_proxy/master_process.rb', line 8

def initialize
  @config = RProxy::Config.new
  @pids = []
  @watchers = []
  @watcher_status = true
  @mutex = Mutex.new
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



6
7
8
# File 'lib/r_proxy/master_process.rb', line 6

def config
  @config
end

Instance Method Details

#run!Object



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/r_proxy/master_process.rb', line 20

def run!
  Signal.trap("TERM") { exit }
  at_exit { stop_all_process }
  @logger = @config.logger
  begin
    start_r_proxy
  rescue Interrupt
    exit
  rescue => e
    @logger.info("master process error: #{e.message}, #{e.backtrace}") if @logger
    exit
  end
end

#set(name, value) ⇒ Object



16
17
18
# File 'lib/r_proxy/master_process.rb', line 16

def set(name, value)
  @config.send("#{name}=", value)
end