Skip to content
consistent hashing example for java
Java
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src/main
README.md
pom.xml

README.md

consistent_hashing

Create consistentHash.

ConsistentHash consistentHash = new ConsistentHash();

Create consistentHash with virtual nodes.

// add 100 virtual node per each node.
ConsistentHash consistentHash = new ConsistentHash(100);

Add node

consistentHash.add(new Node("127.0.0.1", "8080", "MyNode"));

Remove node

Node node = new Node("127.0.0.4", "8080", "MyNode");
consistentHash.remove(node);

Get node

consistentHash.getNode("Hello");

See basic concept of Consistent Hash

Consistent Hash

You can’t perform that action at this time.