Skip to content

Commit

Permalink
Fix bean-conversion errors.
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 9864bc5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 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,21 +254,21 @@ 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<FsPath, Optional<String>> buildWriteTokenLookupCache(
public static LoadingCache<FsPath, Optional<String>> buildWriteTokenLookupCache(
PnfsHandler pnfs, Executor executor) {
return Caffeine.newBuilder()
.maximumSize(1000)
.expireAfterWrite(10, MINUTES)
.refreshAfterWrite(5, MINUTES)
.recordStats()
.executor(executor)
.buildAsync(new AsyncCacheLoader<>() {
.buildAsync(new AsyncCacheLoader<FsPath, Optional<String>>() {
private Optional<String> writeToken(FileAttributes attr) {
StorageInfo info = attr.getStorageInfo();
return Optional.ofNullable(info.getMap().get("writeToken"));
Expand Down Expand Up @@ -306,6 +307,6 @@ public void failure(int rc, Object error) {
}, executor);
return future;
}
});
}).synchronous();
}
}

0 comments on commit 9864bc5

Please sign in to comment.