1 | #include <Common/ZooKeeper/ZooKeeperHolder.h> |
---|---|
2 | #include <iostream> |
3 | |
4 | #include <Poco/Util/Application.h> |
5 | |
6 | int main() |
7 | { |
8 | // Test::initLogger(); |
9 | |
10 | zkutil::ZooKeeperHolder zk_holder; |
11 | zk_holder.init("localhost:2181"); |
12 | |
13 | { |
14 | auto zk_handler = zk_holder.getZooKeeper(); |
15 | if (zk_handler) |
16 | { |
17 | bool started_new_session = zk_holder.replaceZooKeeperSessionToNewOne(); |
18 | std::cerr << "Started new session: "<< started_new_session << "\n"; |
19 | std::cerr << "get / "<< zk_handler->get( "/") << "\n"; |
20 | } |
21 | } |
22 | |
23 | { |
24 | bool started_new_session = zk_holder.replaceZooKeeperSessionToNewOne(); |
25 | std::cerr << "Started new session: "<< started_new_session << "\n"; |
26 | auto zk_handler = zk_holder.getZooKeeper(); |
27 | if (zk_handler != nullptr) |
28 | std::cerr << "get / "<< zk_handler->get( "/") << "\n"; |
29 | } |
30 | |
31 | return 0; |
32 | } |
33 |