Class: WarouzServer::Master

Inherits:
Object
  • Object
show all
Includes:
Singleton, MysqlManager, WorkerManager
Defined in:
lib/warouz_server/master.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from MysqlManager

#connect, #execute_query

Methods included from WorkerManager

#start_workers, #stop_worker_threads

Instance Attribute Details

#eventsObject

Returns the value of attribute events.



6
7
8
# File 'lib/warouz_server/master.rb', line 6

def events
  @events
end

#loggerObject

Returns the value of attribute logger.



6
7
8
# File 'lib/warouz_server/master.rb', line 6

def logger
  @logger
end

Instance Method Details

#startObject



8
9
10
11
12
13
14
15
# File 'lib/warouz_server/master.rb', line 8

def start
  start_workers()
  start_client_connector()
  while running
    sleep(1)
  end
  nil
end

#stopObject



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/warouz_server/master.rb', line 17

def stop
  return if stopping
  self.stopping=true
  self.running=false
  logger.info("Graceful shutdown...")
  # Stop DRb
  stop_client_connector
  # Stop workers
  stop_worker_threads
  nil
end