Class NettyProtocol
- java.lang.Object
-
- org.apache.hugegraph.computer.core.network.netty.NettyProtocol
-
public class NettyProtocol extends java.lang.ObjectDefines the server and client channel handlers, i.e. the protocol.
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.StringCLIENT_HANDLER_NAMEprotected static java.lang.StringSERVER_HANDLER_NAME
-
Constructor Summary
Constructors Constructor Description NettyProtocol(TransportConf conf)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidinitializeClientPipeline(io.netty.channel.Channel channel)Initialize the client channel handlers.protected voidinitializeServerPipeline(io.netty.channel.Channel channel, MessageHandler handler)Initialize the server channel handlers.protected voidreplaceClientHandler(io.netty.channel.Channel channel, NettyTransportClient client)
-
-
-
Field Detail
-
CLIENT_HANDLER_NAME
protected static final java.lang.String CLIENT_HANDLER_NAME
- See Also:
- Constant Field Values
-
SERVER_HANDLER_NAME
protected static final java.lang.String SERVER_HANDLER_NAME
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
NettyProtocol
public NettyProtocol(TransportConf conf)
-
-
Method Detail
-
initializeServerPipeline
protected void initializeServerPipeline(io.netty.channel.Channel channel, MessageHandler handler)Initialize the server channel handlers.+----------------------+ | File / Local Buffer | +-----------+----------+ /|\ (2) zero-copy +---------------+---------------------------------------------------+ | | SERVER CHANNEL PIPELINE | | | | | +----------+----------+ (3)write ack +----------------------+ | | | ServerHandler |------------->| MessageEncoder | | | +----------+----------+ +-----------+----------+ | | /|\ \|/ | | | | | | +----------+----------+ | | | | MessageDecoder | | | | +----------+----------+ | | | /|\ | | | | | | | +-----------+-----------+ | | | | PreciseFrameDecoder | | | | +-----------+-----------+ | | | /|\ | | +---------------+-----------------------------------+---------------+ | | (1) read request \|/ | +---------------+-----------------------------------+---------------+ | | | | | [ Socket.read() ] [ Socket.write() ] | | | | Netty Internal I/O Threads (Transport Implementation) | +-------------------------------------------------------------------+
-
initializeClientPipeline
protected void initializeClientPipeline(io.netty.channel.Channel channel)
Initialize the client channel handlers.+----------------------+ | request client | +-----------+----------+ | (1) send message +-------------------------------------------------------------------+ | CLIENT CHANNEL PIPELINE | | | \|/ | | +---------------------+ +----------------------+ | | | ClientHandler | | MessageEncoder | | | +----------+----------+ +-----------+----------+ | | /|\ \|/ | | | | | | +----------+----------+ | | | | MessageDecoder | | | | +----------+----------+ | | | /|\ | | | | | | | +-----------+-----------+ | | | | FrameDecoder | | | | +-----------+-----------+ | | | /|\ | | +---------------+-----------------------------------+---------------+ | | (3) server response \|/ (2) client request +---------------+-----------------------------------+---------------+ | | | | | [ Socket.read() ] [ Socket.write() ] | | | | Netty Internal I/O Threads (Transport Implementation) | +-------------------------------------------------------------------+
-
replaceClientHandler
protected void replaceClientHandler(io.netty.channel.Channel channel, NettyTransportClient client)
-
-