当前位置: 首页>>代码示例>>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;未经允许,请勿转载。