|
|
@ -28,6 +28,8 @@ import io.netty.channel.ChannelHandlerContext;
|
|
|
|
import io.netty.channel.ChannelInboundHandlerAdapter;
|
|
|
|
import io.netty.channel.ChannelInboundHandlerAdapter;
|
|
|
|
import io.netty.util.Timeout;
|
|
|
|
import io.netty.util.Timeout;
|
|
|
|
import io.netty.util.TimerTask;
|
|
|
|
import io.netty.util.TimerTask;
|
|
|
|
|
|
|
|
import io.netty.util.concurrent.Future;
|
|
|
|
|
|
|
|
import io.netty.util.concurrent.FutureListener;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
*
|
|
|
@ -45,7 +47,15 @@ public class PingConnectionHandler extends ChannelInboundHandlerAdapter {
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
|
|
|
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
|
|
|
|
|
|
|
RedisConnection connection = RedisConnection.getFrom(ctx.channel());
|
|
|
|
|
|
|
|
connection.getConnectionPromise().addListener(new FutureListener<RedisConnection>() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void operationComplete(Future<RedisConnection> future) throws Exception {
|
|
|
|
|
|
|
|
if (future.isSuccess()) {
|
|
|
|
sendPing(ctx);
|
|
|
|
sendPing(ctx);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
ctx.fireChannelActive();
|
|
|
|
ctx.fireChannelActive();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|