|
Rice Pastry API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.mpisws.p2p.transport.bandwidthmeasure.BandwidthMeasuringTransportLayer<Identifier>
Identifier
- public class BandwidthMeasuringTransportLayer<Identifier>
Measure the bandwidth of the connections.
Field Summary | |
---|---|
static int |
CUR_DOWN
|
static int |
CUR_SATURATED
|
static int |
CUR_UP
|
static int |
LAST_DOWN
|
static int |
LAST_SATURATED
|
static int |
LAST_UP
|
static int |
NOT_SATURATED
|
static int |
NUM_VALS
|
static int |
SATURATED
|
protected TimeSource |
time
|
Constructor Summary | |
---|---|
BandwidthMeasuringTransportLayer(int measurementPeriod,
TransportLayer<Identifier,java.nio.ByteBuffer> tl,
Environment env)
|
Method Summary | |
---|---|
void |
acceptMessages(boolean b)
Toggle accepting incoming messages. |
void |
acceptSockets(boolean b)
Toggle accepting new sockets. |
void |
destroy()
|
java.util.Map<Identifier,Tuple3<java.lang.Integer,java.lang.Integer,java.lang.Boolean>> |
getBandwidthUsed()
For all Identifiers that used any bandwidth since the measurementPeriod, returns: downstream bytes/sec, upstream bytes/sec, if the upstream was saturated |
Identifier |
getLocalIdentifier()
The local node. |
Tuple<int[],java.util.Collection<org.mpisws.p2p.transport.bandwidthmeasure.BandwidthMeasuringTransportLayer.MySocket>> |
getVals(Identifier i)
Should be holding the lock on measured |
void |
incomingSocket(P2PSocket<Identifier> s)
Notification of a new socket. |
protected void |
measure()
|
void |
messageReceived(Identifier i,
java.nio.ByteBuffer m,
java.util.Map<java.lang.String,java.lang.Object> options)
Called when a new message is received. |
SocketRequestHandle<Identifier> |
openSocket(Identifier i,
SocketCallback<Identifier> deliverSocketToMe,
java.util.Map<java.lang.String,java.lang.Object> options)
Open a socket to the Identifier |
MessageRequestHandle<Identifier,java.nio.ByteBuffer> |
sendMessage(Identifier i,
java.nio.ByteBuffer m,
MessageCallback<Identifier,java.nio.ByteBuffer> deliverAckToMe,
java.util.Map<java.lang.String,java.lang.Object> options)
Send the message to the identifier |
void |
setCallback(TransportLayerCallback<Identifier,java.nio.ByteBuffer> callback)
Set the callback for incoming sockets/messages |
void |
setErrorHandler(ErrorHandler<Identifier> handler)
To be notified of problems not related to an outgoing messaage/socket. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int CUR_DOWN
public static final int CUR_UP
public static final int CUR_SATURATED
public static final int LAST_DOWN
public static final int LAST_UP
public static final int LAST_SATURATED
public static final int NUM_VALS
public static final int SATURATED
public static final int NOT_SATURATED
protected TimeSource time
Constructor Detail |
---|
public BandwidthMeasuringTransportLayer(int measurementPeriod, TransportLayer<Identifier,java.nio.ByteBuffer> tl, Environment env)
Method Detail |
---|
protected void measure()
public Tuple<int[],java.util.Collection<org.mpisws.p2p.transport.bandwidthmeasure.BandwidthMeasuringTransportLayer.MySocket>> getVals(Identifier i)
i
-
public java.util.Map<Identifier,Tuple3<java.lang.Integer,java.lang.Integer,java.lang.Boolean>> getBandwidthUsed()
public void incomingSocket(P2PSocket<Identifier> s) throws java.io.IOException
TransportLayerCallback
incomingSocket
in interface TransportLayerCallback<Identifier,java.nio.ByteBuffer>
s
- the incoming socket
java.io.IOException
public void messageReceived(Identifier i, java.nio.ByteBuffer m, java.util.Map<java.lang.String,java.lang.Object> options) throws java.io.IOException
TransportLayerCallback
messageReceived
in interface TransportLayerCallback<Identifier,java.nio.ByteBuffer>
i
- The node it is coming fromm
- the messageoptions
- describe how the message arrived (udp/tcp, encrypted etc)
java.io.IOException
- if there is a problem decoding the messagepublic MessageRequestHandle<Identifier,java.nio.ByteBuffer> sendMessage(Identifier i, java.nio.ByteBuffer m, MessageCallback<Identifier,java.nio.ByteBuffer> deliverAckToMe, java.util.Map<java.lang.String,java.lang.Object> options)
TransportLayer
sendMessage
in interface TransportLayer<Identifier,java.nio.ByteBuffer>
i
- the destinationm
- the messagedeliverAckToMe
- layer dependent notification when the message is sent (can indicate placed on the wire, point-to-point acknowledgment, or end-to-end acknowledgement)options
- delivery options (don't source route, encrypt etc) (may not be respected if layer cannot provide service)
public SocketRequestHandle<Identifier> openSocket(Identifier i, SocketCallback<Identifier> deliverSocketToMe, java.util.Map<java.lang.String,java.lang.Object> options)
TransportLayer
openSocket
in interface TransportLayer<Identifier,java.nio.ByteBuffer>
i
- who to open the socket todeliverSocketToMe
- the callback when the socket is openedoptions
- options on how to open the socket (don't source route, encrypt etc) (may not be respected if layer cannot provide service)
public void acceptMessages(boolean b)
TransportLayer
acceptMessages
in interface TransportLayer<Identifier,java.nio.ByteBuffer>
public void acceptSockets(boolean b)
TransportLayer
acceptSockets
in interface TransportLayer<Identifier,java.nio.ByteBuffer>
public Identifier getLocalIdentifier()
TransportLayer
getLocalIdentifier
in interface TransportLayer<Identifier,java.nio.ByteBuffer>
public void setCallback(TransportLayerCallback<Identifier,java.nio.ByteBuffer> callback)
TransportLayer
setCallback
in interface TransportLayer<Identifier,java.nio.ByteBuffer>
callback
- the callback for incoming sockets/messagespublic void setErrorHandler(ErrorHandler<Identifier> handler)
TransportLayer
setErrorHandler
in interface TransportLayer<Identifier,java.nio.ByteBuffer>
handler
- to be notified of problems not related to a specific messaage/socket.public void destroy()
destroy
in interface Destructable
|
Rice Pastry API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |