In addition to Weibo, there is also WeChat
Please pay attention

WeChat public account
Shulou
2025-12-13 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
1.watcher mode 1 (listens for changes to the current node)
String address = "mini1:2181,mini2:2181,mini3:2181"; RetryPolicy retryPolicy = new ExponentialBackoffRetry (1000, 10); CuratorFramework client = CuratorFrameworkFactory.newClient (address, new ExponentialBackoffRetry (1000, 3)); client.start () / / create node watcher listening final NodeCache cache = new NodeCache (client, "/ super", false); cache.start (true) Cache.getListenable () .addListener (new NodeCacheListener () {public void nodeChanged () throws Exception {System.out.println (cache.getCurrentData () .getPath ()); System.out.println (cache.getCurrentData () .getStat () })
2.watcher mode 2 (listening for changes in the child nodes of the current node)
String address = "mini1:2181,mini2:2181,mini3:2181"; RetryPolicy retryPolicy = new ExponentialBackoffRetry (1000, 10); CuratorFramework client = CuratorFrameworkFactory.newClient (address, new ExponentialBackoffRetry (1000, 3)); client.start () / / create child node watcher listening PathChildrenCache cache = new PathChildrenCache (client, "/ super", true); cache.start (StartMode.POST_INITIALIZED_EVENT) Cache.getListenable () .addListener (new PathChildrenCacheListener () {public void childEvent (CuratorFramework cf, PathChildrenCacheEvent event) throws Exception {System.out.println (event.getType ());}}); Thread.sleep (Long.MAX_VALUE)
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope





About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.