• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Would you use SwingWorker in an applet? Problem with Java 1.5 browser plugin

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I wrote a Java applet that used the Java 6 SwingWorker class. It needed to perform a long-running task which updates the GUI as it progresses AND has the ability to be paused and resumed as many times as the user likes.

Unfortunately, I also need to cater to users who might have a Java 1.5 browser plugin, so I rewrote quite a bit of the applet to get it running using a the older SwingWorker class (http://java.sun.com/products/jfc/tsc/articles/threads/src/SwingWorker.java) which was NOT part of the API. It is quite different to the API version but I did get a version working properly when tested with appletviewer.

The problem is that once I use this SwingWorker version with a browser, particularly with a Java 1.5 plugin, the applet sometimes hangs after pause and resume is used. Sometimes.

I suspect that when the applet hangs, it is after the interrupt had been fired during a particular activity in the long running process, perhaps file I/O.

Can anyone comment on this behaviour or provide any insight? I would also appreciate an opinion on the widsom (or lack of) getting rid of the (older) SwingWorker class and trying to program the worker thread by hand.

Thanks
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"oneiota",
Welcome to the JavaRanch.

We're a friendly group, but we do require members to have valid display names.

Display names must be two words: your first name, a space, then your last name. Fictitious names are not allowed.

Please edit your profile and correct your display name since accounts with invalid display names get deleted.
 
Daniel Stuart
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry - I thought I had already filled this in when I registered, but I see that it has used my login name instead. I've made the change to the profile.
 
Daniel Stuart
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It seems that setting the worker to null after invoking the interrupt() takes care of the problem. It's not clear why this would be so in the pre-Java6 version of SwingWorker, so comments welcome!
 
Water proof donuts! Eat them while reading this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic