I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 252a7972 authored by zab2's avatar zab2
Browse files

only load a file filter definition if the definition has been modified since the last load

parent 131ebc4d
No related branches found
No related tags found
No related merge requests found
...@@ -18,6 +18,7 @@ import net.i2p.data.Hash; ...@@ -18,6 +18,7 @@ import net.i2p.data.Hash;
class FileFilterDefinitionElement extends FilterDefinitionElement { class FileFilterDefinitionElement extends FilterDefinitionElement {
private final File file; private final File file;
private volatile long lastLoading;
/** /**
* @param file file to read the remote destinations from * @param file file to read the remote destinations from
...@@ -30,8 +31,9 @@ class FileFilterDefinitionElement extends FilterDefinitionElement { ...@@ -30,8 +31,9 @@ class FileFilterDefinitionElement extends FilterDefinitionElement {
@Override @Override
public void update(Map<Hash, DestTracker> map) throws IOException { public void update(Map<Hash, DestTracker> map) throws IOException {
if (!(file.exists() && file.isFile())) if (!(file.exists() && file.isFile() && file.lastModified() > lastLoading))
return; return;
lastLoading = System.currentTimeMillis();
BufferedReader reader = null; BufferedReader reader = null;
try { try {
reader = new BufferedReader(new FileReader(file)); reader = new BufferedReader(new FileReader(file));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment