Coder Social home page Coder Social logo

sahabpardaz / zk-client Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 2.0 33 KB

A client library for ZooKeeper that it is a thin wrapper around Curator. It provides concise method calls with checked exceptions.

License: Apache License 2.0

Java 100.00%

zk-client's Introduction

Zookeeper Client

Tests Coverage Duplicated Lines (%) Vulnerabilities Security Rating Reliability Rating Maintainability Rating Technical Debt Quality Gate Status JitPack

This is a client library for Apache ZooKeeper. In fact, it is a thin wrapper around Apache Curator. Compared with Curator, we will see the following differences.

Checked Exceptions

It prefers checked exceptions over runtime ones to avoid exceptions being missed or unhandled. So we see InterruptedException and ZkClientException in signature of the operation calls. ZkClientException is a checked exception that is a wrapper around the KeeperException. It provides two useful methods:

  • getZkErrorCode(): returns the standard ZK error code extracted from the underlying KeeperException.
  • canResolveByRetry(): Some network related exceptions can be fixed by retry, but error codes like NONODE or NODEEXISTS should be handled differently. This method helps to separate these two categories from each other.

Concise Operation Calls

The operations are written in a more concise manner. For example the equivalent of curator call

curator.create().withMode(CreateMode.EPHEMERAL).forPath(path, data);

is:

zkClient.addEphemeralNode(path, data);

However, it is possible to go back to the curator style, by getting the underlying curator object from ZkClient instance:

CuratorFramework curator = zkClient.getUnderlyingCurator();

And this way you have access to the full feature list of curator.

zk-client's People

Contributors

borjianamin98 avatar bozorgzadeh avatar saeidrastak avatar

Stargazers

 avatar

Watchers

James Cloos avatar Ali Reza Talebipour avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.