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

## rice.pastry.transport
Class NodeHandleAdapter

    java.lang.Object
      rice.pastry.transport.NodeHandleAdapter

All Implemented Interfaces:
  LivenessProvider<NodeHandle>, LivenessTypes, ProximityProvider<NodeHandle>, TransportLayer<NodeHandle,RawMessage>, Destructable

    public class NodeHandleAdapter

extends java.lang.Object
implements TransportLayer<NodeHandle,RawMessage>, LivenessProvider<NodeHandle>, ProximityProvider<NodeHandle>

Field Summary

Fields inherited from interface org.mpisws.p2p.transport.liveness.LivenessTypes
`LIVENESS_ALIVE, LIVENESS_DEAD, LIVENESS_DEAD_FOREVER, LIVENESS_SUSPECTED`

Fields inherited from interface org.mpisws.p2p.transport.proximity.ProximityProvider
`DEFAULT_PROXIMITY`

Constructor Summary
`NodeHandleAdapter(TransportLayer tl, LivenessProvider livenessProvider, ProximityProvider proxProvider)`

Method Summary
`void` | `acceptMessages(boolean b)` Toggle accepting incoming messages.
`void` | `acceptSockets(boolean b)` Toggle accepting new sockets.
`void` | `addLivenessListener(LivenessListener<NodeHandle> name)`
`void` | `addProximityListener(ProximityListener<NodeHandle> listener)`
`boolean` | `checkLiveness(NodeHandle i, java.util.Map<java.lang.String,java.lang.Object> options)` Returns whether a new notification will occur.
`void` | `clearState(NodeHandle i)` Force layer to clear the existing state related to the Identifier.
`void` | `destroy()`
`int` | `getLiveness(NodeHandle i, java.util.Map<java.lang.String,java.lang.Object> options)`
`NodeHandle` | `getLocalIdentifier()` The local node.
`TransportLayer` | `getTL()`
`SocketRequestHandle<NodeHandle>` | `openSocket(NodeHandle i, SocketCallback<NodeHandle> deliverSocketToMe, java.util.Map<java.lang.String,java.lang.Object> options)` Open a socket to the Identifier
`int` | `proximity(NodeHandle i, java.util.Map<java.lang.String,java.lang.Object> options)`
`boolean` | `removeLivenessListener(LivenessListener<NodeHandle> name)`
`boolean` | `removeProximityListener(ProximityListener<NodeHandle> listener)`
`MessageRequestHandle<NodeHandle,RawMessage>` | `sendMessage(NodeHandle i, RawMessage m, MessageCallback<NodeHandle,RawMessage> deliverAckToMe, java.util.Map<java.lang.String,java.lang.Object> options)` Send the message to the identifier
`void` | `setCallback(TransportLayerCallback<NodeHandle,RawMessage> callback)` Set the callback for incoming sockets/messages
`void` | `setErrorHandler(ErrorHandler<NodeHandle> 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`

Constructor Detail

### NodeHandleAdapter

    public NodeHandleAdapter(TransportLayer tl,
                             LivenessProvider livenessProvider,
                             ProximityProvider proxProvider)

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<NodeHandle,RawMessage>`

### 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<NodeHandle,RawMessage>`

### getLocalIdentifier

    public NodeHandle getLocalIdentifier()

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

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

### openSocket

    public SocketRequestHandle<NodeHandle> openSocket(NodeHandle i,
                                                      SocketCallback<NodeHandle> 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<NodeHandle,RawMessage>`
  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 relevant

### sendMessage

    public MessageRequestHandle<NodeHandle,RawMessage> sendMessage(NodeHandle i,
                                                                   RawMessage m,
                                                                   MessageCallback<NodeHandle,RawMessage> 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<NodeHandle,RawMessage>`
  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 acknowledgment, 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 relevant

### setCallback

    public void setCallback(TransportLayerCallback<NodeHandle,RawMessage> callback)

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

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

### setErrorHandler

    public void setErrorHandler(ErrorHandler<NodeHandle> 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<NodeHandle,RawMessage>`
  Parameters:
    `handler` - to be notified of problems not related to a specific messaage/socket.

### destroy

    public void destroy()

  Specified by:
    `destroy` in interface `Destructable`

### addLivenessListener

    public void addLivenessListener(LivenessListener<NodeHandle> name)

  Specified by:
    `addLivenessListener` in interface `LivenessProvider<NodeHandle>`

### checkLiveness

    public boolean checkLiveness(NodeHandle i,
                                 java.util.Map<java.lang.String,java.lang.Object> options)

  Description copied from interface: `LivenessProvider`
  Returns whether a new notification will occur. Will return false if a liveness check has recently completed. Will return true if a new liveness check starts, or an existing one is in progress.

  Specified by:
    `checkLiveness` in interface `LivenessProvider<NodeHandle>`
  Parameters:
    `i` - the node to check
  Returns:
    true if there will be an update (either a ping, or a change in liveness) false if there won't be an update due to bandwidth concerns

### getLiveness

    public int getLiveness(NodeHandle i,
                           java.util.Map<java.lang.String,java.lang.Object> options)

  Specified by:
    `getLiveness` in interface `LivenessProvider<NodeHandle>`

### removeLivenessListener

    public boolean removeLivenessListener(LivenessListener<NodeHandle> name)

  Specified by:
    `removeLivenessListener` in interface `LivenessProvider<NodeHandle>`

### addProximityListener

    public void addProximityListener(ProximityListener<NodeHandle> listener)

  Specified by:
    `addProximityListener` in interface `ProximityProvider<NodeHandle>`

### proximity

    public int proximity(NodeHandle i,
                         java.util.Map<java.lang.String,java.lang.Object> options)

  Specified by:
    `proximity` in interface `ProximityProvider<NodeHandle>`

### removeProximityListener

    public boolean removeProximityListener(ProximityListener<NodeHandle> listener)

  Specified by:
    `removeProximityListener` in interface `ProximityProvider<NodeHandle>`

### getTL

    public TransportLayer getTL()

### clearState

    public void clearState(NodeHandle i)

  Description copied from interface: `LivenessProvider`
  Force layer to clear the existing state related to the Identifier. Usually if there is reason to believe a node has returned.

  Specified by:
    `clearState` in interface `LivenessProvider<NodeHandle>`
  Specified by:
    `clearState` in interface `ProximityProvider<NodeHandle>`

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.