public class RTCNode extends Object
RTCNode is the main data unit for the RTCManager - these datablocks are created initially as data is read from the database and later if a 'nodeGainedService' is received - each node maintains its node id, ip address, service name and a list of 'RTCNodeSvcTime's
Also, each node knows and maintains a list of categories that this tuple belongs to
RTCNodeSvcTime
,
RTCNodeSvcTimesList
Constructor and Description |
---|
RTCNode(long nodeid,
InetAddress inetAddress,
String svcName)
Constructor.
|
RTCNode(RTCNodeKey key)
Constructor for RTCNode.
|
Modifier and Type | Method and Description |
---|---|
void |
addCategory(String catLabel)
Add to the category list for this node.
|
void |
addSvcTime(long losttime,
long regainedtime)
Add a new 'RTCNodeSvcTime' entry for this node.
|
boolean |
belongsTo(String catLabel)
Check if this node belongs to the category.
|
boolean |
equals(Object o)
Compare RTCNodes.
|
List<String> |
getCategories()
Return the list of categories this node belongs to.
|
long |
getDownTime(String cat,
long curTime,
long rollingWindow)
Get the down time.
|
InetAddress |
getIP()
Return the IP address.
|
long |
getNodeID()
Return the node ID.
|
List<RTCNodeSvcTime> |
getServiceTimes()
Return the list of service times for this node.
|
String |
getSvcName()
Return the service name.
|
double |
getValue(String cat,
long curTime,
long rollingWindow)
Get the avaialability.
|
int |
hashCode() |
boolean |
isServiceCurrentlyDown()
Return if the service is currently up/down.
|
void |
nodeLostService(long t)
Add a node lost service time.
|
void |
nodeRegainedService(long t)
Add a node regained service time.
|
void |
removeCategory(String catLabel)
Remove a category from the node's context.
|
void |
setIP(InetAddress ip)
Set the IP address.
|
void |
setNodeID(long id)
Set the node ID.
|
void |
setSvcName(String svcName)
Set the service name.
|
String |
toString()
String represenatation.
|
public RTCNode(RTCNodeKey key)
Constructor for RTCNode.
key
- a RTCNodeKey
object.public RTCNode(long nodeid, InetAddress inetAddress, String svcName)
nodeid
- the node idinetAddress
- the IP addresssvcName
- the servicepublic void setNodeID(long id)
id
- the node IDpublic void setSvcName(String svcName)
svcName
- the service namepublic void setIP(InetAddress ip)
ip
- the ip addresspublic void addSvcTime(long losttime, long regainedtime)
losttime
- time at which service was lostregainedtime
- time at which service was regainedpublic void addCategory(String catLabel)
catLabel
- category label of the category this node has been added topublic void removeCategory(String catLabel)
catLabel
- category label of the category this node has been added topublic void nodeLostService(long t)
t
- the time at which service was lostpublic void nodeRegainedService(long t)
t
- the time at which node regained servicepublic long getNodeID()
public String getSvcName()
public InetAddress getIP()
public List<RTCNodeSvcTime> getServiceTimes()
public boolean belongsTo(String catLabel)
catLabel
- category labelpublic List<String> getCategories()
public long getDownTime(String cat, long curTime, long rollingWindow)
cat
- the category in the context which of which downtime is neededcurTime
- the start time (or current time) from which we go back
rollinWindow intervalrollingWindow
- the window for which downtime is requiredpublic double getValue(String cat, long curTime, long rollingWindow)
cat
- the category in the context which of which availability is
neededcurTime
- the start time (or current time) from which we go back
rollinWindow intervalrollingWindow
- the window for which availability is requiredpublic boolean isServiceCurrentlyDown()
public boolean equals(Object o)
Copyright © 2015. All rights reserved.