shutdown pool when application stops

This commit is contained in:
Athou
2013-05-24 12:28:48 +02:00
parent d148fa9df7
commit 8039915bcf
2 changed files with 16 additions and 0 deletions

View File

@@ -78,6 +78,17 @@ public class FeedRefreshUpdater {
});
}
public void shutdown() {
pool.shutdownNow();
while (!pool.isTerminated()) {
try {
Thread.sleep(100);
} catch (InterruptedException e) {
log.error("interrupted while waiting for threads to finish.");
}
}
}
public void updateFeed(Feed feed, Collection<FeedEntry> entries) {
pool.execute(new Task(feed, entries));
}