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 SocketCollectionManager.SourceRouteManager

    java.lang.Object
      rice.selector.SelectionKeyHandler
          rice.pastry.socket.SocketCollectionManager.SourceRouteManager

Enclosing class:
  SocketCollectionManager

protected class SocketCollectionManager.SourceRouteManager
extends SelectionKeyHandler

Private class which is tasked with maintaining a source route which goes through this node. This class maintains to sockets, and transfers the data between them. It also is responsible for performing the initial handshake and sending the data across the wire.

Version:
  $Id: SocketCollectionManager.java 2870 2005-12-21 15:07:14Z jeffh $
Author:
  jeffh

Constructor Summary
`SocketCollectionManager.SourceRouteManager(java.nio.channels.SelectionKey key)` Constructor which accepts an incoming connection, represented by the selection key.

Method Summary
`protected void` | `acceptConnection(java.nio.channels.SelectionKey key)` Accepts a new connection on the given key
`protected void` | `addInterestOp(java.nio.channels.SelectableChannel channel, int op)` Internal method which adds an interest op to the given channel's interest set.
`void` | `close()` Method which closes down this socket manager, by closing the socket, cancelling the key and setting the key to be interested in nothing
`void` | `connect(java.nio.channels.SelectionKey key)` Specified by the SelectionKeyHandler interface - calling this tells this socket manager that the connection has completed and we can now read/write.
`protected void` | `createConnection(EpochInetSocketAddress address)` Creates the outgoing socket to the remote handle
`void` | `read(java.nio.channels.SelectionKey key)` Reads from the socket attached to this connector.
`protected void` | `removeInterestOp(java.nio.channels.SelectableChannel channel, int op)` Internal method which removes an interest op to the given key's interest set.
`void` | `shutdown(java.nio.channels.SocketChannel channel)` Method which initiates a shutdown of this socket by calling shutdownOutput().
`java.lang.String` | `toString()` DESCRIBE THE METHOD
`void` | `write(java.nio.channels.SelectionKey key)` Writes to the socket attached to this socket manager.

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

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

Constructor Detail

### SocketCollectionManager.SourceRouteManager

    public SocketCollectionManager.SourceRouteManager(java.nio.channels.SelectionKey key)
                                               throws java.io.IOException

  Constructor which accepts an incoming connection, represented by the selection key. This constructor builds a new IntermediateSourceRouteManager, and waits until the greeting message is read from the other end. Once the greeting is received, the manager makes sure that a socket for this handle is not already open, and then proceeds as normal.

Parameters:
  `key` - The server accepting key for the channel
Throws:
  `java.io.IOException` - DESCRIBE THE EXCEPTION

Method Detail

### addInterestOp

    protected void addInterestOp(java.nio.channels.SelectableChannel channel,
                                 int op)
                          throws java.io.IOException

  Internal method which adds an interest op to the given channel's interest set. One should note that if the passed in key is null, it will determine which channel this is the key for, and then rebuild a key for that channel.

  Parameters:
    `channel` - The channel
    `op` - The operation to add to the key's interest set
  Throws:
    `java.io.IOException` - DESCRIBE THE EXCEPTION

### removeInterestOp

    protected void removeInterestOp(java.nio.channels.SelectableChannel channel,
                                    int op)
                             throws java.io.IOException

  Internal method which removes an interest op to the given key's interest set. One should note that if the passed in key no longer has any interest ops, it is cancelled, removed from the selector's key set, and the corresponding key is set to null in this class.

  Parameters:
    `channel` - The channel
    `op` - The operation to remove from the key's interest set
  Throws:
    `java.io.IOException` - DESCRIBE THE EXCEPTION

### shutdown

    public void shutdown(java.nio.channels.SocketChannel channel)

  Method which initiates a shutdown of this socket by calling shutdownOutput(). This has the effect of removing the manager from the open list.

  Parameters:
    `channel` - DESCRIBE THE PARAMETER

### close

    public void close()

  Method which closes down this socket manager, by closing the socket, cancelling the key and setting the key to be interested in nothing

### connect

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

  Specified by the SelectionKeyHandler interface - calling this tells this socket manager that the connection has completed and we can now read/write.

  Overrides:
    `connect` in class `SelectionKeyHandler`
  Parameters:
    `key` - The key which is connectable.

### read

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

  Reads from the socket attached to this connector.

  Overrides:
    `read` in class `SelectionKeyHandler`
  Parameters:
    `key` - The selection key for this manager

### write

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

  Writes to the socket attached to this socket manager.

  Overrides:
    `write` in class `SelectionKeyHandler`
  Parameters:
    `key` - The selection key for this manager

### acceptConnection

    protected void acceptConnection(java.nio.channels.SelectionKey key)
                             throws java.io.IOException

  Accepts a new connection on the given key

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

### createConnection

    protected void createConnection(EpochInetSocketAddress address)
                             throws java.io.IOException

  Creates the outgoing socket to the remote handle

  Parameters:
    `address` - The accress to connect to
  Throws:
    `java.io.IOException` - DESCRIBE THE EXCEPTION

### toString

    public java.lang.String toString()

  DESCRIBE THE METHOD

  Returns:
    DESCRIBE THE RETURN VALUE

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.