AwaitWritableResult awaitWritable(Object lock, long stop) {
assert Thread.holdsLock(lock);
for (int i = 0; true; i++) {
if (i >= CachingDataStore.MAX_CACHE_RETRIES) {
/* TBD: Add profile counter. -tjb@sun.com (01/25/2010) */
throw new ResourceUnavailableException("Too many retries");
}
if (checkStatus(Status.WRITABLE)) {
/* Already cached for write */
return AwaitWritableResult.WRITABLE;
} else if (checkStatus(Status.UPGRADING)) {