|
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.sourceroute.SourceRouteTransportLayerImpl<Identifier>
public class SourceRouteTransportLayerImpl<Identifier>
This layer can only send/receive messages from a SourceRoute and determine liveness. It does not manage current routes to nodes.
Field Summary |
---|
Fields inherited from interface org.mpisws.p2p.transport.sourceroute.SourceRouteTransportLayer |
---|
ALLOW_SOURCE_ROUTE, DONT_SOURCE_ROUTE, OPTION_SOURCE_ROUTE |
Constructor Summary | |
---|---|
SourceRouteTransportLayerImpl(SourceRouteFactory<Identifier> srFactory,
TransportLayer<Identifier,java.nio.ByteBuffer> etl,
SourceRouteForwardStrategy<Identifier> fSRs,
Environment env,
ErrorHandler<SourceRoute<Identifier>> errorHandler)
|
Method Summary | |
---|---|
void |
acceptMessages(boolean b)
Toggle accepting incoming messages. |
void |
acceptSockets(boolean b)
Toggle accepting new sockets. |
void |
addSourceRouteTap(SourceRouteTap tap)
|
void |
destroy()
|
SourceRoute |
getLocalIdentifier()
The local node. |
void |
incomingSocket(P2PSocket<Identifier> socka)
Notification of a new socket. |
protected void |
incomingSocketHelper(P2PSocket<Identifier> socket,
SourceRoute<Identifier> sr)
To override this behavior if needed. |
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<SourceRoute<Identifier>> |
openSocket(SourceRoute<Identifier> i,
SocketCallback<SourceRoute<Identifier>> deliverSocketToMe,
java.util.Map<java.lang.String,java.lang.Object> options)
Open a socket to the Identifier |
protected void |
openSocketHelper(SocketCallback<SourceRoute<Identifier>> deliverSocketToMe,
SocketRequestHandleImpl<SourceRoute<Identifier>> handle,
P2PSocket<Identifier> socket,
SourceRoute<Identifier> i)
|
boolean |
removeSourceRouteTap(SourceRouteTap tap)
|
MessageRequestHandle<SourceRoute<Identifier>,java.nio.ByteBuffer> |
sendMessage(SourceRoute<Identifier> i,
java.nio.ByteBuffer m,
MessageCallback<SourceRoute<Identifier>,java.nio.ByteBuffer> deliverAckToMe,
java.util.Map<java.lang.String,java.lang.Object> options)
Send the message to the identifier |
void |
setCallback(TransportLayerCallback<SourceRoute<Identifier>,java.nio.ByteBuffer> callback)
Set the callback for incoming sockets/messages |
void |
setErrorHandler(ErrorHandler<SourceRoute<Identifier>> errorHandler)
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 |
Constructor Detail |
---|
public SourceRouteTransportLayerImpl(SourceRouteFactory<Identifier> srFactory, TransportLayer<Identifier,java.nio.ByteBuffer> etl, SourceRouteForwardStrategy<Identifier> fSRs, Environment env, ErrorHandler<SourceRoute<Identifier>> errorHandler)
Method Detail |
---|
public SocketRequestHandle<SourceRoute<Identifier>> openSocket(SourceRoute<Identifier> i, SocketCallback<SourceRoute<Identifier>> deliverSocketToMe, java.util.Map<java.lang.String,java.lang.Object> options)
TransportLayer
openSocket
in interface TransportLayer<SourceRoute<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)
protected void openSocketHelper(SocketCallback<SourceRoute<Identifier>> deliverSocketToMe, SocketRequestHandleImpl<SourceRoute<Identifier>> handle, P2PSocket<Identifier> socket, SourceRoute<Identifier> i)
protected void incomingSocketHelper(P2PSocket<Identifier> socket, SourceRoute<Identifier> sr) throws java.io.IOException
socket
- sr
-
java.io.IOException
public void incomingSocket(P2PSocket<Identifier> socka) throws java.io.IOException
TransportLayerCallback
incomingSocket
in interface TransportLayerCallback<Identifier,java.nio.ByteBuffer>
socka
- the incoming socket
java.io.IOException
public MessageRequestHandle<SourceRoute<Identifier>,java.nio.ByteBuffer> sendMessage(SourceRoute<Identifier> i, java.nio.ByteBuffer m, MessageCallback<SourceRoute<Identifier>,java.nio.ByteBuffer> deliverAckToMe, java.util.Map<java.lang.String,java.lang.Object> options)
TransportLayer
sendMessage
in interface TransportLayer<SourceRoute<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 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 void setCallback(TransportLayerCallback<SourceRoute<Identifier>,java.nio.ByteBuffer> callback)
TransportLayer
setCallback
in interface TransportLayer<SourceRoute<Identifier>,java.nio.ByteBuffer>
callback
- the callback for incoming sockets/messagespublic void setErrorHandler(ErrorHandler<SourceRoute<Identifier>> errorHandler)
TransportLayer
setErrorHandler
in interface TransportLayer<SourceRoute<Identifier>,java.nio.ByteBuffer>
errorHandler
- to be notified of problems not related to a specific messaage/socket.public void acceptMessages(boolean b)
TransportLayer
acceptMessages
in interface TransportLayer<SourceRoute<Identifier>,java.nio.ByteBuffer>
public void acceptSockets(boolean b)
TransportLayer
acceptSockets
in interface TransportLayer<SourceRoute<Identifier>,java.nio.ByteBuffer>
public SourceRoute getLocalIdentifier()
TransportLayer
getLocalIdentifier
in interface TransportLayer<SourceRoute<Identifier>,java.nio.ByteBuffer>
public void destroy()
destroy
in interface Destructable
public void addSourceRouteTap(SourceRouteTap tap)
addSourceRouteTap
in interface SourceRouteTransportLayer<Identifier>
public boolean removeSourceRouteTap(SourceRouteTap tap)
removeSourceRouteTap
in interface SourceRouteTransportLayer<Identifier>
|
Rice Pastry API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |