Changed the default file watching delays to the minimum

Currently the minimum delay defaults to 5 seconds in es

Fixes elastic/elasticsearch#196

Original commit: elastic/x-pack-elasticsearch@3a99883a90
This commit is contained in:
uboness 2014-10-16 12:54:18 -07:00
parent 9a6600a2f3
commit 751142a600
4 changed files with 5 additions and 6 deletions

View File

@ -39,7 +39,6 @@ import java.util.Map;
public class FileUserPasswdStore extends AbstractComponent implements UserPasswdStore {
private final Path file;
private final FileWatcher watcher;
final Hasher hasher = Hasher.HTPASSWD;
private volatile ImmutableMap<String, char[]> esUsers;
@ -55,9 +54,9 @@ public class FileUserPasswdStore extends AbstractComponent implements UserPasswd
super(settings);
file = resolveFile(settings, env);
esUsers = parseFile(file, logger);
watcher = new FileWatcher(file.getParent().toFile());
FileWatcher watcher = new FileWatcher(file.getParent().toFile());
watcher.addListener(new FileListener());
watcherService.add(watcher);
watcherService.add(watcher, ResourceWatcherService.Frequency.HIGH);
this.listener = listener;
}

View File

@ -55,7 +55,7 @@ public class FileUserRolesStore extends AbstractComponent implements UserRolesSt
userRoles = parseFile(file, logger);
FileWatcher watcher = new FileWatcher(file.getParent().toFile());
watcher.addListener(new FileListener());
watcherService.add(watcher);
watcherService.add(watcher, ResourceWatcherService.Frequency.HIGH);
this.listener = listener;
}

View File

@ -54,7 +54,7 @@ public class LdapGroupToRoleMapper extends AbstractComponent {
groupRoles = parseFile(file, logger);
FileWatcher watcher = new FileWatcher(file.getParent().toFile());
watcher.addListener(new FileListener());
watcherService.add(watcher);
watcherService.add(watcher, ResourceWatcherService.Frequency.HIGH);
this.listener = listener;
}

View File

@ -54,7 +54,7 @@ public class IPFilteringN2NAuthenticator extends AbstractComponent implements N2
rules = parseFile(file, logger);
FileWatcher watcher = new FileWatcher(file.getParent().toFile());
watcher.addListener(new FileListener());
watcherService.add(watcher);
watcherService.add(watcher, ResourceWatcherService.Frequency.HIGH);
}
private Path resolveFile(Settings settings, Environment env) {