org.planx.routing.kademlia.operation
Class AbstractNodeLookupOperation<E>

java.lang.Object
  extended by org.planx.routing.kademlia.operation.AbstractNodeLookupOperation<E>
All Implemented Interfaces:
Operation<E>, Receiver
Direct Known Subclasses:
DataLookupOperation, NodeLookupOperation

public abstract class AbstractNodeLookupOperation<E>
extends Object
implements Operation<E>, Receiver

Finds the K closest nodes to a specified identifier. The algorithm terminates when the operation has gotten responses from the K closest nodes it has seen. Nodes that fail to respond are removed from consideration. This is just for code reuse between DataLookupOperation and NodeLookupOperation.

Author:
Thomas Ambus

Constructor Summary
AbstractNodeLookupOperation(Configuration conf, MessageServer server, Space space, Node local, Identifier id)
          Create a NodeLookupOperation for the specified id.
 
Method Summary
abstract  E execute()
          Starts the operation and returns when the operation is finished.
 void receive(Message incoming, int comm)
          Receives an incoming NodeReplyMessage.
 void timeout(int comm)
          A node does not respond or a packet was lost.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractNodeLookupOperation

public AbstractNodeLookupOperation(Configuration conf,
                                   MessageServer server,
                                   Space space,
                                   Node local,
                                   Identifier id)
Create a NodeLookupOperation for the specified id.

Method Detail

execute

public abstract E execute()
                   throws IOException,
                          RoutingException
Description copied from interface: Operation
Starts the operation and returns when the operation is finished.

Specified by:
execute in interface Operation<E>
Throws:
IOException
RoutingException

receive

public void receive(Message incoming,
                    int comm)
             throws IOException
Receives an incoming NodeReplyMessage.

Specified by:
receive in interface Receiver
Throws:
IOException - if an I/O error occurs

timeout

public void timeout(int comm)
             throws IOException
A node does not respond or a packet was lost.

Specified by:
timeout in interface Receiver
Throws:
IOException - if an I/O error occurs


Copyright © 2004-2005 Plan-X. All Rights Reserved.