Class: Synapse::ServiceWatcher::ZookeeperDnsWatcher::Zookeeper

Inherits:
Synapse::ServiceWatcher::ZookeeperWatcher show all
Defined in:
lib/synapse/service_watcher/zookeeper_dns.rb

Constant Summary

Constants inherited from Synapse::ServiceWatcher::ZookeeperWatcher

Synapse::ServiceWatcher::ZookeeperWatcher::NUMBERS_RE

Constants inherited from BaseWatcher

BaseWatcher::LEADER_WARN_INTERVAL

Instance Attribute Summary

Attributes inherited from BaseWatcher

#name, #revision

Instance Method Summary collapse

Methods inherited from Synapse::ServiceWatcher::ZookeeperWatcher

#ping?, #start, #stop

Methods inherited from BaseWatcher

#backends, #config_for_generator, #haproxy, #ping?, #start, #stop

Methods included from Logging

configure_logger_for, #log, logger_for

Constructor Details

#initialize(opts = {}, parent = nil, synapse, message_queue) ⇒ Zookeeper

Returns a new instance of Zookeeper.



116
117
118
119
120
121
# File 'lib/synapse/service_watcher/zookeeper_dns.rb', line 116

def initialize(opts={}, parent=nil, synapse, message_queue)
  super(opts, synapse)

  @message_queue = message_queue
  @parent = parent
end

Instance Method Details

#reconfigure!Object

Overrides reconfigure! to cause the new list of servers to be messaged to the DNS watcher rather than invoking a synapse reconfigure directly



125
126
127
128
129
130
131
132
# File 'lib/synapse/service_watcher/zookeeper_dns.rb', line 125

def reconfigure!
  # push the new backends onto the queue
  @message_queue.push(Messages::NewServers.new(@backends))
  # Propagate revision updates down to ZookeeperDnsWatcher, so
  # that stanza cache can work properly.
  @revision += 1
  @parent.reconfigure! unless @parent.nil?
end