Package io.lettuce.core.protocol
Class RedisHandshakeHandler
- java.lang.Object
-
- io.netty.channel.ChannelHandlerAdapter
-
- io.netty.channel.ChannelInboundHandlerAdapter
-
- io.lettuce.core.protocol.RedisHandshakeHandler
-
- All Implemented Interfaces:
ChannelHandler
,ChannelInboundHandler
public class RedisHandshakeHandler extends ChannelInboundHandlerAdapter
Handler to initialize a Redis Connection using aConnectionInitializer
.- Since:
- 6.0
- Author:
- Mark Paluch
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
ChannelHandler.Sharable
-
-
Constructor Summary
Constructors Constructor Description RedisHandshakeHandler(ConnectionInitializer connectionInitializer, ClientResources clientResources, Duration initializeTimeout)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
channelActive(ChannelHandlerContext ctx)
void
channelInactive(ChannelHandlerContext ctx)
CompletionStage<Void>
channelInitialized()
void
channelRegistered(ChannelHandlerContext ctx)
void
exceptionCaught(ChannelHandlerContext ctx, Throwable cause)
protected void
fail(ChannelHandlerContext ctx, Throwable cause)
Complete the handshake future with an error and close the channel..protected void
succeed()
Complete the handshake future successfully.-
Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelRead, channelReadComplete, channelUnregistered, channelWritabilityChanged, userEventTriggered
-
Methods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerAdded, handlerRemoved, isSharable
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.netty.channel.ChannelHandler
handlerAdded, handlerRemoved
-
-
-
-
Constructor Detail
-
RedisHandshakeHandler
public RedisHandshakeHandler(ConnectionInitializer connectionInitializer, ClientResources clientResources, Duration initializeTimeout)
-
-
Method Detail
-
channelRegistered
public void channelRegistered(ChannelHandlerContext ctx) throws Exception
- Specified by:
channelRegistered
in interfaceChannelInboundHandler
- Overrides:
channelRegistered
in classChannelInboundHandlerAdapter
- Throws:
Exception
-
channelInactive
public void channelInactive(ChannelHandlerContext ctx) throws Exception
- Specified by:
channelInactive
in interfaceChannelInboundHandler
- Overrides:
channelInactive
in classChannelInboundHandlerAdapter
- Throws:
Exception
-
channelActive
public void channelActive(ChannelHandlerContext ctx)
- Specified by:
channelActive
in interfaceChannelInboundHandler
- Overrides:
channelActive
in classChannelInboundHandlerAdapter
-
exceptionCaught
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception
- Specified by:
exceptionCaught
in interfaceChannelHandler
- Specified by:
exceptionCaught
in interfaceChannelInboundHandler
- Overrides:
exceptionCaught
in classChannelInboundHandlerAdapter
- Throws:
Exception
-
succeed
protected void succeed()
Complete the handshake future successfully.
-
fail
protected void fail(ChannelHandlerContext ctx, Throwable cause)
Complete the handshake future with an error and close the channel..
-
channelInitialized
public CompletionStage<Void> channelInitialized()
- Returns:
- future to synchronize channel initialization. Returns a new future for every reconnect.
-
-