I had a little discussion the other day on this forum about JSF2.2 and how JSF seems to be turning from a "do 1 thing and do it well" framework to a "do HTTP no matter what sort of violence it involves".
This is sort of a case in point.
I've always maintained that it's cleaner to put JSF aside and do one's downloads via straight
servlets or JSPs instead of warping JSF to do that sort of work. On the other hand, you have a ready-made taglib to obscure most of the warts, so... OK.
Multi-threading isn't going to help you here, unless you can figure out how to make a torrent out of it anyway. So relax, you don't have to consider violating the
J2EE constraint on spawning threads.
And I don't think that there's anything you can actually do in the webapp that's going to make it better, whether it's something I'd put my blessing on or not. The mechanisms here are ultimately fairly simple, even if getting at them without a
boost from something like your PrimeFaces tag isn't very pretty.
What I'm afraid of is that you have an infrastructure issue. First off, just to say you did it, I'd check the disk drive itself using whatever disk utilities are appropriate. For example, "badblocks" for Linux, or the Windows filesystem checker with block check (requires reboot). And, if it's a fragmentable filesystem you're dealing with, defrag it just for good measure. In the case of uploads, make sure there's a comfortable free-space cushion, as that will reduce potential fragmentation.
Then comes the hard part. If you're seeing corrupted data in the upload/download process, then it's likely that at some point along the network path there's at least one
unit that's mis-configured or defective. In the old days that was often a bad MTU setting, although I've gotten the impression that MTUs are more self-adjusting these days. So make friends with a network tech!
Something that might help is to break the transmission into chunks, but chunking does require some software support. Check the PrimeFaces tag to see it has chunking options built in. If not, you're not likely to be able to explore that route unless you dirtch the Primefaces tag and go to raw code.