• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Finding number of threads spawned  RSS feed

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wanted to test the threadpool programme available in informit site [http://www.informit.com/articles/article.asp?p=30483].

Here are my questions:

1.How do i test the number of thread spawned ?
2.I configured it to use only 10 Threads,whereas on using getCount() it shows more than 10.How is that possible ?
3.On looking at the TaskManager in windows XP os it shows more.
 
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The JVM spawns quite a few threads just for its own upkeep. So even if you don't start any, you can still see a bunch running.

That article is out of date. As of Java 5 we have good thread pooling in the library. Look at Executor in the doc or the SUN Concurrency Tutorial for details.

Also see JConsole in Java 5 and later. It has good information on threads and you can use the same APIs that it uses to get the same information in your programs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!