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

com.taobao.tdhs.client.net.netty.TDHSPiplelineFactoty Maven / Gradle / Ivy

/*
 * Copyright(C) 2011-2012 Alibaba Group Holding Limited
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License version 2 as
 *  published by the Free Software Foundation.
 *
 *  Authors:
 *    wentong 
 */

package com.taobao.tdhs.client.net.netty;

import com.taobao.tdhs.client.packet.BasePacket;
import org.jboss.netty.channel.ChannelPipeline;
import org.jboss.netty.channel.ChannelPipelineFactory;
import org.jboss.netty.channel.Channels;

import java.util.Map;
import java.util.concurrent.ArrayBlockingQueue;

/**
 * @author 文通
 * @since 11-10-31 下午4:04
 */
public class TDHSPiplelineFactoty implements ChannelPipelineFactory {
    private BasePacket shakeHandeMessage;

    private Map> responses;

    private TDHSNetForNetty tdhsNetForNetty;

    public TDHSPiplelineFactoty(BasePacket shakeHandeMessage,
                                Map> responses, TDHSNetForNetty tdhsNetForNetty) {
        this.responses = responses;
        this.shakeHandeMessage = shakeHandeMessage;
        this.tdhsNetForNetty = tdhsNetForNetty;
    }

    public ChannelPipeline getPipeline() throws Exception {
        ChannelPipeline pipeline = Channels.pipeline();
        pipeline.addLast("decoder", new TDHSDecoder());
        pipeline.addLast("encoder", new TDHSEncoder());
        pipeline.addLast("handler", new TDHSClientHandler(shakeHandeMessage, responses, tdhsNetForNetty));
        return pipeline;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy