Skip to content

Commit

Permalink
Fix bean in 'srmmanager.xml'.
Browse files Browse the repository at this point in the history
Signed-off-by: Lukas Mansour <[email protected]>
  • Loading branch information
LukasMansour committed Oct 5, 2023
1 parent 2a873d0 commit f948727
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -150,11 +151,11 @@ private ReservationCaches() {
/**
* Builds a loading cache for looking up space tokens by owner and description.
*/
public static AsyncLoadingCache<GetSpaceTokensKey, long[]> buildOwnerDescriptionLookupCache(
public static LoadingCache<GetSpaceTokensKey, long[]> 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<GetSpaceTokensKey, long[]>() {
private GetSpaceTokens createRequest(GetSpaceTokensKey key) {
GetSpaceTokens message = new GetSpaceTokens(key.description);
message.setSubject(new Subject(true, key.principals, Collections.emptySet(),
Expand Down Expand Up @@ -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<String, Optional<Space>> buildSpaceLookupCache(
public static LoadingCache<String, Optional<Space>> buildSpaceLookupCache(
CellStub spaceManager,
Executor executor) {
return Caffeine.newBuilder()
Expand All @@ -218,7 +219,7 @@ public static AsyncLoadingCache<String, Optional<Space>> buildSpaceLookupCache(
.refreshAfterWrite(30, SECONDS)
.recordStats()
.executor(executor)
.buildAsync(new AsyncCacheLoader<>() {
.buildAsync(new AsyncCacheLoader<String, Optional<Space>>() {
@Override
public CompletableFuture<Optional<Space>> asyncLoad(String token,
Executor executor)
Expand Down Expand Up @@ -253,7 +254,7 @@ public void failure(int rc, Object error) {
}, executor);
return future;
}
});
}).synchronous();
}

/**
Expand Down

0 comments on commit f948727

Please sign in to comment.