get timer instance from ReadTimeoutHandler subclasses

谢非 heliu.smth at gmail.com
Thu Mar 18 03:21:36 EDT 2010


hi all,

    I need to start the timeout timer in channelConnected() event handler of
a ReadTimeoutHandler subclass, but it seems that there is no protected
getTimer() in ReadTimeoutHandler.
    should I store the timer as a member field like this:

      class ServerReadTimeoutHandler extends ReadTimeoutHandler {
             Timer timer;

             public ServerReadTimeoutHandler(Timer timer, int
timeoutSeconds) {
                         super(timer, timeoutSeconds);
                          this.timer = timer;
             }

            @Override
            public void channelConnected(ChannelHandlerContext ctx,
ChannelStateEvent e) throws Exception {
                 timer.start();
                 super.channelConnected(ctx, e);
            }
     }

Centaur
20100318
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/netty-users/attachments/20100318/8dd4535d/attachment.html 


More information about the netty-users mailing list