In org.infinispan.distribution, the DistributionManagerImpl.jave is a core class which implements the interface DistributionManager.java, and it's main function is to handle object store in data grid. This class have two ConsistenHash classes including consistentHash and oldConsistentHash. ConsistentHash is an implement of Consistent Hashing algorithm.
First of all, let talk about the Consistent Hashing algorithm. It is a data distrubtion algorithm that help system distribute object to special node by hash code. A new object is allocated a store node in the way of its hash code. In the same way, system can get a object in which node according hash code.
Before talking about join(), there is a JoinTask class should be introduce. JoinTask implements the interface RehashTask. JoinTask handles the rehashing of data when nodes join the cluster. Turn to join() method, it main function is that all nodes join data grid and generates the consistentHash. join() method get all nodes status using recManager.getTransport() method, then instant a new JoinTask class to let all nodes join current data grid and submits JoinTask to rehashExecutor. RpcManger provides a mechanism for communicating with other caches in the cluster, by formatting and passing requests down to the registered Transport.
ViewChangeListener listens current cluster view, if current cluster changed, ViewChangeListener call handleViewChange() event which calls join() or rehash() to maintain nodes in data grid.