Package org.opennms.netmgt.rtc
Class DataSender
- java.lang.Object
-
- org.opennms.netmgt.rtc.DataSender
-
- All Implemented Interfaces:
Fiber
public class DataSender extends 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
-
-
Field Summary
-
Fields inherited from interface org.opennms.core.fiber.Fiber
RUNNING, START_PENDING, STARTING, STATUS_NAMES, STOP_PENDING, STOPPED
-
-
Constructor Summary
Constructors Constructor Description DataSender(AvailabilityService dataMgr, RTCConfigFactory configFactory)The constructor for this object
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetName()Returns a name/ID for this fiberintgetStatus()Returns the current statusvoidhandleRtcSubscribe(IEvent event)Inform the data sender of the new listenervoidhandleRtcUnsubscribe(IEvent event)Inform the data sender of the listener unsubscribingvoidnotifyToSend()Notify the DataSender to send data - create a new 'SendRequest' to send the data and queue to the consumervoidsendData()Loop through the categories and send out data for all categories that have changedvoidstart()Start the data sender thread poolvoidstop()Shutdown the data sender thread poolvoidsubscribe(String url, String catlabel, String user, String passwd)Subscribe - Add the received URL and related info to the category->URLs map so the sendData() can send out to appropriate URLs for each category.voidunsubscribe(String urlStr)Unsubscribe - remove the received URL and related info from the category->URLs map so the sendData() will know when it sends data out
-
-
-
Constructor Detail
-
DataSender
public DataSender(AvailabilityService dataMgr, RTCConfigFactory configFactory)
The constructor for this object- Parameters:
categories- The category map.numSenders- The number of senders.
-
-
Method Detail
-
getName
public String getName()
Returns a name/ID for this fiber
-
getStatus
public int getStatus()
Returns the current status
-
subscribe
public void subscribe(String url, String catlabel, String user, String passwd)
Subscribe - Add the received 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(String urlStr)
Unsubscribe - remove the received URL and related info from the category->URLs map so the sendData() will know when it sends data out- Parameters:
urlStr- aStringobject.
-
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
-
handleRtcSubscribe
public void handleRtcSubscribe(IEvent event)
Inform the data sender of the new listener
-
handleRtcUnsubscribe
public void handleRtcUnsubscribe(IEvent event)
Inform the data sender of the listener unsubscribing
-
-