net.tomp2p.rpc
Class TaskRPC

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

public class TaskRPC
extends ReplyHandler


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.jboss.netty.channel.ChannelHandler
org.jboss.netty.channel.ChannelHandler.Sharable
 
Constructor Summary
TaskRPC(PeerBean peerBean, ConnectionBean connectionBean)
           
 
Method Summary
 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.
 FutureResponse sendResult(PeerAddress remotePeer, ChannelCreator channelCreator, Number160 taskID, Map<Number160,Data> dataMap, KeyPair keyPair, boolean forceUDP, boolean sign)
           
 FutureResponse sendTask(PeerAddress remotePeer, ChannelCreator channelCreator, Number160 taskID, Map<Number160,Data> dataMap, Worker mapper, KeyPair keyPair, boolean forceUDP, boolean sign)
          Sends a task to a remote peer.
 FutureResponse taskStatus(PeerAddress remotePeer, ChannelCreator channelCreator, Collection<Number160> taskIDs, boolean forceTCP)
           
 
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
 

Constructor Detail

TaskRPC

public TaskRPC(PeerBean peerBean,
               ConnectionBean connectionBean)
Method Detail

sendTask

public FutureResponse sendTask(PeerAddress remotePeer,
                               ChannelCreator channelCreator,
                               Number160 taskID,
                               Map<Number160,Data> dataMap,
                               Worker mapper,
                               KeyPair keyPair,
                               boolean forceUDP,
                               boolean sign)
Sends a task to a remote peer. This is an RPC.

Parameters:
remotePeer - The remote peer to send this request
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

sendResult

public FutureResponse sendResult(PeerAddress remotePeer,
                                 ChannelCreator channelCreator,
                                 Number160 taskID,
                                 Map<Number160,Data> dataMap,
                                 KeyPair keyPair,
                                 boolean forceUDP,
                                 boolean sign)

taskStatus

public FutureResponse taskStatus(PeerAddress remotePeer,
                                 ChannelCreator channelCreator,
                                 Collection<Number160> taskIDs,
                                 boolean forceTCP)

handleResponse

public Message handleResponse(Message message,
                              boolean sign)
                       throws Exception
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:
Exception


Copyright © 2013. All Rights Reserved.