Package org.opennms.netmgt.rtc
Class DataSender
- java.lang.Object
-
- org.opennms.netmgt.rtc.DataSender
-
- All Implemented Interfaces:
Fiber
public 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
-
-
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 java.lang.String
getName()
Returns a name/ID for this fiberint
getStatus()
Returns the current statusvoid
handleRtcSubscribe(IEvent event)
Inform the data sender of the new listenervoid
handleRtcUnsubscribe(IEvent event)
Inform the data sender of the listener unsubscribingvoid
notifyToSend()
Notify the DataSender to send data - create a new 'SendRequest' to send the data and queue to the consumervoid
sendData()
Loop through the categories and send out data for all categories that have changedvoid
start()
Start the data sender thread poolvoid
stop()
Shutdown the data sender thread poolvoid
subscribe(java.lang.String url, java.lang.String catlabel, java.lang.String user, java.lang.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.void
unsubscribe(java.lang.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 java.lang.String getName()
Returns a name/ID for this fiber
-
getStatus
public int getStatus()
Returns the current status
-
subscribe
public void subscribe(java.lang.String url, java.lang.String catlabel, java.lang.String user, java.lang.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- Parameters:
url
- aString
object.catlabel
- aString
object.user
- aString
object.passwd
- aString
object.
-
unsubscribe
public void unsubscribe(java.lang.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
- aString
object.
-
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
-
-