diff --git a/modules/dcache/src/main/java/diskCacheV111/doors/NettyLineBasedDoorFactory.java b/modules/dcache/src/main/java/diskCacheV111/doors/NettyLineBasedDoorFactory.java index 9eddf7d8396..0912e58f88f 100644 --- a/modules/dcache/src/main/java/diskCacheV111/doors/NettyLineBasedDoorFactory.java +++ b/modules/dcache/src/main/java/diskCacheV111/doors/NettyLineBasedDoorFactory.java @@ -138,8 +138,8 @@ protected void doStart() { CellStub spaceManager = new CellStub(parentEndpoint, spaceManagerPath, 30_000); spaceDescriptionCache = ReservationCaches.buildOwnerDescriptionLookupCache(spaceManager, - executor).synchronous(); - spaceLookupCache = ReservationCaches.buildSpaceLookupCache(spaceManager, executor).synchronous(); + executor); + spaceLookupCache = ReservationCaches.buildSpaceLookupCache(spaceManager, executor); LoginStrategy loginStrategy = new RemoteLoginStrategy( new CellStub(parentEndpoint, gPlazma, 30_000)); diff --git a/modules/dcache/src/main/java/org/dcache/space/ReservationCaches.java b/modules/dcache/src/main/java/org/dcache/space/ReservationCaches.java index 8ad1f2ee735..d01ff1ef24a 100644 --- a/modules/dcache/src/main/java/org/dcache/space/ReservationCaches.java +++ b/modules/dcache/src/main/java/org/dcache/space/ReservationCaches.java @@ -72,6 +72,7 @@ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING import com.github.benmanes.caffeine.cache.AsyncCacheLoader; import com.github.benmanes.caffeine.cache.AsyncLoadingCache; import com.github.benmanes.caffeine.cache.Caffeine; +import com.github.benmanes.caffeine.cache.LoadingCache; import diskCacheV111.services.space.Space; import diskCacheV111.services.space.message.GetSpaceMetaData; import diskCacheV111.services.space.message.GetSpaceTokens; @@ -150,11 +151,11 @@ private ReservationCaches() { /** * Builds a loading cache for looking up space tokens by owner and description. */ - public static AsyncLoadingCache buildOwnerDescriptionLookupCache( + public static LoadingCache buildOwnerDescriptionLookupCache( CellStub spaceManager, Executor executor) { return Caffeine.newBuilder().maximumSize(1000).expireAfterWrite(30, SECONDS) .refreshAfterWrite(10, SECONDS).recordStats().executor(executor) - .buildAsync(new AsyncCacheLoader<>() { + .buildAsync(new AsyncCacheLoader() { private GetSpaceTokens createRequest(GetSpaceTokensKey key) { GetSpaceTokens message = new GetSpaceTokens(key.description); message.setSubject(new Subject(true, key.principals, Collections.emptySet(), @@ -203,13 +204,13 @@ public void failure(int rc, Object error) { }, executor); return future; } - }); + }).synchronous(); } /** * Build a loading cache for looking up space reservations by space token. */ - public static AsyncLoadingCache> buildSpaceLookupCache( + public static LoadingCache> buildSpaceLookupCache( CellStub spaceManager, Executor executor) { return Caffeine.newBuilder() @@ -218,7 +219,7 @@ public static AsyncLoadingCache> buildSpaceLookupCache( .refreshAfterWrite(30, SECONDS) .recordStats() .executor(executor) - .buildAsync(new AsyncCacheLoader<>() { + .buildAsync(new AsyncCacheLoader>() { @Override public CompletableFuture> asyncLoad(String token, Executor executor) @@ -253,13 +254,13 @@ public void failure(int rc, Object error) { }, executor); return future; } - }); + }).synchronous(); } /** * Cache queries to discover if a directory has the "WriteToken" tag set. */ - public static AsyncLoadingCache> buildWriteTokenLookupCache( + public static LoadingCache> buildWriteTokenLookupCache( PnfsHandler pnfs, Executor executor) { return Caffeine.newBuilder() .maximumSize(1000) @@ -267,7 +268,7 @@ public static AsyncLoadingCache> buildWriteTokenLookupC .refreshAfterWrite(5, MINUTES) .recordStats() .executor(executor) - .buildAsync(new AsyncCacheLoader<>() { + .buildAsync(new AsyncCacheLoader>() { private Optional writeToken(FileAttributes attr) { StorageInfo info = attr.getStorageInfo(); return Optional.ofNullable(info.getMap().get("writeToken")); @@ -306,6 +307,6 @@ public void failure(int rc, Object error) { }, executor); return future; } - }); + }).synchronous(); } }