Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When is channelInactive called with keepalive on?

Tags:

java

netty

I have a SimpleChannelInboundHandler which handles a few http requests:

CacheServerHandler extends SimpleChannelInboundHandler<FullHttpRequest>

When i do not explicitly close the channel/connection and keepalive is true, will channelInactive be called every time after channelRead0 is done?

Or will channelInactive only be called once when the channel/connection is closed?

I ask this because when keepalive is true on a http connection the connection isn't closed by client and client can send multiple requests without opening/closing the connection.

like image 637
TinusSky Avatar asked Nov 21 '13 15:11

TinusSky


1 Answers

ChannelInactive() will only be called when the channel is closed. This is the contract.

like image 69
Norman Maurer Avatar answered Nov 13 '22 18:11

Norman Maurer