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(int nodeid,
       InetAddress inetAddress,
       String svcName,
       long rollingWindow)
Constructor. 
 | 
RTCNode(RTCNodeKey key,
       long rollingWindow)
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. 
 | 
Integer | 
getNodeID()
Return the node ID. 
 | 
String | 
getSvcName()
Return the service name. 
 | 
int | 
hashCode() | 
boolean | 
isServiceCurrentlyDown()
Return if the service is currently 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 | 
setNodeID(int id)
Set the node ID. 
 | 
String | 
toString()
 String representation. 
 | 
public RTCNode(RTCNodeKey key, long rollingWindow)
Constructor for RTCNode.
key - a RTCNodeKey object.public RTCNode(int nodeid,
               InetAddress inetAddress,
               String svcName,
               long rollingWindow)
nodeid - the node idinetAddress - the IP addresssvcName - the servicepublic void setNodeID(int id)
id - the node IDpublic 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 Integer getNodeID()
public String getSvcName()
public InetAddress getIP()
public boolean belongsTo(String catLabel)
catLabel - category labelpublic List<String> getCategories()
public long getDownTime(String cat, long curTime, long rollingWindow) throws NodeNotInCategoryException
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 requiredNodeNotInCategoryExceptionpublic boolean isServiceCurrentlyDown()
public boolean equals(Object o)
Copyright © 2020. All rights reserved.