in ingest/src/main/java/com/microsoft/azure/kusto/ingest/ResourceManager.java [346:378]
private <T> IngestionResource<T> getResourceSet(Callable<IngestionResource<T>> resourceGetter) throws IngestionServiceException {
IngestionResource<T> resource = null;
try {
resource = resourceGetter.call();
} catch (Exception ignore) {
}
if (resource == null || resource.empty()) {
// If this method is called multiple times, don't schedule the task multiple times
if (ingestionResourcesSchedulingLock.writeLock().tryLock()) {
try {
// Scheduling the task with no delay will force it to try now, with its normal retry logic
scheduleRefreshIngestionResourcesTask(0L);
} finally {
ingestionResourcesSchedulingLock.writeLock().unlock();
}
}
// If the write lock is locked (refresh is running), then the read will wait here until it ends
Boolean refreshedOnce = refreshIngestionResourcesTask.waitUntilRefreshedAtLeastOnce();
try {
resource = resourceGetter.call();
} catch (Exception ignore) {
}
if (resource == null || resource.empty()) {
throwNoResultException("Unable to get ingestion resources for this type: " +
(resource == null ? "" : resource.resourceType), refreshedOnce);
}
}
return resource;
}