use of ezdb.table.range.RangeTable in project invesdwin-context-persistence by subes.
the class ADelegateRangeTable method getTableWithReadLock.
private RangeTable<H, R, V> getTableWithReadLock(final boolean forUpdate) {
maybePurgeTable();
// directly return table with read lock if not null
final ILock readLock = getReadLock(forUpdate);
readLock.lock();
if (tableFinalizer.table != null) {
return tableFinalizer.table;
}
readLock.unlock();
if (!initializing.compareAndSet(false, true)) {
while (initializing.get()) {
FTimeUnit.MILLISECONDS.sleepNoInterrupt(1);
}
return getTableWithReadLock(forUpdate);
} else {
try {
return new ARetryCallable<RangeTable<H, R, V>>(new RetryOriginator(ADelegateRangeTable.class, "initializeTableInitLocked", getName())) {
@Override
protected RangeTable<H, R, V> callRetry() throws Exception {
return initializeTableInitLocked(readLock);
}
}.call();
} finally {
initializing.set(false);
}
}
}
Aggregations