public NodeTopologyInfo informRehashOnJoin(Address a, boolean starting, NodeTopologyInfo nodeTopologyInfo) {
if (trace) log.trace("Informed of a JOIN by %s. Starting? %s", a, starting);
if (!starting) {
if (consistentHash instanceof UnionConsistentHash) {
UnionConsistentHash uch = (UnionConsistentHash) consistentHash;
consistentHash = uch.getNewConsistentHash();
oldConsistentHash = null;
}
joiner.set(null);
} else {
topologyInfo.addNodeTopologyInfo(a, nodeTopologyInfo);
if (trace) log.trace("Node topology info added(%s). Topology info is %s", nodeTopologyInfo, topologyInfo);
ConsistentHash chOld = consistentHash;
if (chOld instanceof UnionConsistentHash)
throw new RuntimeException("Not expecting an instance of UnionConsistentHash!");
oldConsistentHash = chOld;
joiner.set(a);
ConsistentHash chNew = ConsistentHashHelper.createConsistentHash(configuration, chOld.getCaches(), topologyInfo, a);
consistentHash = new UnionConsistentHash(chOld, chNew);
}
if (trace) log.trace("New ConsistentHash is %s", consistentHash);
return topologyInfo.getNodeTopologyInfo(rpcManager.getAddress());
}