RFR: 8307536: FileAlreadyExistsException from NativeLibLoader when running concurrent applications with empty cache

Jose Pereda jpereda at openjdk.org
Fri Jul 28 09:18:01 UTC 2023


This PR adds a file lock to the cache directory, allowing access from multiple processes (that is, from more than one JVM) to that directory. 

This helps solving the issue where the cache is empty or doesn't exist yet, and two JavaFX applications start at the same time, and both try to copy the same native libraries to the same cache.

No tests have been added to the PR though, since this requires a complex scenario: building the SDK and publishing to local Maven repository, creating two simple JavaFX applications that use those artifacts, using a temporary folder for cache (via `javafx.cachedir`, and launching in parallel both applications.

I've tested successfully such scenario on Linux, Mac and Windows.

-------------

Commit messages:
 - Add a file lock to cache dir

Changes: https://git.openjdk.org/jfx/pull/1188/files
 Webrev: https://webrevs.openjdk.org/?repo=jfx&pr=1188&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8307536
  Stats: 20 lines in 1 file changed: 18 ins; 1 del; 1 mod
  Patch: https://git.openjdk.org/jfx/pull/1188.diff
  Fetch: git fetch https://git.openjdk.org/jfx.git pull/1188/head:pull/1188

PR: https://git.openjdk.org/jfx/pull/1188


More information about the openjfx-dev mailing list