ChannelFutureProgressListener interface not working as expected!
"이희승 (Trustin Lee)"
trustin at gmail.com
Mon Aug 16 01:41:16 EDT 2010
Hello Fahad,
It works for me on my Fedora 13 Linux. What is your environment? On
Windows, it may not work, but I don't remember exactly. Zero copy file
transfer in Windows is broken anyway - please check out the FileRegion
API documentation.
HTH,
Trustin
On 07/15/2010 11:14 AM, Fahad Kalil wrote:
>
> 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.
>
--
what we call human nature in actuality is human habit
http://gleamynode.net/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 293 bytes
Desc: OpenPGP digital signature
Url : http://lists.jboss.org/pipermail/netty-users/attachments/20100816/2134c1f7/attachment.bin
More information about the netty-users
mailing list