File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Threads and Synchronization and the fly likes Multithreading Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "Multithreading" Watch "Multithreading" New topic


shankhas sanyal
Ranch Hand

Joined: Jun 15, 2008
Posts: 45
Hi all,
I need to implement multithreading concept in a piece of code that has single thread concept.

I have a class A that has a function called get makeReport that takes several inputs to fetch data from a DB and create a report.

In the current scenario everytime make report is called 1 thread is created.
How do I change the code so that everytime makeReport is called a new Thread is created ?

Many thanks for your help!


I love this place!
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42959
Start with Oracle's concurrency tutorial:, particularly the "Thread Objects" chapter.
Luan Cestari
Ranch Hand

Joined: Feb 07, 2010
Posts: 163

I wouldn't recommend to create a new Thread everytime. Instead, use Thread pool, like .

Please, visit me for some cool tech post at
I agree. Here's the link:
subject: Multithreading
jQuery in Action, 3rd edition