OpenNMS API 1.2.9

## org.opennms.netmgt.rtc
Class DataSender

    java.lang.Object
      org.opennms.netmgt.rtc.DataSender

All Implemented Interfaces:
  Fiber

final class DataSender
extends java.lang.Object
implements Fiber

The DataSender is responsible to send data out to 'listeners' When the RTCManager's timers go off, the DataSender is prompted to send data, which it does by maintaining a 'SendRequest' runnable queue so as to not block the RTCManager

Author:
  Sowmya Nataraj , Brian Weaver , OpenNMS.org

Nested Class Summary
`private class` `DataSender.SendRequest` Inner class to send data to all the categories - this runnable prevents the RTCManager from having to block until data is computed, converted to XML and sent out

Field Summary
`private java.util.Map` `m_categories` The category map
`private java.util.Map` `m_catUrlMap` The listeners like the webui that send a URL to which the data is to be sent
`private FifoQueue` `m_dataSenderQ` The queue to which data send requests are queued
`private RunnableConsumerThreadPool` `m_dsrPool` The data sender thread pool
`private EuiLevelMapper` `m_euiMapper` The category to xml mapper
`private int` `m_status` The current status of this fiber
`private int` `POST_ERROR_LIMIT` The allowable number of times posts can have errors before an URL is automatically unsubscribed

Fields inherited from interface org.opennms.core.fiber.Fiber
`RUNNING, START_PENDING, STARTING, STATUS_NAMES, STOP_PENDING, STOPPED`

Constructor Summary
`DataSender(java.util.Map categories, int numSenders)` The constructor for this object

Method Summary
`java.lang.String` `getName()` Returns a name/id for this fiber
`int` `getStatus()` Returns the current status
`void` `notifyToSend()` Notify the DataSender to send data - create a new 'SendRequest' to send the data and queue to the consumer
`void` `sendData()` Loop through the categories and send out data for all categories that have changed
`private int` `setCurrentThreadPriority(int priority)` Set the current thread's priority to the passed value and return the old priority
`void` `start()` Start the datasender threadpool
`void` `stop()` Shutdown the data sender thread pool
`void` `subscribe(java.lang.String url, java.lang.String catlabel, java.lang.String user, java.lang.String passwd)` Subscribe - Add the recd.
`void` `unsubscribe(java.lang.String urlStr)` Unsubscribe - remove the recd.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### m_categories

    private java.util.Map m_categories

  The category map

### m_catUrlMap

    private java.util.Map m_catUrlMap

  The listeners like the webui that send a URL to which the data is to be sent

### m_dsrPool

    private RunnableConsumerThreadPool m_dsrPool

  The data sender thread pool

### m_dataSenderQ

    private FifoQueue m_dataSenderQ

  The queue to which data send requests are queued

### m_euiMapper

    private EuiLevelMapper m_euiMapper

  The category to xml mapper

### POST_ERROR_LIMIT

    private final int POST_ERROR_LIMIT

  The allowable number of times posts can have errors before an URL is automatically unsubscribed

### m_status

    private int m_status

  The current status of this fiber

Constructor Detail

### DataSender

    public DataSender(java.util.Map categories,
                      int numSenders)

  The constructor for this object

Parameters:
  `categories` - The category map.
  `numSenders` - The number of senders.

Method Detail

### setCurrentThreadPriority

    private int setCurrentThreadPriority(int priority)

  Set the current thread's priority to the passed value and return the old priority

### start

    public void start()

  Start the datasender threadpool

  Specified by:
    `start` in interface `Fiber`

### stop

    public void stop()

  Shutdown the data sender thread pool

  Specified by:
    `stop` in interface `Fiber`

### getName

    public java.lang.String getName()

  Returns a name/id for this fiber

  Specified by:
    `getName` in interface `Fiber`
  Returns:
    The name of the `Fiber`.

### getStatus

    public int getStatus()

  Returns the current status

  Specified by:
    `getStatus` in interface `Fiber`
  Returns:
    The current status of the `Fiber`.

### subscribe

    public void subscribe(java.lang.String url,
                          java.lang.String catlabel,
                          java.lang.String user,
                          java.lang.String passwd)

  Subscribe - Add the recd. URL and related info to the category->Urls map so the sendData() can send out to appropriate Urls for each category. Also send the latest info for the category

### unsubscribe

    public void unsubscribe(java.lang.String urlStr)

  Unsubscribe - remove the recd. URL and related info from the category->Urls map so the sendData() will know when it sends data out

### sendData

    public void sendData()

  Loop through the categories and send out data for all categories that have changed

### notifyToSend

    public void notifyToSend()

  Notify the DataSender to send data - create a new 'SendRequest' to send the data and queue to the consumer

OpenNMS API 1.2.9

Generated by ranger on May 19 2007 2335.