This commit is contained in:
Jeremy Long
2017-07-06 05:27:37 -04:00
parent 55689fe911
commit 9d0a5da783

View File

@@ -516,7 +516,7 @@ public class NvdCveUpdater implements CachedWebDataSource {
final Map<String, Future<Long>> timestampFutures = new HashMap<>(); final Map<String, Future<Long>> timestampFutures = new HashMap<>();
for (String url : urls) { for (String url : urls) {
final TimestampRetriever timestampRetriever = new TimestampRetriever(url); final TimestampRetriever timestampRetriever = new TimestampRetriever(url, Settings.getInstance());
final Future<Long> future = downloadExecutorService.submit(timestampRetriever); final Future<Long> future = downloadExecutorService.submit(timestampRetriever);
timestampFutures.put(url, future); timestampFutures.put(url, future);
} }
@@ -544,6 +544,10 @@ public class NvdCveUpdater implements CachedWebDataSource {
*/ */
private static class TimestampRetriever implements Callable<Long> { private static class TimestampRetriever implements Callable<Long> {
/**
* A reference to the global settings object.
*/
private final Settings settings;
/** /**
* The URL to obtain the timestamp from. * The URL to obtain the timestamp from.
*/ */
@@ -553,16 +557,18 @@ public class NvdCveUpdater implements CachedWebDataSource {
* Instantiates a new timestamp retriever object. * Instantiates a new timestamp retriever object.
* *
* @param url the URL to hit * @param url the URL to hit
* @param settings the global settings
*/ */
TimestampRetriever(String url) { TimestampRetriever(String url, Settings settings) {
this.url = url; this.url = url;
this.settings = settings;
} }
@Override @Override
public Long call() throws Exception { public Long call() throws Exception {
LOGGER.debug("Checking for updates from: {}", url); LOGGER.debug("Checking for updates from: {}", url);
try { try {
Settings.initialize(); Settings.setInstance(settings);
return Downloader.getLastModified(new URL(url)); return Downloader.getLastModified(new URL(url));
} finally { } finally {
Settings.cleanup(false); Settings.cleanup(false);