@@ -72,6 +72,7 @@ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
72
72
import com .github .benmanes .caffeine .cache .AsyncCacheLoader ;
73
73
import com .github .benmanes .caffeine .cache .AsyncLoadingCache ;
74
74
import com .github .benmanes .caffeine .cache .Caffeine ;
75
+ import com .github .benmanes .caffeine .cache .LoadingCache ;
75
76
import diskCacheV111 .services .space .Space ;
76
77
import diskCacheV111 .services .space .message .GetSpaceMetaData ;
77
78
import diskCacheV111 .services .space .message .GetSpaceTokens ;
@@ -150,11 +151,11 @@ private ReservationCaches() {
150
151
/**
151
152
* Builds a loading cache for looking up space tokens by owner and description.
152
153
*/
153
- public static AsyncLoadingCache <GetSpaceTokensKey , long []> buildOwnerDescriptionLookupCache (
154
+ public static LoadingCache <GetSpaceTokensKey , long []> buildOwnerDescriptionLookupCache (
154
155
CellStub spaceManager , Executor executor ) {
155
156
return Caffeine .newBuilder ().maximumSize (1000 ).expireAfterWrite (30 , SECONDS )
156
157
.refreshAfterWrite (10 , SECONDS ).recordStats ().executor (executor )
157
- .buildAsync (new AsyncCacheLoader <>() {
158
+ .buildAsync (new AsyncCacheLoader <GetSpaceTokensKey , long [] >() {
158
159
private GetSpaceTokens createRequest (GetSpaceTokensKey key ) {
159
160
GetSpaceTokens message = new GetSpaceTokens (key .description );
160
161
message .setSubject (new Subject (true , key .principals , Collections .emptySet (),
@@ -203,13 +204,13 @@ public void failure(int rc, Object error) {
203
204
}, executor );
204
205
return future ;
205
206
}
206
- });
207
+ }). synchronous () ;
207
208
}
208
209
209
210
/**
210
211
* Build a loading cache for looking up space reservations by space token.
211
212
*/
212
- public static AsyncLoadingCache <String , Optional <Space >> buildSpaceLookupCache (
213
+ public static LoadingCache <String , Optional <Space >> buildSpaceLookupCache (
213
214
CellStub spaceManager ,
214
215
Executor executor ) {
215
216
return Caffeine .newBuilder ()
@@ -218,7 +219,7 @@ public static AsyncLoadingCache<String, Optional<Space>> buildSpaceLookupCache(
218
219
.refreshAfterWrite (30 , SECONDS )
219
220
.recordStats ()
220
221
.executor (executor )
221
- .buildAsync (new AsyncCacheLoader <>() {
222
+ .buildAsync (new AsyncCacheLoader <String , Optional < Space > >() {
222
223
@ Override
223
224
public CompletableFuture <Optional <Space >> asyncLoad (String token ,
224
225
Executor executor )
@@ -253,21 +254,21 @@ public void failure(int rc, Object error) {
253
254
}, executor );
254
255
return future ;
255
256
}
256
- });
257
+ }). synchronous () ;
257
258
}
258
259
259
260
/**
260
261
* Cache queries to discover if a directory has the "WriteToken" tag set.
261
262
*/
262
- public static AsyncLoadingCache <FsPath , Optional <String >> buildWriteTokenLookupCache (
263
+ public static LoadingCache <FsPath , Optional <String >> buildWriteTokenLookupCache (
263
264
PnfsHandler pnfs , Executor executor ) {
264
265
return Caffeine .newBuilder ()
265
266
.maximumSize (1000 )
266
267
.expireAfterWrite (10 , MINUTES )
267
268
.refreshAfterWrite (5 , MINUTES )
268
269
.recordStats ()
269
270
.executor (executor )
270
- .buildAsync (new AsyncCacheLoader <>() {
271
+ .buildAsync (new AsyncCacheLoader <FsPath , Optional < String > >() {
271
272
private Optional <String > writeToken (FileAttributes attr ) {
272
273
StorageInfo info = attr .getStorageInfo ();
273
274
return Optional .ofNullable (info .getMap ().get ("writeToken" ));
@@ -306,6 +307,6 @@ public void failure(int rc, Object error) {
306
307
}, executor );
307
308
return future ;
308
309
}
309
- });
310
+ }). synchronous () ;
310
311
}
311
312
}
0 commit comments