public class StatusReporter extends java.lang.Object implements java.util.concurrent.Callable<IFileProcessorFutureResult>
sleepMillis and log.info's a status report.| Modifier and Type | Field and Description |
|---|---|
private ConsumersManager |
consumersManager |
private FileResourceCrawler |
crawler |
private boolean |
isShuttingDown |
private static org.slf4j.Logger |
LOG |
private long |
sleepMillis |
private long |
staleThresholdMillis |
private long |
start |
| Constructor and Description |
|---|
StatusReporter(FileResourceCrawler crawler,
ConsumersManager consumersManager)
Initialize with the crawler and consumers
|
| Modifier and Type | Method and Description |
|---|---|
IFileProcessorFutureResult |
call()
Startup the reporter.
|
private int |
getRoughCountConsumed() |
int |
getRoughCountExceptions()
This returns a rough (unsynchronized) count of caught/handled exceptions.
|
private int |
getStillAlive() |
protected void |
report(java.lang.String s)
Override for different behavior.
|
private void |
reportStale() |
void |
setIsShuttingDown(boolean isShuttingDown)
Set whether the main process is in the process of shutting down.
|
void |
setSleepMillis(long sleepMillis)
Set the amount of time to sleep between reports.
|
void |
setStaleThresholdMillis(long staleThresholdMillis)
Set the amount of time in milliseconds to use as the threshold for determining
a stale parse.
|
private static final org.slf4j.Logger LOG
private final ConsumersManager consumersManager
private final FileResourceCrawler crawler
private final long start
private long sleepMillis
private long staleThresholdMillis
private volatile boolean isShuttingDown
public StatusReporter(FileResourceCrawler crawler, ConsumersManager consumersManager)
crawler - crawler to ping at intervalsconsumersManager - consumers to ping at intervalsprotected void report(java.lang.String s)
s - string to reportpublic IFileProcessorFutureResult call()
call in interface java.util.concurrent.Callable<IFileProcessorFutureResult>public void setSleepMillis(long sleepMillis)
sleepMillis - length to sleep btwn reports in millisecondspublic void setStaleThresholdMillis(long staleThresholdMillis)
staleThresholdMillis - threshold for determining whether or not to report a staleprivate void reportStale()
private int getRoughCountConsumed()
private int getStillAlive()
public int getRoughCountExceptions()
public void setIsShuttingDown(boolean isShuttingDown)
isShuttingDown -