Merge remote-tracking branch 'origin/1.18' into 1.19.2

This commit is contained in:
embeddedt 2023-05-08 09:25:55 -04:00
commit 60140bdc1e
No known key found for this signature in database
GPG Key ID: A69433EC199B5613

View File

@ -31,7 +31,7 @@ public class PackResourcesCacheEngine {
private final Map<PackType, Set<String>> namespacesByType;
private final Set<CachedResourcePath> containedPaths;
private final EnumMap<PackType, Map<String, List<CachedResourcePath>>> resourceListings;
private CompletableFuture<Void> cacheFuture;
private volatile CompletableFuture<Void> cacheFuture;
public PackResourcesCacheEngine(Function<PackType, Set<String>> namespacesRetriever, BiFunction<PackType, String, Path> basePathRetriever) {
this.namespacesByType = new EnumMap<>(PackType.class);
@ -114,8 +114,12 @@ public class PackResourcesCacheEngine {
private void awaitLoad() {
if(this.cacheFuture != null) {
this.cacheFuture.join();
this.cacheFuture = null;
synchronized (this) {
if(this.cacheFuture != null) {
this.cacheFuture.join();
this.cacheFuture = null;
}
}
}
}