| Author |
new to Java multithreading
|
Gabry ombo
Greenhorn
Joined: Jan 19, 2010
Posts: 2
|
|
Hi all,
I'm new to multithreading programming.
I have a problem with this :
There is a Thread that manage requestsThere are many Threads that make requests to the Manager
When there aren't any active requests, the manager must sleep but when arrive one request
the manager must take this active request and start your job.
If arrive one other request, it will be positioned into a queue and his
owner thread will be suspended
When the Manager's job will be finished will be taken another request from the queue
How can I suspend and put a Thread in a queue and then restarting it ?
Thanks for any suggestion
|
 |
Henry Wong
author
Sheriff
Joined: Sep 28, 2004
Posts: 16695
|
|
In threading speak, the task of waiting for work, is generally done by a condition variable. And in Java, condition variable functionality are done with the wait() and notify() methods.
How about starting with Sun tutorial -- and learning up to about synchronization and the wait and notify mechanism?
http://java.sun.com/docs/books/tutorial/essential/concurrency/
Henry
|
Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
|
 |
Sergey Babkin
author
Ranch Hand
Joined: Apr 05, 2010
Posts: 50
|
|
There is allso Java Message Queue API:
http://docs.sun.com/app/docs/doc/820-5205/aeqcq?l=en&a=view&q=java+queue
|
 |
 |
|
|
subject: new to Java multithreading
|
|
|