Package gov.usgs.earthquake.distribution
Class HeartbeatInfo
- java.lang.Object
-
- gov.usgs.earthquake.distribution.HeartbeatInfo
-
public class HeartbeatInfo extends java.lang.Object
HeartbeatInfo stores a single heartbeat key/value message, together with a timestamp
-
-
Constructor Summary
Constructors Constructor Description HeartbeatInfo(java.lang.String message, java.util.Date date)
Message constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Date
getDate()
java.lang.String
getMessage()
boolean
isExpired(java.util.Date purgeDate)
Test if a message is older than a purgeDatevoid
setDate(java.util.Date date)
Set message timestampvoid
setMessage(java.lang.String message)
Set message contentjavax.json.JsonObject
toJsonObject()
-
-
-
Method Detail
-
getMessage
public java.lang.String getMessage()
- Returns:
- message contents
-
getDate
public java.util.Date getDate()
- Returns:
- message timestamp
-
setMessage
public void setMessage(java.lang.String message)
Set message content- Parameters:
message
- string to set
-
setDate
public void setDate(java.util.Date date)
Set message timestamp- Parameters:
date
- to set
-
isExpired
public boolean isExpired(java.util.Date purgeDate)
Test if a message is older than a purgeDate- Parameters:
purgeDate
- Date- Returns:
- true if
getDate()
is before purgeDate
-
toJsonObject
public javax.json.JsonObject toJsonObject()
- Returns:
- JSON object of the message
-
-