X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-clustering-commons%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fpersistence%2FLocalSnapshotStore.java;h=e1589ffb899a955be8fdcf26fa70565b249a8ab8;hp=d9b7adc3c966dab83f951b7a50572a79e53af984;hb=877dc93c690dba7b2a834e0cf585d45250eb9aa2;hpb=62d2f37a4e9ff4c637ff83e3d9dbbfd292552aaa diff --git a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/persistence/LocalSnapshotStore.java b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/persistence/LocalSnapshotStore.java index d9b7adc3c9..e1589ffb89 100644 --- a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/persistence/LocalSnapshotStore.java +++ b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/persistence/LocalSnapshotStore.java @@ -22,7 +22,6 @@ import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; -import java.io.FilenameFilter; import java.io.IOException; import java.io.InputStream; import java.io.ObjectInputStream; @@ -220,7 +219,7 @@ public class LocalSnapshotStore extends SnapshotStore { LOG.debug("Deleting files: {}", files); - files.forEach(file -> file.delete()); + files.forEach(File::delete); return null; } @@ -229,14 +228,14 @@ public class LocalSnapshotStore extends SnapshotStore { LOG.debug("Deleting files: {}", files); - files.forEach(file -> file.delete()); + files.forEach(File::delete); return null; } private Collection getSnapshotFiles(final String persistenceId) { String encodedPersistenceId = encode(persistenceId); - File[] files = snapshotDir.listFiles((FilenameFilter) (dir, name) -> { + File[] files = snapshotDir.listFiles((dir, name) -> { int persistenceIdEndIndex = name.lastIndexOf('-', name.lastIndexOf('-') - 1); return PERSISTENCE_ID_START_INDEX + encodedPersistenceId.length() == persistenceIdEndIndex && name.startsWith(encodedPersistenceId, PERSISTENCE_ID_START_INDEX) && !name.endsWith(".tmp"); @@ -265,7 +264,7 @@ public class LocalSnapshotStore extends SnapshotStore { private Collection getSnapshotMetadatas(final String persistenceId, final SnapshotSelectionCriteria criteria) { return getSnapshotFiles(persistenceId).stream().flatMap(file -> toStream(extractMetadata(file))) - .filter(md -> criteria.matches(md)).collect(Collectors.toList()); + .filter(criteria::matches).collect(Collectors.toList()); } private static Stream toStream(@Nullable final SnapshotMetadata md) {