jelmini commented on a change in pull request #309:
URL: https://github.com/apache/jackrabbit-oak/pull/309#discussion_r662348748
##########
File path:
oak-segment-remote/src/main/java/org/apache/jackrabbit/oak/segment/remote/persistentcache/PersistentDiskCache.java
##########
@@ -193,16 +188,27 @@ public void cleanUp() {
private void cleanUpInternal() {
if (isCacheFull()) {
try {
- Stream<Path> segmentsPaths = Files.walk(directory.toPath())
+ Stream<SegmentCacheEntry> segmentCacheEntryStream =
Files.walk(directory.toPath())
+ .map(path -> {
+ try {
+ return new SegmentCacheEntry(path,
Files.readAttributes(path, BasicFileAttributes.class).lastAccessTime());
+ } catch (IOException e) {
+ logger.error("Error while getting the last
access time for {}", path.toFile().getName());
+ }
+ return new SegmentCacheEntry(null,
FileTime.fromMillis(Long.MAX_VALUE));
Review comment:
Minor: as a matter of style, I think it's better to move the last return
inside the catch clause because it makes clear that there is an happy path
result and an error path result.
```suggestion
} catch (IOException e) {
logger.error("Error while getting the last
access time for {}", path.toFile().getName());
return new SegmentCacheEntry(null,
FileTime.fromMillis(Long.MAX_VALUE));
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]