Class: MonitorManager

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

Instance Method Summary collapse

Constructor Details

#initializeMonitorManager

Returns a new instance of MonitorManager.



3
4
5
# File 'lib/MonitorManager.rb', line 3

def initialize
    @list = Array.new
end

Instance Method Details

#add(monitor) ⇒ Object



7
8
9
# File 'lib/MonitorManager.rb', line 7

def add( monitor )
    @list.push monitor
end

#runObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/MonitorManager.rb', line 11

def run
		while true do
        @list.each do |m|
            begin
                m.sanitise
                m.run
                rescue MonitorTypeExceptionHandled => e
                m.alert( e.message )
            end
        end
        sleep 0.5
		end
    
    rescue Interrupt => e
    puts "Exiting on request ..."
    
    rescue Exception => e
    puts e.class.name
    puts "*** This is really unexpected."
    messageLoop = false
    puts "Message: " + e.message
    puts e.backtrace
end