@@ -72,6 +72,7 @@ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
7272import com .github .benmanes .caffeine .cache .AsyncCacheLoader ;
7373import com .github .benmanes .caffeine .cache .AsyncLoadingCache ;
7474import com .github .benmanes .caffeine .cache .Caffeine ;
75+ import com .github .benmanes .caffeine .cache .LoadingCache ;
7576import diskCacheV111 .services .space .Space ;
7677import diskCacheV111 .services .space .message .GetSpaceMetaData ;
7778import diskCacheV111 .services .space .message .GetSpaceTokens ;
@@ -150,11 +151,11 @@ private ReservationCaches() {
150151 /**
151152 * Builds a loading cache for looking up space tokens by owner and description.
152153 */
153- public static AsyncLoadingCache <GetSpaceTokensKey , long []> buildOwnerDescriptionLookupCache (
154+ public static LoadingCache <GetSpaceTokensKey , long []> buildOwnerDescriptionLookupCache (
154155 CellStub spaceManager , Executor executor ) {
155156 return Caffeine .newBuilder ().maximumSize (1000 ).expireAfterWrite (30 , SECONDS )
156157 .refreshAfterWrite (10 , SECONDS ).recordStats ().executor (executor )
157- .buildAsync (new AsyncCacheLoader <>() {
158+ .buildAsync (new AsyncCacheLoader <GetSpaceTokensKey , long [] >() {
158159 private GetSpaceTokens createRequest (GetSpaceTokensKey key ) {
159160 GetSpaceTokens message = new GetSpaceTokens (key .description );
160161 message .setSubject (new Subject (true , key .principals , Collections .emptySet (),
@@ -203,13 +204,13 @@ public void failure(int rc, Object error) {
203204 }, executor );
204205 return future ;
205206 }
206- });
207+ }). synchronous () ;
207208 }
208209
209210 /**
210211 * Build a loading cache for looking up space reservations by space token.
211212 */
212- public static AsyncLoadingCache <String , Optional <Space >> buildSpaceLookupCache (
213+ public static LoadingCache <String , Optional <Space >> buildSpaceLookupCache (
213214 CellStub spaceManager ,
214215 Executor executor ) {
215216 return Caffeine .newBuilder ()
@@ -218,7 +219,7 @@ public static AsyncLoadingCache<String, Optional<Space>> buildSpaceLookupCache(
218219 .refreshAfterWrite (30 , SECONDS )
219220 .recordStats ()
220221 .executor (executor )
221- .buildAsync (new AsyncCacheLoader <>() {
222+ .buildAsync (new AsyncCacheLoader <String , Optional < Space > >() {
222223 @ Override
223224 public CompletableFuture <Optional <Space >> asyncLoad (String token ,
224225 Executor executor )
@@ -253,21 +254,21 @@ public void failure(int rc, Object error) {
253254 }, executor );
254255 return future ;
255256 }
256- });
257+ }). synchronous () ;
257258 }
258259
259260 /**
260261 * Cache queries to discover if a directory has the "WriteToken" tag set.
261262 */
262- public static AsyncLoadingCache <FsPath , Optional <String >> buildWriteTokenLookupCache (
263+ public static LoadingCache <FsPath , Optional <String >> buildWriteTokenLookupCache (
263264 PnfsHandler pnfs , Executor executor ) {
264265 return Caffeine .newBuilder ()
265266 .maximumSize (1000 )
266267 .expireAfterWrite (10 , MINUTES )
267268 .refreshAfterWrite (5 , MINUTES )
268269 .recordStats ()
269270 .executor (executor )
270- .buildAsync (new AsyncCacheLoader <>() {
271+ .buildAsync (new AsyncCacheLoader <FsPath , Optional < String > >() {
271272 private Optional <String > writeToken (FileAttributes attr ) {
272273 StorageInfo info = attr .getStorageInfo ();
273274 return Optional .ofNullable (info .getMap ().get ("writeToken" ));
@@ -306,6 +307,6 @@ public void failure(int rc, Object error) {
306307 }, executor );
307308 return future ;
308309 }
309- });
310+ }). synchronous () ;
310311 }
311312}
0 commit comments