當前位置: 首頁>>代碼示例>>Java>>正文


Java ChannelPipeline.addLast方法代碼示例

本文整理匯總了Java中org.jboss.netty.channel.ChannelPipeline.addLast方法的典型用法代碼示例。如果您正苦於以下問題:Java ChannelPipeline.addLast方法的具體用法?Java ChannelPipeline.addLast怎麽用?Java ChannelPipeline.addLast使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.jboss.netty.channel.ChannelPipeline的用法示例。


在下文中一共展示了ChannelPipeline.addLast方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getPipeline

import org.jboss.netty.channel.ChannelPipeline; //導入方法依賴的package包/類
@Override
public ChannelPipeline getPipeline() throws Exception {
    ChannelPipeline channelPipeline = Channels.pipeline();
    channelPipeline.addLast("openChannels", nettyTransport.serverOpenChannels);
    SizeHeaderFrameDecoder sizeHeader = new SizeHeaderFrameDecoder();
    if (nettyTransport.maxCumulationBufferCapacity != null) {
        if (nettyTransport.maxCumulationBufferCapacity.bytes() > Integer.MAX_VALUE) {
            sizeHeader.setMaxCumulationBufferCapacity(Integer.MAX_VALUE);
        } else {
            sizeHeader.setMaxCumulationBufferCapacity((int) nettyTransport.maxCumulationBufferCapacity.bytes());
        }
    }
    if (nettyTransport.maxCompositeBufferComponents != -1) {
        sizeHeader.setMaxCumulationBufferComponents(nettyTransport.maxCompositeBufferComponents);
    }
    channelPipeline.addLast("size", sizeHeader);
    channelPipeline.addLast("dispatcher", new MessageChannelHandler(nettyTransport, nettyTransport.logger, name));
    return channelPipeline;
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:20,代碼來源:NettyTransport.java

示例2: connectFrom

import org.jboss.netty.channel.ChannelPipeline; //導入方法依賴的package包/類
private Channel connectFrom(InetSocketAddress connectToSocket, SocketAddress localAddress)
     throws InterruptedException {

     ChannelFactory channelFactory =
         new NioClientSocketChannelFactory(
                 Executors.newCachedThreadPool(),
                 Executors.newCachedThreadPool());
     ChannelPipelineFactory pipelineFactory = () -> {
         ChannelPipeline pipeline = Channels.pipeline();
         pipeline.addLast("BgpPeerFrameDecoderTest",
                 peerFrameDecoder);
         pipeline.addLast("BgpPeerChannelHandlerTest",
                 peerChannelHandler);
         return pipeline;
     };

     peerBootstrap = new ClientBootstrap(channelFactory);
     peerBootstrap.setOption("child.keepAlive", true);
     peerBootstrap.setOption("child.tcpNoDelay", true);
     peerBootstrap.setPipelineFactory(pipelineFactory);
     Channel channel = peerBootstrap.connect(connectToSocket, localAddress).getChannel();
     return channel;
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:24,代碼來源:BgpControllerImplTest.java

示例3: initTrackerServers

import org.jboss.netty.channel.ChannelPipeline; //導入方法依賴的package包/類
@Override
public void initTrackerServers(List<TrackerServer> serverList) {
    TrackerServer server = new TrackerServer(new ServerBootstrap(), getName()) {
        @Override
        protected void addSpecificHandlers(ChannelPipeline pipeline) {
            pipeline.addLast("frameDecoder", new MeitrackFrameDecoder());
            pipeline.addLast("stringEncoder", new StringEncoder());
            pipeline.addLast("objectEncoder", new MeitrackProtocolEncoder());
            pipeline.addLast("objectDecoder", new MeitrackProtocolDecoder(MeitrackProtocol.this));
        }
    };
    server.setEndianness(ByteOrder.LITTLE_ENDIAN);
    serverList.add(server);
    server = new TrackerServer(new ConnectionlessBootstrap(), getName()) {
        @Override
        protected void addSpecificHandlers(ChannelPipeline pipeline) {
            pipeline.addLast("stringEncoder", new StringEncoder());
            pipeline.addLast("objectEncoder", new MeitrackProtocolEncoder());
            pipeline.addLast("objectDecoder", new MeitrackProtocolDecoder(MeitrackProtocol.this));
        }
    };
    server.setEndianness(ByteOrder.LITTLE_ENDIAN);
    serverList.add(server);
}
 
開發者ID:bamartinezd,項目名稱:traccar-service,代碼行數:25,代碼來源:MeitrackProtocol.java

示例4: initTrackerServers

import org.jboss.netty.channel.ChannelPipeline; //導入方法依賴的package包/類
@Override
public void initTrackerServers(List<TrackerServer> serverList) {
    TrackerServer server = new TrackerServer(new ServerBootstrap(), getName()) {
        @Override
        protected void addSpecificHandlers(ChannelPipeline pipeline) {
            pipeline.addLast("frameDecoder", new LengthFieldBasedFrameDecoder(1024, 2, 2, -4, 0));
            pipeline.addLast("objectDecoder", new CastelProtocolDecoder(CastelProtocol.this));
        }
    };
    server.setEndianness(ByteOrder.LITTLE_ENDIAN);
    serverList.add(server);

    server = new TrackerServer(new ConnectionlessBootstrap(), getName()) {
        @Override
        protected void addSpecificHandlers(ChannelPipeline pipeline) {
            pipeline.addLast("objectDecoder", new CastelProtocolDecoder(CastelProtocol.this));
        }
    };
    server.setEndianness(ByteOrder.LITTLE_ENDIAN);
    serverList.add(server);
}
 
開發者ID:bamartinezd,項目名稱:traccar-service,代碼行數:22,代碼來源:CastelProtocol.java

示例5: getPipeline

import org.jboss.netty.channel.ChannelPipeline; //導入方法依賴的package包/類
@Override
public ChannelPipeline getPipeline() throws Exception {
    BgpChannelHandler handler = new BgpChannelHandler(bgpController);

    ChannelPipeline pipeline = Channels.pipeline();
    pipeline.addLast("bgpmessagedecoder", new BgpMessageDecoder());
    pipeline.addLast("bgpmessageencoder", new BgpMessageEncoder());
    pipeline.addLast("holdTime", readTimeoutHandler);
    if (isBgpServ) {
        pipeline.addLast("PassiveHandler", handler);
    } else {
        pipeline.addLast("ActiveHandler", handler);
    }

    return pipeline;
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:17,代碼來源:BgpPipelineFactory.java

示例6: getPipeline

import org.jboss.netty.channel.ChannelPipeline; //導入方法依賴的package包/類
@Override
public ChannelPipeline getPipeline() throws Exception {
    RPCChannelHandler channelHandler = 
            new RPCChannelHandler(syncManager, rpcService);

    IdleStateHandler idleHandler = 
            new IdleStateHandler(timer, 5, 10, 0);
    ReadTimeoutHandler readTimeoutHandler = 
            new ReadTimeoutHandler(timer, 30);
    
    ChannelPipeline pipeline = Channels.pipeline();
    pipeline.addLast("idle", idleHandler);
    pipeline.addLast("timeout", readTimeoutHandler);
    pipeline.addLast("handshaketimeout",
                     new HandshakeTimeoutHandler(channelHandler, timer, 10));

    pipeline.addLast("frameDecoder",
                     new ThriftFrameDecoder(maxFrameSize));
    pipeline.addLast("frameEncoder",
                     new ThriftFrameEncoder());

    pipeline.addLast("handler", channelHandler);
    return pipeline;
}
 
開發者ID:nsg-ethz,項目名稱:iTAP-controller,代碼行數:25,代碼來源:RPCPipelineFactory.java

示例7: getPipeline

import org.jboss.netty.channel.ChannelPipeline; //導入方法依賴的package包/類
@Override
public ChannelPipeline getPipeline() throws Exception {
    BootstrapChannelHandler handler = 
            new BootstrapChannelHandler(bootstrap);
    ChannelPipeline pipeline = Channels.pipeline();

    pipeline.addLast("frameDecoder",
                     new ThriftFrameDecoder(maxFrameSize));
    pipeline.addLast("frameEncoder",
                     new ThriftFrameEncoder());
    pipeline.addLast("timeout",
                     new BootstrapTimeoutHandler(timer, 10));

    pipeline.addLast("handler", handler);

    return pipeline;
}
 
開發者ID:nsg-ethz,項目名稱:iTAP-controller,代碼行數:18,代碼來源:BootstrapPipelineFactory.java

示例8: getPipeline

import org.jboss.netty.channel.ChannelPipeline; //導入方法依賴的package包/類
@Override
public ChannelPipeline getPipeline() throws Exception {
    ChannelPipeline pipeline = Channels.pipeline();
    pipeline.addLast("encoder", new IsisMessageDecoder());
    pipeline.addLast("decoder", new IsisMessageEncoder());
    pipeline.addLast("handler", isisChannelHandler);

    return pipeline;
}
 
開發者ID:shlee89,項目名稱:athena,代碼行數:10,代碼來源:IsisPipelineFactory.java

示例9: initSSL

import org.jboss.netty.channel.ChannelPipeline; //導入方法依賴的package包/類
private synchronized void initSSL(ChannelPipeline p)
        throws X509Exception, KeyManagementException, NoSuchAlgorithmException {
    String authProviderProp = System.getProperty(ZKConfig.SSL_AUTHPROVIDER);
    SSLContext sslContext;
    if (authProviderProp == null) {
        sslContext = X509Util.createSSLContext();
    } else {
        sslContext = SSLContext.getInstance("TLSv1");
        X509AuthenticationProvider authProvider =
                (X509AuthenticationProvider)ProviderRegistry.getProvider(
                        System.getProperty(ZKConfig.SSL_AUTHPROVIDER,
                                "x509"));

        if (authProvider == null)
        {
            LOG.error("Auth provider not found: {}", authProviderProp);
            throw new SSLContextException(
                    "Could not create SSLContext with specified auth provider: " +
                    authProviderProp);
        }

        sslContext.init(new X509KeyManager[] { authProvider.getKeyManager() },
                        new X509TrustManager[] { authProvider.getTrustManager() },
                        null);
    }

    SSLEngine sslEngine = sslContext.createSSLEngine();
    sslEngine.setUseClientMode(false);
    sslEngine.setNeedClientAuth(true);

    p.addLast("ssl", new SslHandler(sslEngine));
    LOG.info("SSL handler added for channel: {}", p.getChannel());
}
 
開發者ID:didichuxing2,項目名稱:https-github.com-apache-zookeeper,代碼行數:34,代碼來源:NettyServerCnxnFactory.java

示例10: initTrackerServers

import org.jboss.netty.channel.ChannelPipeline; //導入方法依賴的package包/類
@Override
public void initTrackerServers(List<TrackerServer> serverList) {
    TrackerServer server = new TrackerServer(new ServerBootstrap(), getName()) {
        @Override
        protected void addSpecificHandlers(ChannelPipeline pipeline) {
            pipeline.addLast("frameDecoder", new TramigoFrameDecoder());
            pipeline.addLast("objectDecoder", new TramigoProtocolDecoder(TramigoProtocol.this));
        }
    };
    server.setEndianness(ByteOrder.LITTLE_ENDIAN);
    serverList.add(server);
}
 
開發者ID:bamartinezd,項目名稱:traccar-service,代碼行數:13,代碼來源:TramigoProtocol.java

示例11: addDynamicHandlers

import org.jboss.netty.channel.ChannelPipeline; //導入方法依賴的package包/類
private void addDynamicHandlers(ChannelPipeline pipeline) {
    if (Context.getConfig().hasKey("extra.handlers")) {
        String[] handlers = Context.getConfig().getString("extra.handlers").split(",");
        for (int i = 0; i < handlers.length; i++) {
            try {
                pipeline.addLast("extraHandler." + i, (ChannelHandler) Class.forName(handlers[i]).newInstance());
            } catch (ClassNotFoundException | InstantiationException | IllegalAccessException error) {
                Log.warning(error);
            }
        }
    }
}
 
開發者ID:bamartinezd,項目名稱:traccar-service,代碼行數:13,代碼來源:BasePipelineFactory.java

示例12: initTrackerServers

import org.jboss.netty.channel.ChannelPipeline; //導入方法依賴的package包/類
@Override
public void initTrackerServers(List<TrackerServer> serverList) {
    TrackerServer server = new TrackerServer(new ServerBootstrap(), getName()) {
        @Override
        protected void addSpecificHandlers(ChannelPipeline pipeline) {
            pipeline.addLast("frameDecoder", new LengthFieldBasedFrameDecoder(1024, 2, 2, 4, 0));
            pipeline.addLast("objectDecoder", new ProgressProtocolDecoder(ProgressProtocol.this));
        }
    };
    server.setEndianness(ByteOrder.LITTLE_ENDIAN);
    serverList.add(server);
}
 
開發者ID:bamartinezd,項目名稱:traccar-service,代碼行數:13,代碼來源:ProgressProtocol.java

示例13: initTrackerServers

import org.jboss.netty.channel.ChannelPipeline; //導入方法依賴的package包/類
@Override
public void initTrackerServers(List<TrackerServer> serverList) {
    TrackerServer server = new TrackerServer(new ServerBootstrap(), getName()) {
        @Override
        protected void addSpecificHandlers(ChannelPipeline pipeline) {
            pipeline.addLast("frameDecoder", new GalileoFrameDecoder());
            pipeline.addLast("objectDecoder", new BlackKiteProtocolDecoder(BlackKiteProtocol.this));
        }
    };
    server.setEndianness(ByteOrder.LITTLE_ENDIAN);
    serverList.add(server);
}
 
開發者ID:bamartinezd,項目名稱:traccar-service,代碼行數:13,代碼來源:BlackKiteProtocol.java

示例14: initTrackerServers

import org.jboss.netty.channel.ChannelPipeline; //導入方法依賴的package包/類
@Override
public void initTrackerServers(List<TrackerServer> serverList) {
    TrackerServer server = new TrackerServer(new ServerBootstrap(), getName()) {
        @Override
        protected void addSpecificHandlers(ChannelPipeline pipeline) {
            pipeline.addLast("frameDecoder", new Pt502FrameDecoder());
            pipeline.addLast("stringEncoder", new StringEncoder());
            pipeline.addLast("stringDecoder", new StringDecoder());
            pipeline.addLast("objectEncoder", new Pt502ProtocolEncoder());
            pipeline.addLast("objectDecoder", new Pt502ProtocolDecoder(Pt502Protocol.this));
        }
    };
    server.setEndianness(ByteOrder.LITTLE_ENDIAN);
    serverList.add(server);
}
 
開發者ID:bamartinezd,項目名稱:traccar-service,代碼行數:16,代碼來源:Pt502Protocol.java

示例15: initTrackerServers

import org.jboss.netty.channel.ChannelPipeline; //導入方法依賴的package包/類
@Override
public void initTrackerServers(List<TrackerServer> serverList) {
    TrackerServer server = new TrackerServer(new ServerBootstrap(), getName()) {
        @Override
        protected void addSpecificHandlers(ChannelPipeline pipeline) {
                pipeline.addLast("frameDecoder", new MxtFrameDecoder());
                pipeline.addLast("objectDecoder", new MxtProtocolDecoder(MxtProtocol.this));
            }
    };
    server.setEndianness(ByteOrder.LITTLE_ENDIAN);
    serverList.add(server);
}
 
開發者ID:bamartinezd,項目名稱:traccar-service,代碼行數:13,代碼來源:MxtProtocol.java


注:本文中的org.jboss.netty.channel.ChannelPipeline.addLast方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。