Class: DaemonicThreads::Process

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby-daemonic-threads/process.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(controller) ⇒ Process

Returns a new instance of Process.



19
20
21
22
23
24
25
26
27
# File 'lib/ruby-daemonic-threads/process.rb', line 19

def initialize(controller)
  @controller = controller
  @name = controller.name
  
  @config = DaemonicThreads::Config.new(RAILS_ROOT + '/config/daemons.yml')
  @http = DaemonicThreads::HTTP::Server.new(self)
  @queues = DaemonicThreads::Queues.new(self)
  @daemons = DaemonicThreads::Daemons.new(self)
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



29
30
31
# File 'lib/ruby-daemonic-threads/process.rb', line 29

def config
  @config
end

#controllerObject (readonly)

Returns the value of attribute controller.



29
30
31
# File 'lib/ruby-daemonic-threads/process.rb', line 29

def controller
  @controller
end

#daemonsObject (readonly)

Returns the value of attribute daemons.



29
30
31
# File 'lib/ruby-daemonic-threads/process.rb', line 29

def daemons
  @daemons
end

#httpObject (readonly)

Returns the value of attribute http.



29
30
31
# File 'lib/ruby-daemonic-threads/process.rb', line 29

def http
  @http
end

#nameObject (readonly)

Returns the value of attribute name.



29
30
31
# File 'lib/ruby-daemonic-threads/process.rb', line 29

def name
  @name
end

#queuesObject (readonly)

Returns the value of attribute queues.



29
30
31
# File 'lib/ruby-daemonic-threads/process.rb', line 29

def queues
  @queues
end

Instance Method Details

#before_exitObject



46
47
48
# File 'lib/ruby-daemonic-threads/process.rb', line 46

def before_exit
  @queues.store_and_close
end

#joinObject



36
37
38
39
# File 'lib/ruby-daemonic-threads/process.rb', line 36

def join
  @http.join
  @daemons.join
end

#startObject



31
32
33
34
# File 'lib/ruby-daemonic-threads/process.rb', line 31

def start
  @http.start
  @daemons.start
end

#stopObject



41
42
43
44
# File 'lib/ruby-daemonic-threads/process.rb', line 41

def stop
  @http.stop
  @daemons.stop
end