net.tomp2p.rpc
Class DirectDataRPC
java.lang.Object
org.jboss.netty.channel.SimpleChannelHandler
net.tomp2p.rpc.ReplyHandler
net.tomp2p.rpc.DirectDataRPC
- All Implemented Interfaces:
- org.jboss.netty.channel.ChannelDownstreamHandler, org.jboss.netty.channel.ChannelHandler, org.jboss.netty.channel.ChannelUpstreamHandler
public class DirectDataRPC
- extends ReplyHandler
Nested classes/interfaces inherited from interface org.jboss.netty.channel.ChannelHandler |
org.jboss.netty.channel.ChannelHandler.Sharable |
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. |
boolean |
hasObjectDataReply()
|
boolean |
hasRawDataReply()
|
RequestHandlerTCP<FutureResponse> |
prepareSend(PeerAddress remotePeer,
org.jboss.netty.buffer.ChannelBuffer buffer,
boolean raw)
Prepares for sending to a remote peer. |
FutureResponse |
send(PeerAddress remotePeer,
org.jboss.netty.buffer.ChannelBuffer buffer,
boolean raw,
ChannelCreator channelCreator,
boolean forceUDP)
|
FutureResponse |
send(PeerAddress remotePeer,
org.jboss.netty.buffer.ChannelBuffer buffer,
boolean raw,
ChannelCreator channelCreator,
int idleTCPMillis,
boolean forceUDP)
Send data directly to a peer. |
void |
setReply(ObjectDataReply objectDataReply)
|
void |
setReply(RawDataReply rawDataReply)
|
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 |
DirectDataRPC
public DirectDataRPC(PeerBean peerBean,
ConnectionBean connectionBean)
send
public FutureResponse send(PeerAddress remotePeer,
org.jboss.netty.buffer.ChannelBuffer buffer,
boolean raw,
ChannelCreator channelCreator,
boolean forceUDP)
send
public FutureResponse send(PeerAddress remotePeer,
org.jboss.netty.buffer.ChannelBuffer buffer,
boolean raw,
ChannelCreator channelCreator,
int idleTCPMillis,
boolean forceUDP)
- Send data directly to a peer. Make sure you have set up a reply handler. This is an RPC.
- Parameters:
remotePeer
- The remote peer to store the databuffer
- The data to send to the remote peerraw
- Set to true if a the byte array is expected or if it should be converted to an objectchannelCreator
- The channel creatoridleTCPMillis
- Set the timeout when a connection is considered inactive (idle)forceUDP
- Set to true if the communication should be UDP, default is TCP
- Returns:
- FutureResponse that stores which content keys have been stored.
prepareSend
public RequestHandlerTCP<FutureResponse> prepareSend(PeerAddress remotePeer,
org.jboss.netty.buffer.ChannelBuffer buffer,
boolean raw)
- Prepares for sending to a remote peer.
- Parameters:
remotePeer
- The remote peer to store the databuffer
- The data to send to the remote peerraw
- Set to true if a the byte array is expected or if it should be converted to an object
- Returns:
- The request handler that sends with TCP
setReply
public void setReply(RawDataReply rawDataReply)
setReply
public void setReply(ObjectDataReply objectDataReply)
hasRawDataReply
public boolean hasRawDataReply()
hasObjectDataReply
public boolean hasObjectDataReply()
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.