This is an automated email from the ASF dual-hosted git repository.
neilcsmith pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git
The following commit(s) were added to refs/heads/master by this push:
new a49d2cd [NETBEANS-2940] Invalidate cacheed ArchiveRootProviders on
change
new 940fa15 Merge pull request #1520 from matthiasblaesing/netbeans-2940-2
a49d2cd is described below
commit a49d2cd2799fdbb6ddb3e580de032b7b8f9e683a
Author: Matthias Bläsing <[email protected]>
AuthorDate: Thu Sep 19 19:00:38 2019 +0200
[NETBEANS-2940] Invalidate cacheed ArchiveRootProviders on change
This is a followup to commit:
290420cfff1a "[NETBEANS-2940] Cache ArchiveRootProviders"
The issue is:
archiveRootProviders.compareAndSet(null, res)
returns true, when the set was successful. In this case, the
LookupListener needs to registered, that invalidates the cache list of
ArchiveRootProviders. In the original commit, this logic was inverted,
so the LookupListener was not installed and the cache never invalidated.
In addition the archiveRootProviderCache was made volatile to prevent
wrong caching across threads.
---
.../openide.filesystems/src/org/openide/filesystems/FileUtil.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git
a/platform/openide.filesystems/src/org/openide/filesystems/FileUtil.java
b/platform/openide.filesystems/src/org/openide/filesystems/FileUtil.java
index 62c4f6e..9f11db0 100644
--- a/platform/openide.filesystems/src/org/openide/filesystems/FileUtil.java
+++ b/platform/openide.filesystems/src/org/openide/filesystems/FileUtil.java
@@ -2326,7 +2326,7 @@ public final class FileUtil extends Object {
res = new ProxyLookup(
Lookups.singleton(new JarArchiveRootProvider()),
Lookup.getDefault()).lookupResult(ArchiveRootProvider.class);
- if (!archiveRootProviders.compareAndSet(null, res)) {
+ if (archiveRootProviders.compareAndSet(null, res)) {
res = archiveRootProviders.get();
res.addLookupListener((ev) -> {
archiveRootProviderCache = null;
@@ -2338,6 +2338,6 @@ public final class FileUtil extends Object {
return archiveRootProviderCache;
}
- private static Iterable<? extends ArchiveRootProvider>
archiveRootProviderCache;
+ private static volatile Iterable<? extends ArchiveRootProvider>
archiveRootProviderCache;
private static final AtomicReference<Lookup.Result<ArchiveRootProvider>>
archiveRootProviders = new AtomicReference<>();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists