• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

Example Applications using Threads  RSS feed

 
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Folks,
What applications have critical need to use Threads, and manage Threads?
If you can share some application you were involved in, and why Threads were useful (or not useful) that will be great.

I typically build web based applications (EJB's, Servlets) and never need to use Threads.

I guess Applets/Swing apps will use lots of Threads?

Please share your experience & views,
- Avi
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With Swing apps it is common to run the keyboard and mouse events on the Swing thread and spawn new threads to do long-running tasks. Printing might be the most familiar example for desktop apps.

It can be challenging to write a UI that makes it clear to the user what's happening and correctly responds to completion of the worker threads, but good clean fun. I have a little app that downloads files and runs as many threads as you ask. Since there is quite a bit of network latency, one thread can run while another is waiting for data.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hai i want core java q&a
 
Rancher
Posts: 42974
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I typically build web based applications (EJB's, Servlets) and never need to use Threads.


That surprises me. I find that there are plenty of asynchronous or long-running operations where a user cannot be expected to wait for a servlet to respond, or where a servlet might time out.
They also come in handy to schedule nightly jobs or cleanup tasks, where there is no user interaction. Maybe you've used them in the form of java.util.TimerTask?
 
Avianu Sud
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, use TimerTask for those, and usually those are controlled, such as checking for requests and performing operations.

Good point. Thanks
 
You ridiculous clown, did you think you could get away with it? This is my favorite tiny ad!
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!