org.planx.routing.kademlia.operation
Class DataLookupOperation

java.lang.Object
  extended by org.planx.routing.kademlia.operation.AbstractNodeLookupOperation<Serializable>
      extended by org.planx.routing.kademlia.operation.DataLookupOperation
All Implemented Interfaces:
Operation<Serializable>, Receiver

public class DataLookupOperation
extends AbstractNodeLookupOperation<Serializable>
implements Operation<Serializable>, Receiver

Looks up the specified identifier and returns the value associated with it. It is not checked if the data is available in the local IdentifierMap, so this should be checked before this operation is executed. The subclassing is merely for code reuse.


Constructor Summary
DataLookupOperation(Configuration conf, MessageServer server, Space space, Node local, Identifier id)
           
 
Method Summary
 Serializable execute()
          Starts the operation and returns when the operation is finished.
 void receive(Message incoming, int comm)
          Once a DataMessage is received the algorithm terminates.
 
Methods inherited from class org.planx.routing.kademlia.operation.AbstractNodeLookupOperation
timeout
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.planx.routing.messaging.Receiver
timeout
 

Constructor Detail

DataLookupOperation

public DataLookupOperation(Configuration conf,
                           MessageServer server,
                           Space space,
                           Node local,
                           Identifier id)
Method Detail

execute

public Serializable 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<Serializable>
Specified by:
execute in class AbstractNodeLookupOperation<Serializable>
Returns:
The value associated with the key or null if no mapping with the specified key could be found.
Throws:
RoutingException - If the lookup operation timed out
IOException - If a network error occurred

receive

public void receive(Message incoming,
                    int comm)
             throws IOException
Once a DataMessage is received the algorithm terminates. If a NodeReplyMessage is received the algorithm continues as by the superclass.

Specified by:
receive in interface Receiver
Overrides:
receive in class AbstractNodeLookupOperation<Serializable>
Throws:
IOException - if an I/O error occurs


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