Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / July 2007

Tip: Looking for answers? Try searching our database.

Multi Thread

Thread view: 
Piyush - 09 Jul 2007 16:22 GMT
Hello,

I am working on project, where the program creates multiple threads
which depends on other data stored in database. Threads can be n nos.
Also the process of all threads depends on other data (eg. Image
files). I have got one more process which depends on this threads. Now
the problem is how do I know that all the threads process is finished?
I am not so good with java. So if anyone can explain me in details.

Thanks
Gerhard Häring - 09 Jul 2007 16:45 GMT
> Hello,
>
[quoted text clipped - 4 lines]
> the problem is how do I know that all the threads process is finished?
> I am not so good with java. So if anyone can explain me in details.

Some people, when confronted with a problem, think "I know, I'll use
threads." Now they have two problems.

... You'll have to join() all your threads.

-- Gerhard
Richard Reynolds - 09 Jul 2007 22:24 GMT
> Hello,
>
[quoted text clipped - 6 lines]
>
> Thanks

many ways to do this, a simple one is to use synchronised counter, increment
it each time you sart a new thread and have each new thread decrement it
when it's done and notify the main thread, the controlling thread "waits"
until the counter is 0 before it continues.

Have a look at the Thread.join method too and also some of the new
concurrency features in java 1.5/6.
Lew - 10 Jul 2007 00:57 GMT
> Hello,
>
[quoted text clipped - 6 lines]
>
> Thanks

Unifying the multipost . . .

Signature

Lew

Bjorn Borud - 10 Jul 2007 15:08 GMT
[Piyush <netandme@gmail.com>]

| I am working on project, where the program creates multiple threads
| which depends on other data stored in database. Threads can be n nos.
| Also the process of all threads depends on other data (eg. Image
| files). I have got one more process which depends on this threads. Now
| the problem is how do I know that all the threads process is finished?
| I am not so good with java. So if anyone can explain me in details.

actually, it would be better to understand what you were trying to
accomplish before giving any advice.  what does your program do?  why
do you have multiple threads?  why do they have to wait for each other?

-Bjørn


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.