ChannelFutureProgressListener interface not working as expected!

Fahad Kalil fahadkalil at gmail.com
Wed Jul 14 22:14:40 EDT 2010


Hello,

I'm a new user of the Netty API. 
My question is about the new ChannelFutureProgressListener interface. 

I have the code above (based on the HttpStaticFileServerHandler example):


public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) {        
   Channel ch = e.getChannel();        
   ChannelFuture writeFuture;
   ...
   final FileRegion region = new DefaultFileRegion(raf.getChannel(), 0,
fileLength);
   writeFuture = ch.write(region);
   writeFuture.addListener(new ChannelFutureProgressListener() {
      public void operationComplete(ChannelFuture future) {
         region.releaseExternalResources();
         System.out.println("Transfer Done!");
      }

      public void operationProgressed(ChannelFuture future, long amount,
long current, long total) {
         System.out.println("Transferring...");
         System.out.printf("%d / %d (+%d)%n", current, total, amount);
      }
   });  

The problem is that 'operationProgressed' is never accessed/called during
the transfer process. 
I've tried to use that interface to have access to data about the transfer
and show in a GUI for the user.

The transfer worked (and the method operationComplete is accessed), except
for the operationProgressed method.

Any help would be welcome. 
Thanks.

-- 
View this message in context: http://netty-forums-and-mailing-lists.685743.n2.nabble.com/ChannelFutureProgressListener-interface-not-working-as-expected-tp5295655p5295655.html
Sent from the Netty User Group mailing list archive at Nabble.com.


More information about the netty-users mailing list