public class MetricsPersisterJob extends Object implements Runnable
MetricsManager.persistValuesOnly()
at a specific frequency.
This is used if you don't have another mechanism to call the persisting on your own. If you are using the no-arg
constructor (like with Spring) you will need to make sure that initialize()
is called.Constructor and Description |
---|
MetricsPersisterJob() |
MetricsPersisterJob(MetricsManager metricsManager,
long delayTimeMillis,
long periodTimeMillis,
boolean daemonThread)
Create the MetricsPersisterThread and calls
initialize() . |
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Call when you want to shutdown the publisher thread.
|
void |
initialize()
Should be called if the no-arg construct is being used and after the file metrics have been set.
|
void |
join()
Call when you want to join with the the publisher thread.
|
void |
run()
Run by the thread to persist the metrics.
|
void |
setDaemonThread(boolean daemonThread)
Whether or not the thread is a daemon thread.
|
void |
setDelayTimeMillis(long delayTimeMillis)
Number of millis to sleep when the thread starts before we start persisting.
|
void |
setMetricsManager(MetricsManager metricsManager) |
void |
setPeriodTimeMillis(long periodTimeMillis)
Number of millis to sleep between each persisting call.
|
public MetricsPersisterJob()
public MetricsPersisterJob(MetricsManager metricsManager, long delayTimeMillis, long periodTimeMillis, boolean daemonThread)
initialize()
.public void initialize()
public void destroy()
public void join()
public void run()
public void setMetricsManager(MetricsManager metricsManager)
public void setDelayTimeMillis(long delayTimeMillis)
public void setPeriodTimeMillis(long periodTimeMillis)
public void setDaemonThread(boolean daemonThread)
This content is licensed by Gray Watson under the Creative Commons Attribution-Share Alike 3.0 License.