public abstract class AbstractProtocol extends Object implements Protocol
Protocol interface directly.| Modifier and Type | Field and Description |
|---|---|
protected static NotEnoughDataException |
notEnoughDataException |
| Constructor and Description |
|---|
AbstractProtocol() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterResponseSent(Request request,
Response response,
io.netty.channel.ChannelFuture channelFuture)
do something if needed after server channel writeAndFlush
|
Request |
createRequest()
create a new request instance
|
Response |
createResponse()
create a new response instance
|
Request |
getRequest()
get a reusable request instance from threadLocal or pool
the request instance must be reset before reuse
|
Response |
getResponse()
get a reusable response instance from threadLocal or pool
the response instance must be reset before reuse
|
boolean |
isCoexistence()
该协议是否可以和其他协议共存。
|
boolean |
returnChannelBeforeResponse()
连接被归还入池的时机
|
boolean |
supportHeartbeat()
check if the protocol supports heartbeat packet
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdecode, decodeRequest, decodeResponse, encodeRequest, encodeResponseprotected static NotEnoughDataException notEnoughDataException
public Request createRequest()
ProtocolcreateRequest in interface Protocolpublic Response createResponse()
ProtocolcreateResponse in interface Protocolpublic Request getRequest()
ProtocolgetRequest in interface Protocolpublic Response getResponse()
ProtocolgetResponse in interface Protocolpublic boolean supportHeartbeat()
ProtocolsupportHeartbeat in interface Protocolpublic boolean returnChannelBeforeResponse()
ProtocolreturnChannelBeforeResponse in interface Protocolpublic void afterResponseSent(Request request, Response response, io.netty.channel.ChannelFuture channelFuture)
ProtocolafterResponseSent in interface ProtocolchannelFuture - the return value of writeAndFlushpublic boolean isCoexistence()
ProtocolisCoexistence in interface ProtocolCopyright © 2020 Baidu, Inc.. All rights reserved.