Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Rice Pastry API
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.mpisws.p2p.transport.direct
Class DirectTransportLayer<Identifier,MessageType>

    java.lang.Object
      org.mpisws.p2p.transport.direct.DirectTransportLayer<Identifier,MessageType>

All Implemented Interfaces:
  TransportLayer<Identifier,MessageType>, Destructable

    public class DirectTransportLayer<Identifier,MessageType>

extends java.lang.Object
implements TransportLayer<Identifier,MessageType>

Field Summary
`protected boolean` | `acceptMessages`
`protected boolean` | `acceptSockets`
`protected TransportLayerCallback<Identifier,MessageType>` | `callback`
`protected Environment` | `environment`
`protected ErrorHandler<Identifier>` | `errorHandler`
`protected LivenessProvider<Identifier>` | `livenessProvider`
`protected Identifier` | `localIdentifier`
`protected Logger` | `logger`
`protected GenericNetworkSimulator<Identifier,MessageType>` | `simulator`

Constructor Summary
`DirectTransportLayer(Identifier local, NetworkSimulator<Identifier,MessageType> simulator, NodeRecord nr, Environment env)`

Method Summary
`void` | `acceptMessages(boolean b)` Toggle accepting incoming messages.
`void` | `acceptSockets(boolean b)` Toggle accepting new sockets.
`boolean` | `canReceiveSocket()`
`void` | `clearState(Identifier i)`
`void` | `destroy()`
`void` | `finishReceiveSocket(P2PSocket<Identifier> acceptorEndpoint)`
`Environment` | `getEnvironment()`
`Identifier` | `getLocalIdentifier()` The local node.
`Logger` | `getLogger()`
`int` | `getNextSeq()`
`void` | `incomingMessage(Identifier i, MessageType m, java.util.Map<java.lang.String,java.lang.Object> options)`
`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,MessageType>` | `sendMessage(Identifier i, MessageType m, MessageCallback<Identifier,MessageType> deliverAckToMe, java.util.Map<java.lang.String,java.lang.Object> options)` Send the message to the identifier
`void` | `setCallback(TransportLayerCallback<Identifier,MessageType> 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

### acceptMessages

    protected boolean acceptMessages

### acceptSockets

    protected boolean acceptSockets

### localIdentifier

    protected Identifier localIdentifier

### callback

    protected TransportLayerCallback<Identifier,MessageType> callback

### simulator

    protected GenericNetworkSimulator<Identifier,MessageType> simulator

### errorHandler

    protected ErrorHandler<Identifier> errorHandler

### livenessProvider

    protected LivenessProvider<Identifier> livenessProvider

### environment

    protected Environment environment

### logger

    protected Logger logger

Constructor Detail

### DirectTransportLayer

    public DirectTransportLayer(Identifier local,
                                NetworkSimulator<Identifier,MessageType> simulator,
                                NodeRecord nr,
                                Environment env)

Method Detail

### acceptMessages

    public void acceptMessages(boolean b)

  Description copied from interface: `TransportLayer`
  Toggle accepting incoming messages. Useful in flow control if overwhelmed by incoming sockets. Default: true

  Specified by:
    `acceptMessages` in interface `TransportLayer<Identifier,MessageType>`

### acceptSockets

    public void acceptSockets(boolean b)

  Description copied from interface: `TransportLayer`
  Toggle accepting new sockets. Useful in flow control if overwhelmed by incoming sockets. Default: true

  Specified by:
    `acceptSockets` in interface `TransportLayer<Identifier,MessageType>`

### getLocalIdentifier

    public Identifier getLocalIdentifier()

  Description copied from interface: `TransportLayer`
  The local node.

  Specified by:
    `getLocalIdentifier` in interface `TransportLayer<Identifier,MessageType>`
  Returns:
    The local node.

### openSocket

    public SocketRequestHandle<Identifier> openSocket(Identifier i,
                                                      SocketCallback<Identifier> deliverSocketToMe,
                                                      java.util.Map<java.lang.String,java.lang.Object> options)

  Description copied from interface: `TransportLayer`
  Open a socket to the Identifier

  Specified by:
    `openSocket` in interface `TransportLayer<Identifier,MessageType>`
  Parameters:
    `i` - who to open the socket to
    `deliverSocketToMe` - the callback when the socket is opened
    `options` - options on how to open the socket (don't source route, encrypt etc) (may not be respected if layer cannot provide service)
  Returns:
    an object to cancel opening the socket if it takes to long, or is no longer relevent

### sendMessage

    public MessageRequestHandle<Identifier,MessageType> sendMessage(Identifier i,
                                                                    MessageType m,
                                                                    MessageCallback<Identifier,MessageType> deliverAckToMe,
                                                                    java.util.Map<java.lang.String,java.lang.Object> options)

  Description copied from interface: `TransportLayer`
  Send the message to the identifier

  Specified by:
    `sendMessage` in interface `TransportLayer<Identifier,MessageType>`
  Parameters:
    `i` - the destination
    `m` - the message
    `deliverAckToMe` - layer dependent notification when the message is sent (can indicate placed on the wire, point-to-point acknowledgement, or end-to-end acknowledgement)
    `options` - delivery options (don't source route, encrypt etc) (may not be respected if layer cannot provide service)
  Returns:
    ability to cancel the message if no longer relevent

### setCallback

    public void setCallback(TransportLayerCallback<Identifier,MessageType> callback)

  Description copied from interface: `TransportLayer`
  Set the callback for incoming sockets/messages

  Specified by:
    `setCallback` in interface `TransportLayer<Identifier,MessageType>`
  Parameters:
    `callback` - the callback for incoming sockets/messages

### setErrorHandler

    public void setErrorHandler(ErrorHandler<Identifier> handler)

  Description copied from interface: `TransportLayer`
  To be notified of problems not related to an outgoing messaage/socket. Or to be notified if a callback isn't provided.

  Specified by:
    `setErrorHandler` in interface `TransportLayer<Identifier,MessageType>`
  Parameters:
    `handler` - to be notified of problems not related to a specific messaage/socket.

### destroy

    public void destroy()

  Specified by:
    `destroy` in interface `Destructable`

### canReceiveSocket

    public boolean canReceiveSocket()

### finishReceiveSocket

    public void finishReceiveSocket(P2PSocket<Identifier> acceptorEndpoint)

### getLogger

    public Logger getLogger()

### getNextSeq

    public int getNextSeq()

### incomingMessage

    public void incomingMessage(Identifier i,
                                MessageType m,
                                java.util.Map<java.lang.String,java.lang.Object> options)
                         throws java.io.IOException

  Throws:
    `java.io.IOException`

### getEnvironment

    public Environment getEnvironment()

### clearState

    public void clearState(Identifier i)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Rice Pastry API
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2005 - Rice Pastry.