in java/main/src/main/java/com/epam/deltix/utilities/ResourceLoader.java [739:799]
private boolean verifyExistingResourceFiles(final Path deploymentPath) throws IOException {
// Verify automatically fails if overwrite mode is forced
if (_alwaysOverwrite)
return false;
// Make sure all resource files are closed
if (!_reusePartiallyDeployed)
disposeResourceFiles();
int timeout = _retryTimeoutMs;
final int numExpected = _resources.size();
do {
int numFound = 0, numOpened = 0;
for (final Resource resource : _resources) {
final Path filePath = resource.getFullPath(deploymentPath);
if (Files.exists(filePath)) {
++numFound;
if (null == resource.getFile()) {
try {
resource.setReadLock(filePath);
} catch (final IOException e) {
continue;
}
if (_verifyContent || _verifyLength) {
// TODO: File verification checks will go here. Currently we don't store the necessary metadata
}
}
++numOpened;
}
}
// Nothing found? Fail immediately
if (0 == numFound)
break;
// All found? Return success
if (numOpened == numExpected)
return true;
// Able to open some of the files
if (numOpened == numFound)
break;
// If there is a lock file, fail
if (FileJanitor.lockFileExists(deploymentPath))
break;
// Ok, we can't open _some_ of the files we found and there is no lock file. Probably being written, but not by this class.
// Wait and retry until timeout
timeout -= randomSleep(timeout);
} while (timeout > 0);
if (!_reusePartiallyDeployed)
disposeResourceFiles();
return false;
}