net.tomp2p.rpc
Class NeighborRPC

java.lang.Object
  extended by org.jboss.netty.channel.SimpleChannelHandler
      extended by net.tomp2p.rpc.ReplyHandler
          extended by net.tomp2p.rpc.NeighborRPC
All Implemented Interfaces:
org.jboss.netty.channel.ChannelDownstreamHandler, org.jboss.netty.channel.ChannelHandler, org.jboss.netty.channel.ChannelUpstreamHandler

public class NeighborRPC
extends ReplyHandler


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.jboss.netty.channel.ChannelHandler
org.jboss.netty.channel.ChannelHandler.Sharable
 
Field Summary
static int NEIGHBOR_SIZE
           
 
Constructor Summary
NeighborRPC(PeerBean peerBean, ConnectionBean connectionBean)
           
 
Method Summary
 FutureResponse closeNeighbors(PeerAddress remotePeer, Number160 locationKey, Number160 domainKey, Collection<Number160> contentKeys, Message.Type type, ChannelCreator channelCreator, boolean forceTCP)
          Requests close neighbors from the remote peer.
 Message handleResponse(Message message, boolean sign)
          If the message is OK, that has been previously checked by the user using checkMessage, a reply to the message is generated here.
 
Methods inherited from class net.tomp2p.rpc.ReplyHandler
createMessage, createResponseMessage, exceptionCaught, forwardMessage, getConnectionBean, getPeerBean, registerIoHandler, setSignReply
 
Methods inherited from class org.jboss.netty.channel.SimpleChannelHandler
bindRequested, channelBound, channelClosed, channelConnected, channelDisconnected, channelInterestChanged, channelOpen, channelUnbound, childChannelClosed, childChannelOpen, closeRequested, connectRequested, disconnectRequested, handleDownstream, handleUpstream, messageReceived, setInterestOpsRequested, unbindRequested, writeComplete, writeRequested
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NEIGHBOR_SIZE

public static final int NEIGHBOR_SIZE
See Also:
Constant Field Values
Constructor Detail

NeighborRPC

public NeighborRPC(PeerBean peerBean,
                   ConnectionBean connectionBean)
Method Detail

closeNeighbors

public FutureResponse closeNeighbors(PeerAddress remotePeer,
                                     Number160 locationKey,
                                     Number160 domainKey,
                                     Collection<Number160> contentKeys,
                                     Message.Type type,
                                     ChannelCreator channelCreator,
                                     boolean forceTCP)
Requests close neighbors from the remote peer. The remote peer may idicate if the data is present on that peer. This is an RPC.

Parameters:
remotePeer - The remote peer to send this request
locationKey - The location key
domainKey - The domain key
contentKeys - For get() and remove() one can provide the content keys and the remote peer indicates if those keys are on that peer.
type - The type of the neigbor request:
  • REQUEST_1 for NEIGHBORS means check for put (no digest) for tracker and storage
  • REQUEST_2 for NEIGHBORS means check for get (with digest) for storage
  • REQUEST_3 for NEIGHBORS means check for get (with digest) for tracker
  • REQUEST_4 for NEIGHBORS means check for put (with digest) for task
isDigest - Set to true to return a digest of the remote content
channelCreator - The channel creator that creates connections
forceTCP - Set to true if the communication should be TCP, default is UDP
Returns:
The future response to keep track of future events

handleResponse

public Message handleResponse(Message message,
                              boolean sign)
                       throws IOException
Description copied from class: ReplyHandler
If the message is OK, that has been previously checked by the user using checkMessage, a reply to the message is generated here.

Specified by:
handleResponse in class ReplyHandler
Parameters:
message - Request message
Throws:
IOException


Copyright © 2013. All Rights Reserved.