aspose file tools*
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
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: 19064
        
      40


    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