@ChannelHandler.Sharable
public class DispatcherReply
extends org.jboss.netty.channel.SimpleChannelHandler
registerIoHandler function.
You probably want to add an instance of this class to the end of a pipeline to be able to receive messages. This class is able to cover several channels but only one P2P network!
| Constructor and Description |
|---|
DispatcherReply(int p2pID,
PeerBean peerBean,
int timeoutUPDMillis,
int timeoutTCPMillis,
org.jboss.netty.channel.group.ChannelGroup channelGroup,
PeerMap peerMap,
List<PeerListener> listeners)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
channelOpen(org.jboss.netty.channel.ChannelHandlerContext ctx,
org.jboss.netty.channel.ChannelStateEvent e) |
void |
exceptionCaught(org.jboss.netty.channel.ChannelHandlerContext ctx,
org.jboss.netty.channel.ExceptionEvent e)
Called if we get an exception
|
void |
messageReceived(org.jboss.netty.channel.ChannelHandlerContext ctx,
org.jboss.netty.channel.MessageEvent e)
Called if we get a message
|
void |
registerIoHandler(PeerAddress sender,
ReplyHandler ioHandler,
Message.Command... names)
Registers a handler with this dispatcher.
|
void |
removeIoHandler(Number160... ids) |
bindRequested, channelBound, channelClosed, channelConnected, channelDisconnected, channelInterestChanged, channelUnbound, childChannelClosed, childChannelOpen, closeRequested, connectRequested, disconnectRequested, handleDownstream, handleUpstream, setInterestOpsRequested, unbindRequested, writeComplete, writeRequestedpublic DispatcherReply(int p2pID,
PeerBean peerBean,
int timeoutUPDMillis,
int timeoutTCPMillis,
org.jboss.netty.channel.group.ChannelGroup channelGroup,
PeerMap peerMap,
List<PeerListener> listeners)
p2pID - the p2p ID the dispatcher is looking for in messagesrouting - public void registerIoHandler(PeerAddress sender, ReplyHandler ioHandler, Message.Command... names)
sender - Specifies the receiver the dispatcher filters for. This
allows to use one dispatcher for several interfaces or even nodes.
TODO: why call it sender here if it really acts as receiver?name - The command of the Message the given handler
processes. All messages having that command will be forwarded to
the given handler.ioHandler - the handler which should process the given type of
messagespublic void removeIoHandler(Number160... ids)
public void channelOpen(org.jboss.netty.channel.ChannelHandlerContext ctx,
org.jboss.netty.channel.ChannelStateEvent e)
throws Exception
channelOpen in class org.jboss.netty.channel.SimpleChannelHandlerExceptionpublic void exceptionCaught(org.jboss.netty.channel.ChannelHandlerContext ctx,
org.jboss.netty.channel.ExceptionEvent e)
exceptionCaught in class org.jboss.netty.channel.SimpleChannelHandlerCopyright © 2011. All Rights Reserved.