wood burning stoves 2.0*
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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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: 39530
    
  27
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.


Ping & DNS - updated with new look and Ping home screen widget
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?
 
Similar Threads
URLyBird, almost done, but some lil' probs here
Anyone know an answer to this or what forum to put it in???
FIle Upload from Client to Server
Thread Newby - Just need a bit of advice
strange problem while trying to retrieve a file url in servlet