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

cn.t.tool.nettytool.util.NettyComponentUtil Maven / Gradle / Ivy

package cn.t.tool.nettytool.util;

import cn.t.tool.nettytool.constants.HandlerNames;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelPipeline;

/**
 * @author 研发部-杨建
 * @version V1.0
 * @since 2021-07-15 11:31
 **/
public class NettyComponentUtil {
    public static void removeAllHandler(ChannelPipeline channelPipeline, Class clazz) {
        while (true) {
            ChannelHandler handler = channelPipeline.get(clazz);
            if(handler == null) {
                break;
            }
            channelPipeline.remove(handler);
        }
    }
    public static  void addLastHandler(ChannelPipeline channelPipeline, String handlerName, T handler) {
        channelPipeline.addBefore(HandlerNames.EXCEPTION_HANDLER, handlerName, handler);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy