Rename getDependentPaths() to getDependencyPaths() because the paths are

not dependent on the given CacheRecord - it is the other way round
This commit is contained in:
Peter Palaga
2021-01-24 15:21:34 +01:00
parent 6cb1aa5be6
commit 3cd726b864
9 changed files with 10 additions and 10 deletions

View File

@@ -27,7 +27,7 @@ public interface CacheRecord {
* @return a {@link Stream} of file (not directory) {@link Path}s whose modification or deletion causes invalidation
* of this {@link CacheRecord}.
*/
Stream<Path> getDependentPaths();
Stream<Path> getDependencyPaths();
/**
* Callback called by the cache when this {@link CacheRecord} is removed from the cache.

View File

@@ -103,7 +103,7 @@ public class TimestampCacheFactory extends AbstractLogEnabled implements CacheFa
* @return {@link Set} of {@link FileState}s at current time
*/
private Set<FileState> currentFileStates() {
return record.getDependentPaths()
return record.getDependencyPaths()
.map(FileState::new)
.collect(Collectors.toSet());
}

View File

@@ -65,7 +65,7 @@ public class WatchServiceCacheFactory extends AbstractLogEnabled implements Cach
* @param record the {@link CacheRecord} to watch
*/
public void add(CacheRecord record) {
record.getDependentPaths().forEach(p -> {
record.getDependencyPaths().forEach(p -> {
final List<CacheRecord> records = recordsByPath.computeIfAbsent(p, k -> new ArrayList<>());
synchronized (records) {
records.add(record);
@@ -159,7 +159,7 @@ public class WatchServiceCacheFactory extends AbstractLogEnabled implements Cach
void remove(List<CacheRecord> records) {
for (CacheRecord record : records) {
record.invalidate();
record.getDependentPaths()
record.getDependencyPaths()
.map(Path::getParent)
.forEach(dir -> registrationsByDir.compute(dir, this::unregister));
}

View File

@@ -43,7 +43,7 @@ public class CliExtensionRealmCache extends DefaultExtensionRealmCache {
}
@Override
public Stream<Path> getDependentPaths() {
public Stream<Path> getDependencyPaths() {
return record.getArtifacts().stream().map(artifact -> artifact.getFile().toPath());
}

View File

@@ -39,7 +39,7 @@ public class CliPluginArtifactsCache extends DefaultPluginArtifactsCache {
}
@Override
public Stream<Path> getDependentPaths() {
public Stream<Path> getDependencyPaths() {
return record.getArtifacts().stream().map(artifact -> artifact.getFile().toPath());
}

View File

@@ -56,7 +56,7 @@ public class CliPluginDescriptorCache extends DefaultPluginDescriptorCache {
}
@Override
public Stream<Path> getDependentPaths() {
public Stream<Path> getDependencyPaths() {
return Optional.ofNullable(descriptor.getArtifacts()).orElse(Collections.emptyList())
.stream().map(artifact -> artifact.getFile().toPath());
}

View File

@@ -54,7 +54,7 @@ public class CliPluginRealmCache extends DefaultPluginRealmCache {
}
@Override
public Stream<Path> getDependentPaths() {
public Stream<Path> getDependencyPaths() {
return record.getArtifacts().stream().map(artifact -> artifact.getFile().toPath());
}

View File

@@ -42,7 +42,7 @@ public class CliProjectArtifactsCache extends DefaultProjectArtifactsCache {
}
@Override
public Stream<Path> getDependentPaths() {
public Stream<Path> getDependencyPaths() {
return record.getArtifacts().stream()
.map(Artifact::getFile)
.filter(Objects::nonNull)

View File

@@ -89,7 +89,7 @@ public class TimestampCacheFactoryTest {
}
@Override
public Stream<Path> getDependentPaths() {
public Stream<Path> getDependencyPaths() {
return paths.stream();
}