HbsCollector

org.eso.ias.heartbeat.report.HbsCollector
See theHbsCollector companion object
class HbsCollector(val brokers: String, val consumerId: String, val ttl: Long, val ttlCheckTime: Long) extends TimerTask, HbListener

HbsCollector gets and collects the HBs received between invocations of startCollectingHbs and stopCollectingHBs.

HBs older than a given TTL (>0) are automatically removed from the container so that dead processes will disappear after they stop sending HBs. The reception time of the HB is checked against the TTL in a Timer task.

The removal of old HBs periodically done by the timer task can be paused/resumed

TODO: There is some overlap with the HbMonitor here: let HbMonitor re-use this class

Value parameters

brokers

Kafka brokers to connect to

consumerId

The id for the kafka consumer

ttl

time to leave (msec>=0) disabled by default, if ttl>0, HBs older then ttl are automatically removed from the container if ttl<=0, received HBs are never removed from the container It makes sense to link TTL to the HB period set in the CDB ("hbFrequency")

ttlCheckTime

the period (msec>0) to check for old HBs

Attributes

Companion
object
Graph
Supertypes
trait HbListener
class TimerTask
trait Runnable
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def clear(): Unit

Remove all the HBs collected so far

Remove all the HBs collected so far

Attributes

def collectHbsFor(time: Duration): Unit

Collect HBs for the passed time

Collect HBs for the passed time

Attributes

def getHbOf(hbProdType: HeartbeatProducerType, id: String): Option[HbMsg]

Get and return the HB of the tool with the given type and id

Get and return the HB of the tool with the given type and id

Value parameters

hbProdType

the type of the producer

id

the ID of the tool

Attributes

def getHbs: List[HbMsg]

Return all the HB messages in the container

Return all the HB messages in the container

Attributes

def getHbsOfType(hbProdType: HeartbeatProducerType): List[HbMsg]

Get and return the HBs in the map of the passed type

Get and return the HBs in the map of the passed type

Value parameters

hbProdType

the type of the producers

Attributes

override def hbReceived(hbMsg: HbMsg): Unit

An heartbeat has been read from the HB topic: it is added to the container

An heartbeat has been read from the HB topic: it is added to the container

Value parameters

hbMsg

The HB message

Attributes

Definition Classes
def isCollecting: Boolean

Attributes

Returns

true if the container is collecting HBs

def isConsumerReady: Boolean

Return true if the consumer has been initialized and is ready to get HB from the BSDB

Return true if the consumer has been initialized and is ready to get HB from the BSDB

Attributes

def isEmpty: Boolean

Attributes

Returns

true if the container is empty

def isTtlRemovalPaused: Boolean

Attributes

Returns

true if the thread to remove old HBs is paused

def pauseTtlCheck(): Unit

Pause the timer.

Pause the timer.

As the java timer cannot be paused, the pause/resume is simulated in the timer task (run)

Attributes

def resumeTtlCheck(): Unit

Resume the timer.

Resume the timer.

As the java timer cannot be paused, the pause/resume is simulated in the time task (run)

Attributes

def run(): Unit

The task run by the timer that removes the HBs older than the ttl

The task run by the timer that removes the HBs older than the ttl

Attributes

def setup(): Unit

Connect to the kafka brokers.

Connect to the kafka brokers.

Attributes

def shutdown(): Unit

Disconnect the consumer

Disconnect the consumer

Attributes

def size: Int

Return the number of items in the container

Return the number of items in the container

Attributes

def startCollectingHbs(): Unit

Starts collecting the HBs.

Starts collecting the HBs.

Attributes

def stopCollectingHbs(): Unit

Stops collecting the HBs.

Stops collecting the HBs.

Attributes

Inherited methods

def cancel(): Boolean

Attributes

Inherited from:
TimerTask

Attributes

Inherited from:
TimerTask

Concrete fields

val brokers: String
val consumerId: String

The consumer of HBs

The consumer of HBs

Attributes

val hbs: Map[String, HbMsg]

The map of the received HBs

The map of the received HBs

Attributes

val timer: Timer

The timer to remove old HBs

The timer to remove old HBs

Attributes

val ttl: Long
val ttlCheckTime: Long