We are modifying feng office (an open source, group-ware in PHP, Apache and MySQL). We are trying to implement the multiple file upload functionality. This is the flow:
(1) User clicks on a button (in a web page), a JNLP is downloaded (2) which causes a "Choose File" dialog to appear. User selects multiple files and presses "Upload", (3) then files are uploaded in a loop and a progress bar gets updated after each file.
Now, inside the mfu.jar (multiple file upload core). We use apache httpclient-4.1.1 along with SwingWorker to upload files and update the progress bar [ multi-thread stuff, have I told you how cool we are? ;-) ]. Strange thing is, on machines using Sun's java (Sun logo appears) the thing is working perfectly. On machines using either Open JDK or Oracle's Java (Oracle logo appears, either Linux or Windows, 32bit or 64 bit), instead of having different files being开发者_StackOverflow中文版 uploaded exactly once, we end up with one of them being uploaded multiple times (same name, same content) !
any clues ?
P.S: I apologize if data is not enough, I tried to stay focused on the problem as to my understanding of the contributing factors.
EIDT: Apparently httpclient-4.1.1 uses some kinda cache mechanism, still can't find any rigorous relation.
Problemo solved. Somehow we forgot to consider some of the very basic guidelines of multi-threading and all the SwingWorker
s were trying to use the same uploader
simultaneously. We gave each SwingWorkrer
their own uploader
and things are working perfectly.
精彩评论