aspose file tools*
The moose likes Applets and the fly likes Easing upload thread in an applet - how to? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "Easing upload thread in an applet - how to?" Watch "Easing upload thread in an applet - how to?" New topic
Author

Easing upload thread in an applet - how to?

Martin Asenov
Ranch Hand

Joined: Aug 05, 2009
Posts: 34
Hi guys!

Fortunately, the applet I've been bothering you with is almost finished, so I'm done with applets

Anyway, one more final question... I use an upload() method which simply parses file to be uploaded in parts of 5 MBs and posts them to the server. Everything's just fine, excluding the moment when it comes to performing the upload. The entire applet gets frozen, as it does the thing. I know that it's a tough process, but how can I spare some system resources to the GUI itself? I wrapped the upload of every single piece in EventQueue.invokeLater() method, even used the yield() method, and meanwhile print out some text in a JTextArea, but it doesn't seem to get bothered, the entire upload queue is done and then all the output and all the other actions get executed alltogether.

So, my question is how to spare some system resources to the GUI of the applet and perform certain events, no matter that in the same time it makes stream writing and posting to server?

Thanks in advance!
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42918
    
  68
You're not executing all that file processing and uploading in the event thread, are you? That should not be used for anything time-consuming, lest the GUI freezes. You can use a FutureTask instead.
Martin Asenov
Ranch Hand

Joined: Aug 05, 2009
Posts: 34
Ulf, I tried it, but it spares again all the applet's resources only for the upload. Meanwhile, the applet freezes. I want it to be reactable and do some stuff, as it does the upload. But I didn't manage to achieve it.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Easing upload thread in an applet - how to?