Class ResponseQueue

  • All Implemented Interfaces:
    java.lang.Runnable, MetricTable<JabbixActiveMetric<?>>

    public class ResponseQueue
    extends ZabbixClient
    implements MetricTable<JabbixActiveMetric<?>>, java.lang.Runnable
    A Zabbix server client that send metric values to the server when some value expires its refresh period. Holding an updatable queue of JabbixActiveMetric entries to be sent to the server and a link to an other queue to return sent values to.

    When an active metric value is added to the queue its expiration counter is reset. Because of that a value is sent to the server when its whole expiration period is passed or when that is the case for some other value.

    Author:
    Paul Wolneykien
    • Constructor Detail

      • ResponseQueue

        public ResponseQueue​(java.net.InetSocketAddress addr,
                             MetricTable<JabbixActiveMetric<?>> returnTable)
        Create a response queue object with the specified parameters. A separate return table is used to hold sent values. The two-table (internal queue table and a return table) mechanism is used to prevent metrics the server no longer interested in to resist in the queue for the whole process lifetime.
        Parameters:
        addr - remote server socket address
        returnTable - a table to return sent active metrics to
    • Method Detail

      • run

        public void run()
        Starts the queue wait-and-send loop. While the loop is not terminated by the terminate() method the process waits for any active metric value in the queue to expire and then send the whole queue contents in the "agent data" request. Then the collection of sent metric objects is offered back to a return table.
        Specified by:
        run in interface java.lang.Runnable
        See Also:
        JabbixJSONProtocol.sendMetricList(JabbixWriter, String, Collection), getReturnTable()
      • getReturnTable

        public MetricTable<JabbixActiveMetric<?>> getReturnTable()
        Returns the queue object used to return sent metric objects to.
        Returns:
        the queue to add sent metric objects to
      • isTerminated

        public boolean isTerminated()
        Indicates whether the wait-and-send loop is terminated.
        Returns:
        true if this queue process is terminated
        See Also:
        run()
      • terminate

        public void terminate()
        Terminates this queue wait-and-send loop.
        See Also:
        run()