Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You could try connecting the thread groups with an <a href="http://download.oracle.com/javase/6/docs/api/java/util/concurrent/Exchanger.html" rel="nofollow">Exchanger</a>. It's classically used for transferring work back and forth between two threads that alternate work. Seems like you might be able to make it work for groups of threads too if you can get the transfer to work right. </p> <p>What if you had a controller thread for each group? You could then have the controller notifyAll on his group when he received an item in the Exchanger, then join on all of his own group. When the joins all return, he could transfer control back over the Exchanger.</p> <p>Or if the number of threads in each group is fixed, you could create a <a href="http://download.oracle.com/javase/6/docs/api/java/util/concurrent/CyclicBarrier.html" rel="nofollow">CyclicBarrier</a> for the group with the fixed number of threads, then specify a barrier action to be run when all of the threads complete and hit the barrier. That action could transfer control via an Exchanger or a <a href="http://download.oracle.com/javase/6/docs/api/java/util/concurrent/SynchronousQueue.html" rel="nofollow">SynchronousQueue</a> (which is a 0-length queue that enforces synchronous coordination).</p> <p>For more information on synchronizers, check out <a href="http://javaconcurrencyinpractice.com" rel="nofollow">Java Concurrency in Practice</a> or the <a href="http://refcardz.dzone.com/refcardz/core-java-concurrency" rel="nofollow">DZone concurrency refcard</a>. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload