Class PingPongHandler
java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.netty.channel.SimpleChannelInboundHandler<Message>
org.drasyl.peer.connection.handler.PingPongHandler
- All Implemented Interfaces:
 io.netty.channel.ChannelHandler,io.netty.channel.ChannelInboundHandler
This handler acts as a health check for a connection. It periodically sends 
PingMessages,
 which must be answered with a PongMessage. When a configured threshold of messages is not
 answered, the connection is considered unhealthy and is closed.- 
Nested Class Summary
Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
io.netty.channel.ChannelHandler.Sharable - 
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final shortstatic final Stringprotected final AtomicInteger - 
Constructor Summary
ConstructorsConstructorDescriptionPingPongHandler(int networkId, Identity identity, short maxRetries) PingPongHandler withretriesretries, until channel is closed. - 
Method Summary
Modifier and TypeMethodDescriptionprotected voidchannelRead0(io.netty.channel.ChannelHandlerContext ctx, Message msg) voiduserEventTriggered(io.netty.channel.ChannelHandlerContext ctx, Object evt) Methods inherited from class io.netty.channel.SimpleChannelInboundHandler
acceptInboundMessage, channelReadMethods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelActive, channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaughtMethods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerAdded, handlerRemoved, isSharableMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.netty.channel.ChannelHandler
handlerAdded, handlerRemoved 
- 
Field Details
- 
PING_PONG_HANDLER
- See Also:
 
 - 
maxRetries
protected final short maxRetries - 
retries
 
 - 
 - 
Constructor Details
- 
PingPongHandler
PingPongHandler withretriesretries, until channel is closed. 
 - 
 - 
Method Details
- 
userEventTriggered
public void userEventTriggered(io.netty.channel.ChannelHandlerContext ctx, Object evt) throws Exception - Specified by:
 userEventTriggeredin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
 userEventTriggeredin classio.netty.channel.ChannelInboundHandlerAdapter- Throws:
 Exception
 - 
channelRead0
- Specified by:
 channelRead0in classio.netty.channel.SimpleChannelInboundHandler<Message>
 
 -