Enrollments Open for Certification Course on Artificial Intelligence and Deep Learning by IIT Roorkee

  Apply Now

ZooKeeper - APIs

API

You can use the ZooKeeper from within your application via APIs - application programming interface.

Though ZooKeeper provides the core APIs in Java and C, there are contributed libraries in Perl, Python, REST.

sync

For each function of APIs, synchronous and asynchronous both variants are available.

While using synchronous APIs the caller or client will wait till ZooKeeper finishes an operation. But if you are using asynchronous API, the client provides a handle to the function that would be called once zooKeeper finishes the operation.

Notes

Whenever we execute a usual function or method, it does not go to the next step until the function has finished. Right? Such methods are called synchronous.

But when you need to do some work in the background you would require async or asynchronous functions. When you call an async function the control goes to the next step or you can say the function returns immediately. The function starts to work in the background.

Say, you want to create a Znode in zookeeper, if you call an async API function of Zookeeper, it will create Znode in the background while the control goes immediately to the next step. The async functions are very useful for doing work in parallel.

Now, if something is running in the background and you want to be notified when the work is done. In such cases, you define a function which you want to be called once the work is done. This function can be passed as an argument to the async API call and is called a callback.


No hints are availble for this assesment

Answer is not availble for this assesment

Loading comments...