All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.netflix.netty.common.CloseOnIdleStateHandler Maven / Gradle / Ivy

There is a newer version: 2.5.13
Show newest version
package com.netflix.netty.common;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.handler.timeout.IdleStateEvent;

/**
 * Just listens for the IdleStateEvent and closes the channel if received.
 */
public class CloseOnIdleStateHandler extends ChannelInboundHandlerAdapter
{
    @Override
    public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception
    {
        super.userEventTriggered(ctx, evt);

        if (evt instanceof IdleStateEvent) {
            ctx.close();
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy