in java/main/src/main/java/com/epam/deltix/utilities/ResourceLoader.java [881:941]
private void loadAt(final Path deploymentPath) throws IOException {
if (null == _resources)
throw argException("No resources to deploy");
if (!deploymentPath.isAbsolute())
throw new IllegalArgumentException(fmt("Deployment path can't be relative: %s", deploymentPath));
if (!Files.exists(deploymentPath)) {
Files.createDirectories(deploymentPath);
} else {
if (!Files.isDirectory(deploymentPath))
throw new IOException(fmt("Deployment path is not a directory: %s", deploymentPath));
}
assert (_totalResourceLength >= 0);
if (_retryTimeoutMs < 0)
_retryTimeoutMs = _totalResourceLength / 4000 + 4000; // 4 MB/s + 4 sec
// Update period fixed to be frequent enough to not cause _any_ concurrent processes to timeout
// regardless of how big _their_ files are
// It is guaranteed to be <= _retryTimeoutMs / 2
_lockUpdatePeriodNs = 2000 * 1000000L;
if (!getVariablesMapper().isOsWindows())
_keepDllsLocked = true;
log("RetryTimeout:%s, LockUpdatePeriodNs: %s%s",
_retryTimeoutMs, _lockUpdatePeriodNs, _keepDllsLocked ? " KeepDllsLocked=1" : "");
try {
verifyOrDeployResources(deploymentPath);
if (_shouldLoadDlls) {
log("Loading dynamic libraries..");
loadDynamicLibraries(deploymentPath);
if (_keepDllsLocked)
keepDllFileHandles();
}
} catch (final Throwable e) {
log("verifyOrDeployResources & loadDynamicLibraries throw exception: %s", e);
if (_shouldLoadDlls) {
// If some libs were already loaded before throwing, unload. All libs must be only loaded
// from a single deployment path.
log("UNloading libs..");
unloadDynamicLibraries();
}
setFileLock(null);
throw e;
} finally {
// Ensure all resource files are closed
log("Dropping resource file locks..");
disposeResourceFiles();
// If lock file existed, update the last time before deletion
if (null != _lockFile)
lockFileWatchdogUpdate(true);
setFileLock(null);
}
}