Search in sources :

Example 1 with ChannelUpstreamHandler

use of org.jboss.netty.channel.ChannelUpstreamHandler in project cdap by caskdata.

the class NettyRouter method startUp.

@Override
protected void startUp() throws ServiceBindException {
    ChannelUpstreamHandler connectionTracker = new SimpleChannelUpstreamHandler() {

        @Override
        public void channelOpen(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
            channelGroup.add(e.getChannel());
            super.channelOpen(ctx, e);
        }
    };
    tokenValidator.startAndWait();
    timer = new HashedWheelTimer(new ThreadFactoryBuilder().setDaemon(true).setNameFormat("router-idle-event-generator-timer").build());
    bootstrapClient(connectionTracker);
    bootstrapServer(connectionTracker);
}
Also used : SimpleChannelUpstreamHandler(org.jboss.netty.channel.SimpleChannelUpstreamHandler) ChannelUpstreamHandler(org.jboss.netty.channel.ChannelUpstreamHandler) ChannelStateEvent(org.jboss.netty.channel.ChannelStateEvent) ThreadFactoryBuilder(com.google.common.util.concurrent.ThreadFactoryBuilder) ChannelHandlerContext(org.jboss.netty.channel.ChannelHandlerContext) HashedWheelTimer(org.jboss.netty.util.HashedWheelTimer) SimpleChannelUpstreamHandler(org.jboss.netty.channel.SimpleChannelUpstreamHandler)

Aggregations

ThreadFactoryBuilder (com.google.common.util.concurrent.ThreadFactoryBuilder)1 ChannelHandlerContext (org.jboss.netty.channel.ChannelHandlerContext)1 ChannelStateEvent (org.jboss.netty.channel.ChannelStateEvent)1 ChannelUpstreamHandler (org.jboss.netty.channel.ChannelUpstreamHandler)1 SimpleChannelUpstreamHandler (org.jboss.netty.channel.SimpleChannelUpstreamHandler)1 HashedWheelTimer (org.jboss.netty.util.HashedWheelTimer)1