* @throws InterruptedException if interrupted while waiting
* @throws IllegalStateException if even after waiting the cache has not started.
*/
private void blockUntilCacheStarts() throws InterruptedException, IllegalStateException {
int pollFrequencyMS = 20;
TimeService timeService = getTimeService();
final long startupWaitTime = getConfiguration().clustering().stateTransfer().timeout();
final long giveUpTime = timeService.expectedEndTime(startupWaitTime, TimeUnit.MILLISECONDS);
while (!timeService.isTimeExpired(giveUpTime)) {
if (state.allowInvocations()) break;
Thread.sleep(pollFrequencyMS);
}
// check if we have started.