Module: Lowdown::Connection::Monitor

Defined in:
lib/lowdown/connection/monitor.rb

Defined Under Namespace

Classes: Condition

Overrides collapse

Crash condition registration collapse

Instance Method Details

#__crash_handler__(actor, reason) ⇒ void

This method returns an undefined value.

Send the exception to each of our conditions, to signal that an exception occurred on one of the actors in the pool.

Parameters:

  • actor (Actor)
  • reason (Exception)


43
44
45
46
47
48
49
50
51
52
# File 'lib/lowdown/connection/monitor.rb', line 43

def __crash_handler__(actor, reason)
  if reason # is nil if the actor exits normally
    @lowdown_crash_conditions_mutex.synchronize do
      @lowdown_crash_conditions.each do |condition|
        condition.signal(reason)
      end
    end
  end
  super
end

#__deregister_lowdown_crash_condition__(condition) ⇒ void

This method returns an undefined value.

Removes a condition from the list of conditions that get notified when an actor dies because of an unhandled exception.

Parameters:



73
74
75
76
77
# File 'lib/lowdown/connection/monitor.rb', line 73

def __deregister_lowdown_crash_condition__(condition)
  @lowdown_crash_conditions_mutex.synchronize do
    @lowdown_crash_conditions.delete(condition)
  end
end

#__register_lowdown_crash_condition__(condition) ⇒ void

This method returns an undefined value.

Adds a condition to the list of conditions to be notified when an actors dies because of an unhandled exception.

Parameters:



61
62
63
64
65
# File 'lib/lowdown/connection/monitor.rb', line 61

def __register_lowdown_crash_condition__(condition)
  @lowdown_crash_conditions_mutex.synchronize do
    @lowdown_crash_conditions << condition
  end
end

#initializeObject



30
31
32
33
34
# File 'lib/lowdown/connection/monitor.rb', line 30

def initialize(*)
  super
  @lowdown_crash_conditions_mutex = Mutex.new
  @lowdown_crash_conditions = []
end