Class MetricRequest<M extends JabbixMetric<?>>

  • Type Parameters:
    M -
    All Implemented Interfaces:
    java.lang.Runnable

    public class MetricRequest<M extends JabbixMetric<?>>
    extends java.lang.Object
    implements java.lang.Runnable
    A task object encapsulating the process of the metric value retrieval using a metric agent both synchronously and asynchronously.
    Author:
    Paul Wolneykien
    • Constructor Summary

      Constructors 
      Constructor Description
      MetricRequest​(AgentServer agentServer, M metric, MetricTable<M> table)
      Constructs a metric request task object with the specified parameters.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method 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.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MetricRequest

        public MetricRequest​(AgentServer agentServer,
                             M metric,
                             MetricTable<M> table)
        Constructs a metric request task object with the specified parameters.
        Parameters:
        agentServer - a metric agent server using to get the suitable metric agent for a metric being requested
        metric - a metric to retrieve a fresh value for
        table - an optional metric table object to pass the updated metric object to
    • Method Detail

      • run

        public void run()
        Used to retrieve and update the metric value asynchronously. By the end the updated metric may by passed to an update table.
        Specified by:
        run in interface java.lang.Runnable
      • updateMetric

        public void updateMetric​(M metric)
                          throws JabbixException,
                                 NoSuchMetricException
        Updates the value of the given metric making a request to the suitable metric agent.
        Parameters:
        metric - a metric to update
        Throws:
        JabbixException - on the exception case during the value retrieval
        NoSuchMetricException - if a metric agent for the specified metric is not found
      • setAgentServer

        public void setAgentServer​(AgentServer agentServer)
        Sets the metric agent server to query for new values.
        Parameters:
        agentServer - a metric agent server