final long giveup = System.nanoTime() + TimeUnit.SECONDS.toNanos(REHASH_TIMEOUT_SECONDS);
for (Cache c : caches) {
if (c instanceof SecureCacheImpl) {
c = (Cache) extractField(SecureCacheImpl.class, c, "delegate");
}
StateTransferManager stateTransferManager = extractComponent(c, StateTransferManager.class);
Address cacheAddress = c.getAdvancedCache().getRpcManager().getAddress();
while (true) {
CacheTopology cacheTopology = stateTransferManager.getCacheTopology();
ConsistentHash currentCH = cacheTopology.getCurrentCH();
boolean rebalanceInProgress = cacheTopology.getPendingCH() != null;
boolean chContainsAllMembers = currentCH.getMembers().size() == caches.length;
boolean currentChIsBalanced = true;
int actualNumOwners = Math.min(currentCH.getNumOwners(), currentCH.getMembers().size());