Class: Synapse::ZookeeperWatcher
- Inherits:
-
BaseWatcher
- Object
- BaseWatcher
- Synapse::ZookeeperWatcher
- Defined in:
- lib/synapse/service_watcher/zookeeper.rb
Direct Known Subclasses
ZookeeperAuroraWatcher, Synapse::ZookeeperDnsWatcher::Zookeeper
Constant Summary collapse
- NUMBERS_RE =
/^\d+$/
Constants inherited from BaseWatcher
BaseWatcher::LEADER_WARN_INTERVAL
Instance Attribute Summary
Attributes inherited from BaseWatcher
Instance Method Summary collapse
Methods inherited from BaseWatcher
Methods included from Logging
configure_logger_for, #log, logger_for
Constructor Details
This class inherits a constructor from Synapse::BaseWatcher
Instance Method Details
#ping? ⇒ Boolean
24 25 26 |
# File 'lib/synapse/service_watcher/zookeeper.rb', line 24 def ping? @zk && @zk.connected? end |
#start ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/synapse/service_watcher/zookeeper.rb', line 9 def start @zk_hosts = @discovery['hosts'].shuffle.join(',') @watcher = nil @zk = nil log.info "synapse: starting ZK watcher #{@name} @ hosts: #{@zk_hosts}, path: #{@discovery['path']}" zk_connect end |
#stop ⇒ Object
19 20 21 22 |
# File 'lib/synapse/service_watcher/zookeeper.rb', line 19 def stop log.warn "synapse: zookeeper watcher exiting" zk_cleanup end |