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.socket
Class PingManager

    java.lang.Object
      rice.selector.SelectionKeyHandler
          rice.pastry.socket.PingManager

    public class PingManager

extends SelectionKeyHandler

Version:
  $Id: PingManager.java 3402 2006-09-13 15:24:05Z jeffh $
Author:
  jeffh To change the template for this generated type comment go to Window>Preferences>Java>Code Generation>Code and Comments

Nested Class Summary
`class` | `PingManager.Envelope` Internal class which holds a pending datagram

Field Summary
`int` | `DATAGRAM_RECEIVE_BUFFER_SIZE` DESCRIBE THE FIELD
`int` | `DATAGRAM_SEND_BUFFER_SIZE` DESCRIBE THE FIELD
`static int` | `HEADER_SIZE` DESCRIBE THE FIELD
`protected java.util.WeakHashMap` | `lastPingTime` DESCRIBE THE FIELD
`int` | `MIN_RTT` DESCRIBE THE FIELD
`protected java.util.ArrayList` | `pendingMsgs` DESCRIBE THE FIELD
`static int` | `PING_THROTTLE` DESCRIBE THE FIELD
`protected java.util.WeakHashMap` | `pingListeners` DESCRIBE THE FIELD

Constructor Summary
`PingManager(SocketPastryNode spn, SocketSourceRouteManager manager, EpochInetSocketAddress bindAddress, EpochInetSocketAddress proxyAddress)`

Method Summary
`protected void` | `addPingResponseListener(SourceRoute path, PingResponseListener prl)` Adds a feature to the PingResponseListener attribute of the PingManager object
`SourceRoute` | `decodeHeader(byte[] header, int numAddresses)` Method which adds a header for the provided path to the given data.
`void` | `enqueue(SourceRoute path, PRawMessage msg)` DESCRIBE THE METHOD
`void` | `enqueue(SourceRoute path, SocketBuffer msg)` DESCRIBE THE METHOD
`void` | `modifyKey(java.nio.channels.SelectionKey key)` DESCRIBE THE METHOD
`protected void` | `notifyPingResponseListeners(SourceRoute path, int proximity, long lastTimePinged)` caller must synchronized(pingResponseTimes)
`protected void` | `ping(SourceRoute path, PingResponseListener prl)` Method which actually sends a ping to over the specified path, and returns the result to the specified listener.
`void` | `read(java.nio.channels.SelectionKey key)` DESCRIBE THE METHOD
`protected void` | `readHeader(java.net.InetSocketAddress address)` Method which processes an incoming message and hands it off to the appropriate handler.
`void` | `receiveMessage(SourceRoute sr, DatagramMessage dm, int size, SourceRoute fromPath)` DESCRIBE THE METHOD
`protected void` | `removePingResponseListener(SourceRoute path, PingResponseListener prl)` Adds a feature to the PingResponseListener attribute of the PingManager object
`protected void` | `resign()` Makes this node resign from the network.
`void` | `stall()` Internal testing method which simulates a stall.
`void` | `write(java.nio.channels.SelectionKey key)` DESCRIBE THE METHOD

Methods inherited from class rice.selector.SelectionKeyHandler
`accept, connect`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### DATAGRAM_RECEIVE_BUFFER_SIZE

    public final int DATAGRAM_RECEIVE_BUFFER_SIZE

  DESCRIBE THE FIELD

### DATAGRAM_SEND_BUFFER_SIZE

    public final int DATAGRAM_SEND_BUFFER_SIZE

  DESCRIBE THE FIELD

### MIN_RTT

    public final int MIN_RTT

  DESCRIBE THE FIELD

  See Also:
    Constant Field Values

### pingListeners

    protected java.util.WeakHashMap pingListeners

  DESCRIBE THE FIELD

### lastPingTime

    protected java.util.WeakHashMap lastPingTime

  DESCRIBE THE FIELD

### pendingMsgs

    protected java.util.ArrayList pendingMsgs

  DESCRIBE THE FIELD

### PING_THROTTLE

    public static final int PING_THROTTLE

  DESCRIBE THE FIELD

  See Also:
    Constant Field Values

### HEADER_SIZE

    public static int HEADER_SIZE

  DESCRIBE THE FIELD

Constructor Detail

### PingManager

    public PingManager(SocketPastryNode spn,
                       SocketSourceRouteManager manager,
                       EpochInetSocketAddress bindAddress,
                       EpochInetSocketAddress proxyAddress)
                throws java.io.IOException

Parameters:
  `spn` - DESCRIBE THE PARAMETER
  `manager` - DESCRIBE THE PARAMETER
  `bindAddress` - DESCRIBE THE PARAMETER
  `proxyAddress` - DESCRIBE THE PARAMETER
Throws:
  `java.io.IOException` - DESCRIBE THE EXCEPTION

Method Detail

### ping

    protected void ping(SourceRoute path,
                        PingResponseListener prl)

  Method which actually sends a ping to over the specified path, and returns the result to the specified listener. Note that if no ping response is ever received, the listener is never called.

  Parameters:
    `path` - The path to send the ping over
    `prl` - The listener which should hear about the response

### resign

    protected void resign()
                   throws java.io.IOException

  Makes this node resign from the network. Is designed to be used for debugging and testing.

  Throws:
    `java.io.IOException` - DESCRIBE THE EXCEPTION

### stall

    public void stall()

  Internal testing method which simulates a stall. DO NOT USE!!!!!

### removePingResponseListener

    protected void removePingResponseListener(SourceRoute path,
                                              PingResponseListener prl)

  Adds a feature to the PingResponseListener attribute of the PingManager object

  Parameters:
    `path` - Contains the PingResponseListener for PingResponseEvent data.
    `prl` - The feature to be added to the PingResponseListener attribute

### addPingResponseListener

    protected void addPingResponseListener(SourceRoute path,
                                           PingResponseListener prl)

  Adds a feature to the PingResponseListener attribute of the PingManager object

  Parameters:
    `path` - Contains the PingResponseListener for PingResponseEvent data.
    `prl` - The feature to be added to the PingResponseListener attribute

### notifyPingResponseListeners

    protected void notifyPingResponseListeners(SourceRoute path,
                                               int proximity,
                                               long lastTimePinged)

  caller must synchronized(pingResponseTimes)

  Parameters:
    `path` - DESCRIBE THE PARAMETER
    `proximity` -
    `lastTimePinged` -

### enqueue

    public void enqueue(SourceRoute path,
                        PRawMessage msg)

  DESCRIBE THE METHOD

  Parameters:
    `path` - DESCRIBE THE PARAMETER
    `msg` - DESCRIBE THE PARAMETER

### enqueue

    public void enqueue(SourceRoute path,
                        SocketBuffer msg)

  DESCRIBE THE METHOD

  Parameters:
    `path` - DESCRIBE THE PARAMETER
    `msg` - DESCRIBE THE PARAMETER

### receiveMessage

    public void receiveMessage(SourceRoute sr,
                               DatagramMessage dm,
                               int size,
                               SourceRoute fromPath)
                        throws java.io.IOException

  DESCRIBE THE METHOD

  Parameters:
    `sr` - DESCRIBE THE PARAMETER
    `dm` - DESCRIBE THE PARAMETER
    `size` - DESCRIBE THE PARAMETER
    `fromPath` - DESCRIBE THE PARAMETER
  Throws:
    `java.io.IOException` - DESCRIBE THE EXCEPTION

### read

    public void read(java.nio.channels.SelectionKey key)

  DESCRIBE THE METHOD

  Overrides:
    `read` in class `SelectionKeyHandler`
  Parameters:
    `key` - DESCRIBE THE PARAMETER

### write

    public void write(java.nio.channels.SelectionKey key)

  DESCRIBE THE METHOD

  Overrides:
    `write` in class `SelectionKeyHandler`
  Parameters:
    `key` - DESCRIBE THE PARAMETER

### modifyKey

    public void modifyKey(java.nio.channels.SelectionKey key)

  DESCRIBE THE METHOD

  Overrides:
    `modifyKey` in class `SelectionKeyHandler`
  Parameters:
    `key` - DESCRIBE THE PARAMETER

### decodeHeader

    public SourceRoute decodeHeader(byte[] header,
                                    int numAddresses)
                             throws java.io.IOException

  Method which adds a header for the provided path to the given data.

  Parameters:
    `header` - DESCRIBE THE PARAMETER
    `numAddresses` - DESCRIBE THE PARAMETER
  Returns:
    The messag with a header attached
  Throws:
    `java.io.IOException` - DESCRIBE THE EXCEPTION

### readHeader

    protected void readHeader(java.net.InetSocketAddress address)
                       throws java.io.IOException

  Method which processes an incoming message and hands it off to the appropriate handler.

  Parameters:
    `address` - DESCRIBE THE PARAMETER
  Throws:
    `java.io.IOException` - DESCRIBE THE EXCEPTION

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.