Unable to delete old config file
Posted: 26 Jun 2020, 13:27
Hello,
i'm having issues with running multiple jnlps. In an application we use, 2 jnlp files are called. During the startup process, OWS generates an Error.
In the log file both are accessing cache.json at the same time and thus creating this error. I also had the same issue with deployment.properties. I think this applies to all files which will be edited and saved. We did look into this and think the issue could be here
https://github.com/karakun/OpenWebStart ... nager.java
/**
* Load runtimes from filesystem into cache. Do some housekeeping by checking if a runtime is still present
* on the file system as stated in the cache json file. If not present any more, it will be removed from the
* json file and the cache.
*/
private void saveRuntimes() throws IOException {
jsonStoreLock.lock();
try {
[...]
}
final File jsonFile = new File(cachePath, RuntimeManagerConstants.JSON_STORE_FILENAME);
if (jsonFile.exists()) {
if (!jsonFile.delete()) { <- A second process can't delete the file, since it's locked
throw new IOException("Unable to delete old config file!");
}
}
[...]
} finally {
jsonStoreLock.unlock();
}
}
Regards,
Andrej
i'm having issues with running multiple jnlps. In an application we use, 2 jnlp files are called. During the startup process, OWS generates an Error.
In the log file both are accessing cache.json at the same time and thus creating this error. I also had the same issue with deployment.properties. I think this applies to all files which will be edited and saved. We did look into this and think the issue could be here
https://github.com/karakun/OpenWebStart ... nager.java
/**
* Load runtimes from filesystem into cache. Do some housekeeping by checking if a runtime is still present
* on the file system as stated in the cache json file. If not present any more, it will be removed from the
* json file and the cache.
*/
private void saveRuntimes() throws IOException {
jsonStoreLock.lock();
try {
[...]
}
final File jsonFile = new File(cachePath, RuntimeManagerConstants.JSON_STORE_FILENAME);
if (jsonFile.exists()) {
if (!jsonFile.delete()) { <- A second process can't delete the file, since it's locked
throw new IOException("Unable to delete old config file!");
}
}
[...]
} finally {
jsonStoreLock.unlock();
}
}
Regards,
Andrej