@@ -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,7 +254,7 @@ 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
/**
0 commit comments