|
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.priority.PriorityTransportLayerImpl<Identifier>
public class PriorityTransportLayerImpl<Identifier>
Field Summary | |
---|---|
static byte[] |
BIG_MSG_SOCKET
|
static byte |
BIG_MSG_SOCKET_B
|
protected boolean |
destroyed
|
protected java.util.Map<Identifier,org.mpisws.p2p.transport.priority.PriorityTransportLayerImpl.EntityManager> |
entityManagers
|
protected Environment |
environment
|
Logger |
logger
|
int |
MAX_BIG_MSG_SIZE
BIG messages open a socket especially for big messages. |
int |
MAX_MSG_SIZE
|
int |
MAX_QUEUE_SIZE
|
static byte[] |
PASSTHROUGH_SOCKET
|
static byte |
PASSTHROUGH_SOCKET_B
|
static byte[] |
PRIMARY_SOCKET
|
static byte |
PRIMARY_SOCKET_B
|
protected java.util.ArrayList<PrimarySocketListener<Identifier>> |
primarySocketListeners
|
protected SelectorManager |
selectorManager
|
Fields inherited from interface org.mpisws.p2p.transport.priority.PriorityTransportLayer |
---|
DEFAULT_PRIORITY, HIGH_PRIORITY, LOW_PRIORITY, LOWEST_PRIORITY, MAX_PRIORITY, MEDIUM_HIGH_PRIORITY, MEDIUM_LOW_PRIORITY, MEDIUM_PRIORITY, OPTION_PRIORITY, STATUS_CONNECTED, STATUS_CONNECTING, STATUS_NOT_CONNECTED |
Fields inherited from interface org.mpisws.p2p.transport.liveness.LivenessTypes |
---|
LIVENESS_ALIVE, LIVENESS_DEAD, LIVENESS_DEAD_FOREVER, LIVENESS_SUSPECTED |
Constructor Summary | |
---|---|
PriorityTransportLayerImpl(TransportLayer<Identifier,java.nio.ByteBuffer> tl,
LivenessProvider<Identifier> livenessProvider,
ProximityProvider<Identifier> proximityProvider,
Environment env,
int maxMsgSize,
int maxQueueSize,
ErrorHandler<Identifier> handler)
The maximum message size; |
Method Summary | |
---|---|
void |
acceptMessages(boolean b)
Toggle accepting incoming messages. |
void |
acceptSockets(boolean b)
Toggle accepting new sockets. |
void |
addPrimarySocketListener(PrimarySocketListener<Identifier> listener)
|
void |
addPriorityTransportLayerListener(PriorityTransportLayerListener<Identifier> listener)
|
void |
addTransportLayerListener(TransportLayerListener<Identifier> listener)
|
long |
bytesPending(Identifier i)
The number of bytes to be sent to the identifier |
void |
cancelLivenessChecker(Identifier i)
|
java.util.Map<java.lang.String,java.lang.Object> |
connectionOptions(Identifier i)
Returns the options on the primary connection |
int |
connectionStatus(Identifier i)
Returns if there is a primary connection to the identifier |
protected org.mpisws.p2p.transport.priority.PriorityTransportLayerImpl.EntityManager |
deleteEntityManager(Identifier i)
|
void |
destroy()
|
protected org.mpisws.p2p.transport.priority.PriorityTransportLayerImpl.EntityManager |
getEntityManager(Identifier i)
|
Identifier |
getLocalIdentifier()
The local node. |
java.util.List<MessageInfo> |
getPendingMessages(Identifier i)
The number of bytes to be sent to the identifier |
void |
incomingSocket(P2PSocket<Identifier> s)
We have to read the first byte and see if this is a passthrough (the layer higher than us asked to open it) socket or a primary (our layer tried to open it) socket. |
void |
livenessChanged(Identifier i,
int val,
java.util.Map<java.lang.String,java.lang.Object> options)
Called when the liveness changes. |
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. |
java.util.Collection<Identifier> |
nodesWithPendingMessages()
usually used with bytesPending() or queueLength() |
void |
notifyListenersDropped(int size,
Identifier dest,
java.util.Map<java.lang.String,java.lang.Object> options)
|
void |
notifyListenersEnqueued(int size,
Identifier dest,
java.util.Map<java.lang.String,java.lang.Object> options)
|
void |
notifyListenersRead(int size,
Identifier source,
java.util.Map<java.lang.String,java.lang.Object> options)
|
void |
notifyListenersWrote(int size,
Identifier dest,
java.util.Map<java.lang.String,java.lang.Object> options)
|
void |
openPrimaryConnection(Identifier i,
java.util.Map<java.lang.String,java.lang.Object> options)
open a primary connection |
SocketRequestHandle<Identifier> |
openSocket(Identifier i,
SocketCallback<Identifier> deliverSocketToMe,
java.util.Map<java.lang.String,java.lang.Object> options)
Open a socket to the Identifier |
void |
printMemStats(int logLevel)
Problem?: this method should perhaps take the EntityManager as an arg. |
int |
queueLength(Identifier i)
Returns the number of messages pending to be sent |
void |
removePrimarySocketListener(PrimarySocketListener<Identifier> listener)
|
void |
removePriorityTransportLayerListener(PriorityTransportLayerListener<Identifier> listener)
|
void |
removeTransportLayerListener(TransportLayerListener<Identifier> listener)
|
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 byte PASSTHROUGH_SOCKET_B
public static final byte PRIMARY_SOCKET_B
public static final byte BIG_MSG_SOCKET_B
public static final byte[] PASSTHROUGH_SOCKET
public static final byte[] PRIMARY_SOCKET
public static final byte[] BIG_MSG_SOCKET
public int MAX_MSG_SIZE
public int MAX_QUEUE_SIZE
public int MAX_BIG_MSG_SIZE
public Logger logger
protected java.util.Map<Identifier,org.mpisws.p2p.transport.priority.PriorityTransportLayerImpl.EntityManager> entityManagers
protected SelectorManager selectorManager
protected Environment environment
protected java.util.ArrayList<PrimarySocketListener<Identifier>> primarySocketListeners
protected boolean destroyed
Constructor Detail |
---|
public PriorityTransportLayerImpl(TransportLayer<Identifier,java.nio.ByteBuffer> tl, LivenessProvider<Identifier> livenessProvider, ProximityProvider<Identifier> proximityProvider, Environment env, int maxMsgSize, int maxQueueSize, ErrorHandler<Identifier> handler)
env
- maxMsgSize
- Method Detail |
---|
public void incomingSocket(P2PSocket<Identifier> s) throws java.io.IOException
incomingSocket
in interface TransportLayerCallback<Identifier,java.nio.ByteBuffer>
s
- the incoming socket
java.io.IOException
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 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 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
protected org.mpisws.p2p.transport.priority.PriorityTransportLayerImpl.EntityManager getEntityManager(Identifier i)
protected org.mpisws.p2p.transport.priority.PriorityTransportLayerImpl.EntityManager deleteEntityManager(Identifier i)
public void livenessChanged(Identifier i, int val, java.util.Map<java.lang.String,java.lang.Object> options)
LivenessListener
livenessChanged
in interface LivenessListener<Identifier>
public void cancelLivenessChecker(Identifier i)
public void printMemStats(int logLevel)
i
- options
- public void addTransportLayerListener(TransportLayerListener<Identifier> listener)
addTransportLayerListener
in interface PriorityTransportLayer<Identifier>
public void removeTransportLayerListener(TransportLayerListener<Identifier> listener)
removeTransportLayerListener
in interface PriorityTransportLayer<Identifier>
public void addPriorityTransportLayerListener(PriorityTransportLayerListener<Identifier> listener)
addPriorityTransportLayerListener
in interface PriorityTransportLayer<Identifier>
public void removePriorityTransportLayerListener(PriorityTransportLayerListener<Identifier> listener)
removePriorityTransportLayerListener
in interface PriorityTransportLayer<Identifier>
public void notifyListenersRead(int size, Identifier source, java.util.Map<java.lang.String,java.lang.Object> options)
public void notifyListenersWrote(int size, Identifier dest, java.util.Map<java.lang.String,java.lang.Object> options)
public void notifyListenersEnqueued(int size, Identifier dest, java.util.Map<java.lang.String,java.lang.Object> options)
public void notifyListenersDropped(int size, Identifier dest, java.util.Map<java.lang.String,java.lang.Object> options)
public long bytesPending(Identifier i)
PriorityTransportLayer
bytesPending
in interface PriorityTransportLayer<Identifier>
public int queueLength(Identifier i)
PriorityTransportLayer
queueLength
in interface PriorityTransportLayer<Identifier>
public java.util.List<MessageInfo> getPendingMessages(Identifier i)
PriorityTransportLayer
getPendingMessages
in interface PriorityTransportLayer<Identifier>
public java.util.Collection<Identifier> nodesWithPendingMessages()
PriorityTransportLayer
nodesWithPendingMessages
in interface PriorityTransportLayer<Identifier>
public java.util.Map<java.lang.String,java.lang.Object> connectionOptions(Identifier i)
PriorityTransportLayer
connectionOptions
in interface PriorityTransportLayer<Identifier>
public int connectionStatus(Identifier i)
PriorityTransportLayer
connectionStatus
in interface PriorityTransportLayer<Identifier>
public void openPrimaryConnection(Identifier i, java.util.Map<java.lang.String,java.lang.Object> options)
PriorityTransportLayer
openPrimaryConnection
in interface PriorityTransportLayer<Identifier>
public void addPrimarySocketListener(PrimarySocketListener<Identifier> listener)
addPrimarySocketListener
in interface PriorityTransportLayer<Identifier>
public void removePrimarySocketListener(PrimarySocketListener<Identifier> listener)
removePrimarySocketListener
in interface PriorityTransportLayer<Identifier>
|
Rice Pastry API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |