mirror of
https://github.com/OpenHFT/Chronicle-Map.git
synced 2021-09-13 01:26:12 +00:00
Added support for dynamic discovery of files, https://github.com/OpenHFT/Chronicle-Core/issues/88
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2019 Chronicle Software Ltd
|
||||
*/
|
||||
|
||||
package net.openhft.chronicle.map.watcher;
|
||||
|
||||
import net.openhft.chronicle.core.watcher.FileClassifier;
|
||||
import net.openhft.chronicle.core.watcher.FileManager;
|
||||
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
public class MapFileClassifier implements FileClassifier {
|
||||
@Override
|
||||
public FileManager classify(String base, String relative) {
|
||||
Path path = Paths.get(base, relative);
|
||||
if (Files.isRegularFile(path) && relative.endsWith(".cmap")) {
|
||||
return new MapFileManager(base, relative);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user