`

Watches

 
阅读更多

Zookeeper的读操作:getData()、getChildren()、exists(),都有可选参数watch。

 

Definition

watch是一次性事件,当watch监视的数据发生变化时就会被触发。

 

One-time trigger

当znode数据发生变化时,客户端会接收到一个watch事件。只有客户端读操作后,数据变化时服务端才会发送watch事件。后续服务端数据发生变化,客户端不会接收到watch事件,除非客户端第二次发起读操作。

 

Sent to client

这意味着事件可能不会到成功到达客户端,可能只在路上。watch是异步发送的,客户端在接收到watch事件时才出发watch里的操作。网络延时或其他因素会造成客户端在不同的时间内接收到watch和返回code的更新。

注意的时,客户端会看到的会保持一致性。

 

The Data for which watch was set

node改变有多种方式。这使得zookeeper维护两个watch列表。getData()和exists()对应data watch,getChildren()对应child watch。

 

使用何种watch是根据返回的data类型来决定的。getData()和exists()返回node的data,getChildren()返回子节点列表。

 

setData()会触发data watch。

 

Things to Remember about Watches

One time triggers,当你在收到一个watch event后,想再收到znode data的改变通知,就需要再次设置watch。

 

由于one time triggers和在接收watch和发送下一个watch之间的延时,会造成你无法可靠的知道Zookeeper znode每一次的data改变。

 

 

 

 

分享到:
评论

相关推荐

    Store-Watches-and-jewlry

    Store-Watches-and-jewlry

    watches

    手表要运行此项目,您必须打开postgresql服务器。... 您可以将POST请求发送到以创建DB的新条目。 可接受的标头为“ Contenty-type:application / json”和“ Content-type:application / xml”。...

    如果客户端微服务需要在运行时动态重新加载配置数据,并且它不是基于SCC则需要实现回调API来执行重新加载操作

    此功能利用了 Consul Watches 和一个名为 core-config-watcher 的简单工具。Consul Watches是一种指定数据视图(例如键/值对或运行状况检查)的方法,该视图会受到更新的监控。检测到更新时,将调用外部处理程序。...

    New-WinRAR-ZIP-archive-(2).zip_Science Fiction_pedometer_smart s

    be worn by a user, including clothing, watches, glasses, shoes and similar items. Wearable computing devices can range providing very specific, limited features like heart rate monitoring and ...

    Android代码-简单库存管理软件

    An Android inventory app for managing an inventory of premium watches. Users can add a new watch (using the " " FAB), edit details, add an image (using the "image" FAB) or delete a watch. Getting ...

    Android代码-AnExplorer Pro

    Best File Explorer for Phones, Tablets, USB Storage, Root Storage, Cloud Storage, Chromecast, Wear OS Watches, Android TV and Chrome OS It is Simple, Small, Fast and Efficient File Explorer and One ...

    eMCP3+16+24G MT29TZZZ7D6JKKFB-107

    Our e.MMC-Based MCPs do more than meet the memory requirements of mid-tier phones, tablets, auto infotainment systems and smart watches. They save more than 40% space versus discrete memory—reducing ...

    Qi协议v1.2.3 完整版

    watches, power banks, Bluetooth headsets, cameras, electric shavers, etc. Virtually anything that uses a rechargeable battery can be designed to use Qi wireless technology. However, Qi wireless power ...

    Arduino Wearable Projects(PACKT,2015)

    The Arduino platform was developed keeping wearables, such as watches that track your location or shoes that count the miles you've run, in mind. It is basically an open-source physical computing ...

    Qi(WPC)无线充电协议英文版 接口定义 参考设计 与相关资料

    Wireless charging is also appearing in a growing number of other consumer product categories—smart watches, power banks, Bluetooth headsets, cameras, electric shavers, etc. Virtually anything that ...

    CSS The Definitive Guide 4th Edition

    It is used by all browsers on all screen sizes on all types of IoT devices, including phones, computers, video games, televisions, watches, kiosks, and auto consoles. Authors Eric Meyer and Estelle ...

    pdf_nRF52840_OPS_Nordic

    • Connected watches • Advanced personal fitness devices • Interactive entertainment devices • Advanced Remote controls • Gaming controllers Applications • Bluetooth 5 data rate support: 2 Mbs, 1...

    java蓝牙开发(英文版)

    Devices like mobile phones, PDAs, laptops, desktops, calculators, watches, keyboards, mice, printers, scanners, cameras, and video game consoles are just a sample of what device manufacturers will be...

    Smart Watches For Man-crx插件

    语言:English 购买智能手表为男人支票价格并在线购买。 还阅读了最新的智能手表评论 男士智能手表:以最优惠的价格在线购物智能手表。 选择各种各样的男性智能手表。 从电视到空调,甚至灯泡,每隔一个小工具现在都...

    Apress Learn C++ for Game Development (2014).pdf

    consoles, ATMs, smart watches, to even glasses! C++ programmers will never be short of work. I hope you find this book an invaluable resource in your journey to learning the C++ programming language.

    CSS The Definitive Guide 4th Edition 2017年出版1088页

    It is used by all browsers on all screen sizes on all types of IoT devices, including phones, computers, video games, televisions, watches, kiosks, and auto consoles. Authors Eric Meyer and Estelle ...

    FileSpy 1.3.4老朽痴拙汉化版(.net电脑文件监视器)

    FileSpy is an open source program that watches and logs files that has changed, deleted, created, and renamed. Most likely use of this is to tell when your computer has downloaded spywares from the ...

    Best Watches For Boys 2021-crx插件

    语言:English 为了满足不断增长的市场的需求,男孩中提供了种类繁多的设计。 一站式提供如此出色的产品,Artodays一定可以满足您的所有时尚需求。 因此,只需单击几下,即可为男孩购买这些手表中的任何一个。...

    swiss-watches:ReactJS电子商务SPA

    Create React App入门 该项目是通过引导的。 可用脚本 在项目目录中,可以运行: yarn start 在开发模式下运行应用程序。 打开在浏览器中查看它。 如果您进行编辑,则页面将重新加载。 您还将在控制台中看到任何...

Global site tag (gtag.js) - Google Analytics