try {
ChannelFuture writeFuture;
if (ChannelManager.isSslHandlerConfigured(channel.pipeline()) || nettyConfig.isDisableZeroCopy()) {
writeFuture = channel.write(new ChunkedFile(raf, offset, length, nettyConfig.getChunkedFileChunkSize()), channel.newProgressivePromise());
} else {
FileRegion region = new DefaultFileRegion(raf.getChannel(), offset, length);
writeFuture = channel.write(region, channel.newProgressivePromise());
}
writeFuture.addListener(new ProgressListener(config, future.getAsyncHandler(), future, false, getContentLength()) {
public void operationComplete(ChannelProgressiveFuture cf) {
closeSilently(raf);