lpr-b-2007-2008:stampatoretpconcurdue
package threadPoolConcurrencyDue; import java.util.concurrent.*; public class Stampatore<T> extends Thread { LinkedBlockingQueue<T> rep; public Stampatore(LinkedBlockingQueue<T> results) { this.rep = results; } public void run() { while(true) { T i; try { i = rep.take(); System.out.println("Estratto "+i.toString()); } catch (InterruptedException e) { // fine lavori return; } } } }
lpr-b-2007-2008/stampatoretpconcurdue.txt · Ultima modifica: 19/09/2008 alle 14:08 (16 anni fa) da 127.0.0.1