This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Threads and Synchronization and the fly likes new to Java multithreading Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "new to Java multithreading" Watch "new to Java multithreading" New topic

new to Java multithreading

Gabry ombo

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 requests
  • There 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

    Joined: Sep 28, 2004
    Posts: 20535

    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?


    Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
    Sergey Babkin
    Ranch Hand

    Joined: Apr 05, 2010
    Posts: 50
    There is allso Java Message Queue API:
    I agree. Here's the link:
    subject: new to Java multithreading
    It's not a secret anymore!