|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.netty.channel.SimpleChannelHandler
net.tomp2p.connection.DispatcherReply
@ChannelHandler.Sharable public class DispatcherReply
Used to deliver incoming REQUEST messages to their specific handlers. You can register handlers using the
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!
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.jboss.netty.channel.ChannelHandler |
---|
org.jboss.netty.channel.ChannelHandler.Sharable |
Constructor Summary | |
---|---|
DispatcherReply(int p2pID,
PeerBean peerBean,
ConnectionConfiguration configuration,
org.jboss.netty.channel.group.ChannelGroup channelGroup,
PeerMap peerMap)
Constructor |
Method Summary | |
---|---|
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(Number160 localPeerId,
ReplyHandler ioHandler,
Message.Command... names)
Registers a handler with this dispatcher. |
void |
removeIoHandler(Number160 localPeerId)
If we shutdown, we remove the handlers. |
Methods inherited from class org.jboss.netty.channel.SimpleChannelHandler |
---|
bindRequested, channelBound, channelClosed, channelConnected, channelDisconnected, channelInterestChanged, channelUnbound, childChannelClosed, childChannelOpen, closeRequested, connectRequested, disconnectRequested, handleDownstream, handleUpstream, setInterestOpsRequested, unbindRequested, writeComplete, writeRequested |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DispatcherReply(int p2pID, PeerBean peerBean, ConnectionConfiguration configuration, org.jboss.netty.channel.group.ChannelGroup channelGroup, PeerMap peerMap)
p2pID
- the p2p ID the dispatcher is looking for in messagesrouting
- Method Detail |
---|
public void registerIoHandler(Number160 localPeerId, 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 localPeerId)
id
- The Id of the peer to remove the handlers.public void channelOpen(org.jboss.netty.channel.ChannelHandlerContext ctx, org.jboss.netty.channel.ChannelStateEvent e) throws Exception
channelOpen
in class org.jboss.netty.channel.SimpleChannelHandler
Exception
public void exceptionCaught(org.jboss.netty.channel.ChannelHandlerContext ctx, org.jboss.netty.channel.ExceptionEvent e)
exceptionCaught
in class org.jboss.netty.channel.SimpleChannelHandler
public void messageReceived(org.jboss.netty.channel.ChannelHandlerContext ctx, org.jboss.netty.channel.MessageEvent e) throws Exception
messageReceived
in class org.jboss.netty.channel.SimpleChannelHandler
Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |