use of ezdb.table.Table in project invesdwin-context-persistence by subes.
the class ADelegateTable method getTableWithReadLock.
private Table<H, 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<Table<H, V>>(new RetryOriginator(ADelegateTable.class, "initializeTableInitLocked", getName())) {
@Override
protected Table<H, V> callRetry() throws Exception {
return initializeTableInitLocked(readLock);
}
}.call();
} finally {
initializing.set(false);
}
}
}
Aggregations