if (!maybeTailer.isPresent()) {
return false;
}
final SingularityLogWatcherTailer tailer = maybeTailer.get();
tailService.submit(new Runnable() {
@Override
public void run() {
try {
tailer.watch();
if (!shutdown) {
LOG.info("Consuming tail: {}", tail);
tailer.consumeStream();
store.markConsumed(tail);
}
} catch (Throwable t) {
if (shutdown) {
LOG.error("Exception tailing {} while shutting down", tail, t);
} else {
LOG.error("Exception tailing {}, will retry in {}", tail, JavaUtils.durationFromMillis(TimeUnit.SECONDS.toMillis(configuration.getRetryDelaySeconds())), t);
tailLater(tail);
}
} finally {
tailer.close();
tailers.remove(tail);
}
}
});