public abstract class AbstractNorthbounder extends Object implements Northbounder, Runnable, StatusFactory<NorthboundAlarm>
The purpose of this class is manage the queue of alarms that need to be forward and receive queries to/from a Southbound Interface.
It passes Alarms on to the forwardAlarms method implemented by base classes in batches as they are added to the queue. The forwardAlarms method does the actual work of sending them to the Southbound Interface.
Preserve, accept and discard are called to add the Alarms to the queue as appropriate.
Modifier | Constructor and Description |
---|---|
protected |
AbstractNorthbounder(String name)
Instantiates a new abstract northbounder.
|
Modifier and Type | Method and Description |
---|---|
protected abstract boolean |
accepts(NorthboundAlarm alarm)
Accepts.
|
protected Map<String,Object> |
createMapping(NorthboundAlarm alarm,
String dateFormat)
Creates the mapping.
|
NorthboundAlarm |
createSyncLostMessage()
Creates a new Status object.
|
protected void |
discard(NorthboundAlarm alarm)
Discard.
|
abstract void |
forwardAlarms(List<NorthboundAlarm> alarms)
Forward alarms.
|
String |
getName()
Gets the name.
|
void |
onAlarm(NorthboundAlarm alarm)
On alarm.
|
protected void |
onPostStart()
Override this to perform actions after startup.
|
protected void |
onPreStart()
Override this to perform actions before startup.
|
protected void |
onStop()
Override this to perform actions when stopping.
|
protected void |
preserve(NorthboundAlarm alarm)
Preserve.
|
void |
reloadConfig()
Override this to perform actions when reloading the configuration.
|
void |
run() |
void |
setMaxBatchSize(int maxBatchSize)
Sets the max batch size.
|
void |
setMaxPreservedAlarms(int maxPreservedAlarms)
Sets the max preserved alarms.
|
void |
setNaglesDelay(long delay)
Sets the nagles delay.
|
void |
setRetryInterval(int retryInterval)
Sets the retry interval.
|
void |
start()
Start.
|
void |
stop()
Stop.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isReady
protected AbstractNorthbounder(String name)
name
- the namepublic String getName()
Northbounder
getName
in interface Northbounder
public void setNaglesDelay(long delay)
delay
- the new nagles delaypublic void setRetryInterval(int retryInterval)
retryInterval
- the new retry intervalpublic void setMaxBatchSize(int maxBatchSize)
maxBatchSize
- the new max batch sizepublic void setMaxPreservedAlarms(int maxPreservedAlarms)
maxPreservedAlarms
- the new max preserved alarmsprotected void onPreStart()
protected void onPostStart()
public final void start() throws NorthbounderException
Northbounder
start
in interface Northbounder
NorthbounderException
- the northbounder exceptionpublic final void onAlarm(NorthboundAlarm alarm) throws NorthbounderException
Northbounder
onAlarm
in interface Northbounder
alarm
- the alarmNorthbounderException
- the northbounder exceptionprotected abstract boolean accepts(NorthboundAlarm alarm)
alarm
- the alarmprotected void preserve(NorthboundAlarm alarm) throws NorthbounderException
alarm
- the alarmNorthbounderException
- the northbounder exceptionprotected void discard(NorthboundAlarm alarm) throws NorthbounderException
alarm
- the alarmNorthbounderException
- the northbounder exceptionprotected void onStop()
public void reloadConfig()
reloadConfig
in interface Northbounder
public final void stop() throws NorthbounderException
Northbounder
stop
in interface Northbounder
NorthbounderException
- the northbounder exceptionpublic NorthboundAlarm createSyncLostMessage()
StatusFactory
createSyncLostMessage
in interface StatusFactory<NorthboundAlarm>
public abstract void forwardAlarms(List<NorthboundAlarm> alarms) throws NorthbounderException
alarms
- the alarmsNorthbounderException
- the northbounder exceptionprotected Map<String,Object> createMapping(NorthboundAlarm alarm, String dateFormat)
alarmMappings
- the alarm mappingsalarm
- the northbound alarmCopyright © 2020. All rights reserved.