This week's book giveaway is in the OCAJP forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff 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 OCA Java SE 8 Programmer I Study Guide 1Z0-808 this week in the OCAJP forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "new to Java multithreading" Watch "new to Java multithreading" New topic
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 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
    author
    Sheriff

    Joined: Sep 28, 2004
    Posts: 19235
        
      41


    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
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: new to Java multithreading