M
- public class MetricRequest<M extends JabbixMetric<?>>
extends java.lang.Object
implements java.lang.Runnable
Constructor and Description |
---|
MetricRequest(AgentServer agentServer,
M metric,
MetricTable<M> table)
Constructs a metric request task object with the specified parameters.
|
Modifier and Type | Method and Description |
---|---|
JabbixMetric<?> |
getFreshMetric()
Returns a new metric instance with the fresh value for the metric
specified on the request construction.
|
void |
run()
Used to retrieve and update the metric value asynchronously.
|
void |
setAgentServer(AgentServer agentServer)
Sets the metric agent server to query for new values.
|
void |
updateMetric(M metric)
Updates the value of the given metric making a request to the suitable
metric agent.
|
public MetricRequest(AgentServer agentServer, M metric, MetricTable<M> table)
agentServer
- a metric agent server using to get the suitable metric
agent for a metric being requestedmetric
- a metric to retrieve a fresh value fortable
- an optional metric table object to pass the updated metric
object topublic void run()
run
in interface java.lang.Runnable
public JabbixMetric<?> getFreshMetric() throws JabbixException, NoSuchMetricException
JabbixException
- on the exception case during the value retrievalNoSuchMetricException
- if a metric agent for the specified metric is not foundpublic void updateMetric(M metric) throws JabbixException, NoSuchMetricException
metric
- a metric to updateJabbixException
- on the exception case during the value retrievalNoSuchMetricException
- if a metric agent for the specified metric is not foundpublic void setAgentServer(AgentServer agentServer)
agentServer
- a metric agent server