|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--tapestry.patchwork.Patch
Abstract class from which all measurements modules (Patches) extend. Contains a large amount of functionality that all Patches share. Also defines the types used to identify different types of measurements to the outside world (and the inside world, as well).
Nested Class Summary | |
---|---|
protected class |
Patch.SeqNo
Internal class for wrapping sequence numbers |
Field Summary | |
---|---|
protected Classifier |
_classifier
|
protected FaultAdmin |
_fault_admin
|
protected Period |
_period
|
protected HashMap |
_probe_times
|
protected PriorityQueue |
_queue
|
protected HashMap |
_quick_stats
|
protected NodeId |
_self_node_id
|
protected HashMap |
_seq_nos
|
protected PatchworkTable |
_table
|
protected byte |
_type
|
protected static Object |
_udp_lock
|
protected static NonblockingDatagramSocket |
_udp_socket
|
protected HashMap |
_userdata_sinks
|
protected static SelectItem |
_write_selitem
|
protected static SelectSet |
_write_selset
|
protected String |
class_tag
|
protected boolean |
DEBUG
|
static int |
NUM_TYPES
The total number of measurement types |
protected static boolean |
sim_running
|
static byte |
TYPE_BANDWIDTH
Measurement type for bandwidth |
static byte |
TYPE_LATENCY
Measurement type for latency |
static byte |
TYPE_LOSS
Measurement type for loss rate |
protected static byte |
TYPE_RECALC
Measurement type for recalculation (internal use only) |
protected static boolean |
use_tcp
|
Constructor Summary | |
---|---|
Patch(NodeId self_node_id,
Classifier classifier,
PatchworkTable table,
FaultAdmin fault_admin,
Period period)
Create a new Patch. |
Method Summary | |
---|---|
void |
addMonitorAll(Object userData,
SinkIF sink)
Tells this patch that a node wants to hear about status messages from everyone. |
void |
addNode(NodeId node,
int level,
Object userData,
SinkIF sink)
Tell this Patch to begin monitoring a node at some probing level |
protected void |
addToQueue(NodeId node)
Add this node back on the queue. |
protected void |
dispatch(ProbeMsg event)
An internal method used for dispatching probe messages (UDP) |
protected void |
dispatch(QueueElementIF event)
An internal method used for dispatching events |
protected void |
enqueue(QueueElementIF event,
SinkIF sink)
|
protected int |
getAndUpdateSeqNo(NodeId node)
Get the next sequence number for this node, and update it for next time. |
protected abstract void |
handleAlarm(AlarmMsg alarm)
|
void |
handleEvent(PatchMsg msg,
long timeReceived)
Handle events given the exact time they were received by Patchwork. |
protected void |
handleProbe(ProbeMsg inProbe)
|
protected abstract void |
handleProbeResponse(ProbeMsg response,
long timeRecvd)
Handle the response to a probe. |
protected void |
handleQuickStatProbeResp(NodeId peer,
long value)
Got a response to a quick stat probe, with the given observed measurement. |
protected void |
handleQuickStatReq(QuickStatReq msg)
|
protected void |
handleQuickStatTimeout(QuickStatTimeout msg)
|
protected abstract void |
handleTimeout(ProbeTimeout timeout)
|
protected void |
handleUnknown(PatchMsg msg)
Got a message we weren't expecting, did we? |
protected void |
makeObservation(NodeId peer,
long value)
Record an observation (of the Patch's type) in the table |
protected void |
makeObservation(NodeId peer,
long value,
byte type)
Record an observation (of arbitrary type) in the table |
protected long |
registerResponse(ProbeMsg response)
We received a response, so figure out state |
protected boolean |
registerTimeout(ProbeTimeout pt)
Got a timeout for a probe. |
void |
removeNode(NodeId node,
Object userData,
SinkIF sink)
Tell this Patch to stop monitoring a node |
protected void |
sendProbe(ProbeMsg probe)
Send a probe to another node, expecting a response back. |
protected void |
sendQuickStatProbe(NodeId peer)
Send a standard quick probe to the given node. |
protected void |
setNextAlarm()
Pick the node from the queue that needs to be probed the soonest, and set the alarm for it. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected String class_tag
protected boolean DEBUG
protected static boolean sim_running
protected static boolean use_tcp
public static final byte TYPE_LOSS
public static final byte TYPE_LATENCY
public static final byte TYPE_BANDWIDTH
protected static final byte TYPE_RECALC
public static final int NUM_TYPES
protected NodeId _self_node_id
protected Classifier _classifier
protected PatchworkTable _table
protected FaultAdmin _fault_admin
protected byte _type
protected HashMap _seq_nos
protected HashMap _probe_times
protected HashMap _quick_stats
protected HashMap _userdata_sinks
protected static NonblockingDatagramSocket _udp_socket
protected static SelectSet _write_selset
protected static SelectItem _write_selitem
protected static Object _udp_lock
protected PriorityQueue _queue
protected Period _period
Constructor Detail |
public Patch(NodeId self_node_id, Classifier classifier, PatchworkTable table, FaultAdmin fault_admin, Period period)
self_node_id
- this node's idclassifier
- this node's classifiertable
- the collection of measurements from this node to
other nodesperiod
- defines the periodic function governing the probes of
this PatchMethod Detail |
public void addNode(NodeId node, int level, Object userData, SinkIF sink)
node
- the node to begin monitoringlevel
- the probing level for that nodeuserData
- an object that will identify this monitoring instance
to the calling applicationsink
- the sink on which to enqueue status responsespublic void addMonitorAll(Object userData, SinkIF sink)
userData
- an object that will identify this monitoring instance
to the calling applicationsink
- the sink on which to enqueue status responsespublic void removeNode(NodeId node, Object userData, SinkIF sink)
node
- the node to stop monitoringuserData
- an object that will identify this monitoring instance
to the calling applicationsink
- the sink on which to enqueue status responsesprotected void addToQueue(NodeId node)
node
- the node to addprotected void setNextAlarm()
public void handleEvent(PatchMsg msg, long timeReceived)
msg
- the msg to handletimeReceived
- the absolute time (in microseconds) msg
was receivedprotected void handleUnknown(PatchMsg msg)
protected void handleQuickStatReq(QuickStatReq msg)
protected void handleQuickStatProbeResp(NodeId peer, long value)
protected void handleQuickStatTimeout(QuickStatTimeout msg)
protected void sendQuickStatProbe(NodeId peer)
protected void makeObservation(NodeId peer, long value)
peer
- the node being observedvalue
- the value of the observed measurementprotected void makeObservation(NodeId peer, long value, byte type)
peer
- the node being observedvalue
- the value of the observed measurementtype
- the type of the observationprotected abstract void handleProbeResponse(ProbeMsg response, long timeRecvd)
response
- the responsetimeRecvd
- the absolute time the repsonse was received
(in microseconds)protected abstract void handleAlarm(AlarmMsg alarm)
protected abstract void handleTimeout(ProbeTimeout timeout)
protected void handleProbe(ProbeMsg inProbe)
protected void sendProbe(ProbeMsg probe)
protected long registerResponse(ProbeMsg response)
protected boolean registerTimeout(ProbeTimeout pt)
protected int getAndUpdateSeqNo(NodeId node)
protected void dispatch(QueueElementIF event)
protected void dispatch(ProbeMsg event)
protected void enqueue(QueueElementIF event, SinkIF sink)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |