Login using Social Account
     Continue with GoogleLogin using your credentials
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.
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.
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.
Taking you to the next exercise in seconds...
Want to create exercises like this yourself? Click here.
Loading comments...