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.p2p.past.gc
Class GCEndpoint

    java.lang.Object
      rice.p2p.past.gc.GCEndpoint

All Implemented Interfaces:
  Endpoint, NodeHandleReader

    public class GCEndpoint

extends java.lang.Object
implements Endpoint

Version:
  $Id: GCEndpoint.java 3943 2007-11-06 17:26:40Z jeffh $
Author:
  Alan Mislove

Field Summary
`protected Endpoint` | `endpoint` The node which this mulitring node is wrapping

Constructor Summary
`protected` | `GCEndpoint(Endpoint endpoint)` Constructor

Method Summary
`void` | `accept(AppSocketReceiver receiver)` Set's the acceptor for this application.
`NodeHandle` | `coalesce(NodeHandle handle)`
`void` | `connect(NodeHandle handle, AppSocketReceiver receiver, int timeout)` Passthrough to the sub endpoint.
`MessageDeserializer` | `getDeserializer()` Returns the deserializer.
`Environment` | `getEnvironment()` Returns the environment.
`Id` | `getId()` Returns this node's id, which is its identifier in the namespace.
`java.lang.String` | `getInstance()` Returns a unique instance name of this endpoint, sort of a mailbox name for this application.
`NodeHandle` | `getLocalNodeHandle()` Returns a handle to the local node below this endpoint.
`NodeHandleSet` | `localLookup(Id id, int num, boolean safe)` This call produces a list of nodes that can be used as next hops on a route towards the given id, such that the resulting route satisfies the overlay protocol's bounds on the number of hops taken.
`NodeHandleSet` | `neighborSet(int num)` This methods returns an unordered set of nodehandles on which are neighbors of the local node in the id space.
`java.util.List` | `networkNeighbors(int num)` Returns an ordered list of the nearest known neighbors.
`void` | `process(Executable task, Continuation command)` Schedules a job for processing on the dedicated processing thread.
`int` | `proximity(NodeHandle nh)` This replaces NodeHandle.proximity(), so that you don't have to have a "coalesced" NodeHandle.
`IdRange` | `range(NodeHandle handle, int rank, Id lkey)` This operation provides information about ranges of keys for which the node is currently a rank-root.
`IdRange` | `range(NodeHandle handle, int rank, Id lkey, boolean cumulative)` This operation provides information about ranges of keys for which the node is currently a rank-root.
`Id` | `readId(InputBuffer buf, short type)` To use a more efficient serialization format than Java Serialization
`IdRange` | `readIdRange(InputBuffer buf)` To use Raw Serialization
`NodeHandle` | `readNodeHandle(InputBuffer buf)` To use Raw Serialization
`NodeHandleSet` | `readNodeHandleSet(InputBuffer buf, short type)`
`void` | `register()` Call this after you have set up your Endpoint: called setDeserializer(), called accept().
`NodeHandleSet` | `replicaSet(Id id, int maxRank)` This methods returns an ordered set of nodehandles on which replicas of an object with a given id can be stored.
`NodeHandleSet` | `replicaSet(Id id, int maxRank, NodeHandle root, NodeHandleSet set)` This methods returns an ordered set of nodehandles on which replicas of an object with a given id can be stored.
`MessageReceipt` | `route(Id id, Message message, NodeHandle hint)` This method makes an attempt to route the message to the root of the given id.
`MessageReceipt` | `route(Id id, Message message, NodeHandle hint, DeliveryNotification deliverAckToMe)`
`MessageReceipt` | `route(Id id, RawMessage message, NodeHandle hint)` Same as the other call, but uses the Raw serialization rather than java serialization.
`MessageReceipt` | `route(Id id, RawMessage message, NodeHandle hint, DeliveryNotification deliverAckToMe)`
`boolean` | `routingConsistentFor(Id id)` Can we guarantee that this id is currently ours, and routing will be consistent? Note that this has some real timing implications, so don't cache the returned value.
`CancellableTask` | `scheduleMessage(Message message, long delay)` Schedules a message to be delivered to this application after the provided number of milliseconds.
`CancellableTask` | `scheduleMessage(Message message, long delay, long period)` Schedules a message to be delivered to this application every period number of milliseconds, after delay number of miliseconds have passed.
`CancellableTask` | `scheduleMessageAtFixedRate(Message message, long delay, long period)` Schedules a message to be delivered to this application every period number of milliseconds, after delay number of miliseconds have passed.
`void` | `setConsistentRouting(boolean val)` default value is true Consistent routing causes RouteMessages to be dropped if we are not sure that we are responsible for our current id range.
`void` | `setDeserializer(MessageDeserializer md)` To use a more efficient serialization format than Java Serialization
`void` | `setSendOptions(java.util.Map<java.lang.String,java.lang.Object> options)` Uses these options as defaults.
`java.lang.String` | `toString()`

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

Field Detail

### endpoint

    protected Endpoint endpoint

  The node which this mulitring node is wrapping

Constructor Detail

### GCEndpoint

    protected GCEndpoint(Endpoint endpoint)

  Constructor

  Parameters:
    `node` - The node to base this node off of

Method Detail

### getId

    public Id getId()

  Returns this node's id, which is its identifier in the namespace.

  Specified by:
    `getId` in interface `Endpoint`
  Returns:
    The local node's id

### route

    public MessageReceipt route(Id id,
                                Message message,
                                NodeHandle hint)

  This method makes an attempt to route the message to the root of the given id. The hint handle will be the first hop in the route. If the id field is null, then the message is routed directly to the given node, and delivers the message there. If the hint field is null, then this method makes an attempt to route the message to the root of the given id. Note that one of the id and hint fields can be null, but not both.

  Specified by:
    `route` in interface `Endpoint`
  Parameters:
    `id` - The destination Id of the message.
    `message` - The message to deliver
    `hint` - The first node to send this message to, optional

### route

    public MessageReceipt route(Id id,
                                RawMessage message,
                                NodeHandle hint)

  Description copied from interface: `Endpoint`
  Same as the other call, but uses the Raw serialization rather than java serialization.

  Specified by:
    `route` in interface `Endpoint`

### route

    public MessageReceipt route(Id id,
                                Message message,
                                NodeHandle hint,
                                DeliveryNotification deliverAckToMe)

  Specified by:
    `route` in interface `Endpoint`

### route

    public MessageReceipt route(Id id,
                                RawMessage message,
                                NodeHandle hint,
                                DeliveryNotification deliverAckToMe)

  Specified by:
    `route` in interface `Endpoint`

### localLookup

    public NodeHandleSet localLookup(Id id,
                                     int num,
                                     boolean safe)

  This call produces a list of nodes that can be used as next hops on a route towards the given id, such that the resulting route satisfies the overlay protocol's bounds on the number of hops taken. If the safe flag is specified, then the fraction of faulty nodes returned is no higher than the fraction of faulty nodes in the overlay.

  Specified by:
    `localLookup` in interface `Endpoint`
  Parameters:
    `id` - The destination id.
    `num` - The number of nodes to return.
    `safe` - Whether or not to return safe nodes.

### neighborSet

    public NodeHandleSet neighborSet(int num)

  This methods returns an unordered set of nodehandles on which are neighbors of the local node in the id space. Up to num handles are returned.

  Specified by:
    `neighborSet` in interface `Endpoint`
  Parameters:
    `num` - The number of desired handle to return.

### replicaSet

    public NodeHandleSet replicaSet(Id id,
                                    int maxRank)

  This methods returns an ordered set of nodehandles on which replicas of an object with a given id can be stored. The call returns nodes up to and including a node with maxRank.

  Specified by:
    `replicaSet` in interface `Endpoint`
  Parameters:
    `id` - The object's id.
    `maxRank` - The number of desired replicas.

### replicaSet

    public NodeHandleSet replicaSet(Id id,
                                    int maxRank,
                                    NodeHandle root,
                                    NodeHandleSet set)

  This methods returns an ordered set of nodehandles on which replicas of an object with a given id can be stored. The call returns nodes up to and including a node with maxRank. This call also allows the application to provide a remove "center" node, as well as other nodes in the vicinity.

  Specified by:
    `replicaSet` in interface `Endpoint`
  Parameters:
    `id` - The object's id.
    `maxRank` - The number of desired replicas.
    `handle` - The root handle of the remove set
    `set` - The set of other nodes around the root handle

### range

    public IdRange range(NodeHandle handle,
                         int rank,
                         Id lkey)

  This operation provides information about ranges of keys for which the node is currently a rank-root. The operations returns null if the range could not be determined, the range otherwise. It is an error to query the range of a node not present in the neighbor set as returned bythe update upcall or the neighborSet call. Certain implementations may return an error if rank is greater than zero. Some protocols may have multiple, disjoint ranges of keys for which a given node is responsible. The parameter lkey allows the caller to specify which region should be returned. If the node referenced by is responsible for key lkey, then the resulting range includes lkey. Otherwise, the result is the nearest range clockwise from lkey for which is responsible.

  Specified by:
    `range` in interface `Endpoint`
  Parameters:
    `handle` - The handle whose range to check.
    `rank` - The root rank.
    `lkey` - An "index" in case of multiple ranges.

### range

    public IdRange range(NodeHandle handle,
                         int rank,
                         Id lkey,
                         boolean cumulative)

  This operation provides information about ranges of keys for which the node is currently a rank-root. The operations returns null if the range could not be determined, the range otherwise. It is an error to query the range of a node not present in the neighbor set as returned bythe update upcall or the neighborSet call. Certain implementations may return an error if rank is greater than zero. Some protocols may have multiple, disjoint ranges of keys for which a given node is responsible. The parameter lkey allows the caller to specify which region should be returned. If the node referenced by is responsible for key lkey, then the resulting range includes lkey. Otherwise, the result is the nearest range clockwise from lkey for which is responsible.

  Specified by:
    `range` in interface `Endpoint`
  Parameters:
    `handle` - The handle whose range to check.
    `rank` - The root rank.
    `lkey` - An "index" in case of multiple ranges.
    `cumulative` - Whether to return the cumulative or single range

### getLocalNodeHandle

    public NodeHandle getLocalNodeHandle()

  Returns a handle to the local node below this endpoint. This node handle is serializable, and can therefore be sent to other nodes in the network and still be valid.

  Specified by:
    `getLocalNodeHandle` in interface `Endpoint`
  Returns:
    A NodeHandle referring to the local node.

### networkNeighbors

    public java.util.List networkNeighbors(int num)

  Description copied from interface: `Endpoint`
  Returns an ordered list of the nearest known neighbors. Note that proximity is usually an estimate, and can quickly become stale.

  Specified by:
    `networkNeighbors` in interface `Endpoint`
  Returns:
    List of NodeHandle

### scheduleMessage

    public CancellableTask scheduleMessage(Message message,
                                           long delay)

  Schedules a message to be delivered to this application after the provided number of milliseconds.

  Specified by:
    `scheduleMessage` in interface `Endpoint`
  Parameters:
    `message` - The message to be delivered
    `delay` - The number of milliseconds to wait before delivering the message

### scheduleMessage

    public CancellableTask scheduleMessage(Message message,
                                           long delay,
                                           long period)

  Schedules a message to be delivered to this application every period number of milliseconds, after delay number of miliseconds have passed.

  Specified by:
    `scheduleMessage` in interface `Endpoint`
  Parameters:
    `message` - The message to be delivered
    `delay` - The number of milliseconds to wait before delivering the fist message
    `delay` - The number of milliseconds to wait before delivering subsequent messages

### scheduleMessageAtFixedRate

    public CancellableTask scheduleMessageAtFixedRate(Message message,
                                                      long delay,
                                                      long period)

  Description copied from interface: `Endpoint`
  Schedules a message to be delivered to this application every period number of milliseconds, after delay number of miliseconds have passed.

  Specified by:
    `scheduleMessageAtFixedRate` in interface `Endpoint`
  Parameters:
    `message` - The message to be delivered
    `delay` - The number of milliseconds to wait before delivering the fist message

### process

    public void process(Executable task,
                        Continuation command)

  Schedules a job for processing on the dedicated processing thread. CPU intensive jobs, such as encryption, erasure encoding, or bloom filter creation should never be done in the context of the underlying node's thread, and should only be done via this method.

  Specified by:
    `process` in interface `Endpoint`
  Parameters:
    `task` - The task to run on the processing thread
    `command` - The command to return the result to once it's done

### getInstance

    public java.lang.String getInstance()

  Returns a unique instance name of this endpoint, sort of a mailbox name for this application.

  Specified by:
    `getInstance` in interface `Endpoint`
  Returns:
    The unique instance name of this application

### getEnvironment

    public Environment getEnvironment()

  Description copied from interface: `Endpoint`
  Returns the environment. This allows the nodes to be virtualized within the JVM

  Specified by:
    `getEnvironment` in interface `Endpoint`
  Returns:
    the environment for this node/app.

### connect

    public void connect(NodeHandle handle,
                        AppSocketReceiver receiver,
                        int timeout)

  Passthrough to the sub endpoint.

  Specified by:
    `connect` in interface `Endpoint`
    `receiver` - calls receiveSocket() when a new AppSocket is opened to this application on a remote node.

### accept

    public void accept(AppSocketReceiver receiver)

  Description copied from interface: `Endpoint`
  Set's the acceptor for this application. If no acceptor is set, then when a remote node's application opens a socket here, they will get an *Exception*

  Specified by:
    `accept` in interface `Endpoint`
  Parameters:
    `receiver` - calls receiveSocket() when a new AppSocket is opened to this application from a remote node. Note that you must call accept() again after each socket is received to properly handle socket backlogging

### setDeserializer

    public void setDeserializer(MessageDeserializer md)

  Description copied from interface: `Endpoint`
  To use a more efficient serialization format than Java Serialization

  Specified by:
    `setDeserializer` in interface `Endpoint`

### getDeserializer

    public MessageDeserializer getDeserializer()

  Description copied from interface: `Endpoint`
  Returns the deserializer. The default deserializer can deserialize rice.p2p.util.JavaSerializedMessage

  Specified by:
    `getDeserializer` in interface `Endpoint`
  Returns:

### readId

    public Id readId(InputBuffer buf,
                     short type)
              throws java.io.IOException

  Description copied from interface: `Endpoint`
  To use a more efficient serialization format than Java Serialization

  Specified by:
    `readId` in interface `Endpoint`
  Throws:
    `java.io.IOException`

### readNodeHandle

    public NodeHandle readNodeHandle(InputBuffer buf)
                              throws java.io.IOException

  Description copied from interface: `NodeHandleReader`
  To use Raw Serialization

  Specified by:
    `readNodeHandle` in interface `NodeHandleReader`
  Returns:
  Throws:
    `java.io.IOException`

### readIdRange

    public IdRange readIdRange(InputBuffer buf)
                        throws java.io.IOException

  Description copied from interface: `Endpoint`
  To use Raw Serialization

  Specified by:
    `readIdRange` in interface `Endpoint`
  Returns:
  Throws:
    `java.io.IOException`

### coalesce

    public NodeHandle coalesce(NodeHandle handle)

  Specified by:
    `coalesce` in interface `NodeHandleReader`

### readNodeHandleSet

    public NodeHandleSet readNodeHandleSet(InputBuffer buf,
                                           short type)
                                    throws java.io.IOException

  Specified by:
    `readNodeHandleSet` in interface `Endpoint`
  Throws:
    `java.io.IOException`

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

### register

    public void register()

  Description copied from interface: `Endpoint`
  Call this after you have set up your Endpoint: called setDeserializer(), called accept().

  Specified by:
    `register` in interface `Endpoint`

### proximity

    public int proximity(NodeHandle nh)

  Description copied from interface: `Endpoint`
  This replaces NodeHandle.proximity(), so that you don't have to have a "coalesced" NodeHandle.

  Specified by:
    `proximity` in interface `Endpoint`
  Returns:

### setConsistentRouting

    public void setConsistentRouting(boolean val)

  Description copied from interface: `Endpoint`
  default value is true Consistent routing causes RouteMessages to be dropped if we are not sure that we are responsible for our current id range. If you set this to false, you will be delivered messages to forward() and deliver() even if there is possible inconsistent routing. (The overlay still does it's best to deliver the RouteMessage to the proper key, but some protocols can guarantee consistency, for example by using leases between nodes) Note that when true, the overlay never purposely drops messages routed with a null key: endpoint.deliver(null, msg, targetNodeHandle) // will be delivered regardless of consistency

  Specified by:
    `setConsistentRouting` in interface `Endpoint`

### routingConsistentFor

    public boolean routingConsistentFor(Id id)

  Description copied from interface: `Endpoint`
  Can we guarantee that this id is currently ours, and routing will be consistent? Note that this has some real timing implications, so don't cache the returned value. Note that it will always return always returns false if you are not the root of the id.

  Specified by:
    `routingConsistentFor` in interface `Endpoint`
  Returns:
    true if routing consistency can currently be guaranteed for this

### setSendOptions

    public void setSendOptions(java.util.Map<java.lang.String,java.lang.Object> options)

  Description copied from interface: `Endpoint`
  Uses these options as defaults.

  Specified by:
    `setSendOptions` in interface `Endpoint`

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.