Code review comment: The introduction of this variable is the actual fix. The old algorithm [wrongly reused](https://github.com/quarkusio/quarkus/commit/ff4b32bb0d8a1df0ccf1cc86a1e1ae9a840c5b0f#diff-f20997e90aae1d2fe046b512defb1a3e14215b7a834177d43369542bae99a7f6R168) the `newJarFileRef` one. This means that in the unfortunate case when a thread was [about to close the old jar](https://github.com/quarkusio/quarkus/commit/ff4b32bb0d8a1df0ccf1cc86a1e1ae9a840c5b0f#diff-f20997e90aae1d2fe046b512defb1a3e14215b7a834177d43369542bae99a7f6R60), but [before setting the AtomicReference to null](https://github.com/quarkusio/quarkus/commit/ff4b32bb0d8a1df0ccf1cc86a1e1ae9a840c5b0f#diff-f20997e90aae1d2fe046b512defb1a3e14215b7a834177d43369542bae99a7f6R67), another thread could fail the `compareAndSet(null)` check here, take at the end of the loop from the `AtomicReference` the old and no longer valid `CompletableFuture` and in subsequent loop (after that the close finally managed to set the `AtomicReference` to null) mistakenly set it back into the same `AtomicReference`.

Code under review:
private static JarFileReference asyncLoadAcquiredJarFile(JarResource jarResource) {
        CompletableFuture<JarFileReference> newJarRefFuture = new CompletableFuture<>();
        CompletableFuture<JarFileReference> existingJarRefFuture = null;
        JarFileReference existingJarRef = null;

        do {
            if (jarResource.jarFileReference.compareAndSet(null, newJarRefFuture)) {
                try {
                    JarFileReference newJarRef = new JarFileReference(JarFiles.create(jarResource.jarPath.toFile()));
                    newJarRefFuture.complete(newJarRef);
                    return newJarRef;
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            existingJarRefFuture = jarResource.jarFileReference.get();
            existingJarRef = existingJarRefFuture == null ? null : existingJarRefFuture.join();
        } while (existingJarRef == null || !existingJarRef.acquire());
        return existingJarRef;
    }

Line commented on: CompletableFuture<JarFileReference> existingJarRefFuture = null;

Revised code:
private static JarFileReference asyncLoadAcquiredJarFile(JarResource jarResource) {
        CompletableFuture<JarFileReference> newJarRefFuture = new CompletableFuture<>();
        CompletableFuture<JarFileReference> existingJarRefFuture = null;
        JarFileReference existingJarRef = null;

        do {
            if (jarResource.jarFileReference.compareAndSet(null, newJarRefFuture)) {
                try {
                    JarFileReference newJarRef = new JarFileReference(JarFiles.create(jarResource.jarPath.toFile()));
                    newJarRefFuture.complete(newJarRef);
                    return newJarRef;
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            existingJarRefFuture = jarResource.jarFileReference.get();
            existingJarRef = existingJarRefFuture == null ? null : existingJarRefFuture.join();
        } while (existingJarRef == null || !existingJarRef.acquire());
        return existingJarRef;
    }