Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SwingWorker Threads

Andy Selador
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The API for SwingWorker says that it runs on a worker thread, which makes it sound like when you create multiple objects from a class that extends SwingWorker, only a limited number of threads will be created. Even in the source code, there is a constant listing a maximum number of threads.


When I profile an application that creates new SwingWorkers regularly, under threads it lists an ongoing and continually expanding list of SwingWorker threads. My guess is that many have died.

Is this something to worry about? Should I use and executor to limit the number of threads available? If I create many instances of different SwingWorkers and subclass instances, will the constant defining the maximum number of worker threads apply to all the instances? (i.e. I have 4 different subclass tasks, each with 3 instances running. Will only 10, or whatever that constant is in the SwingWorker source, be running?)


  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic