lpr-b-2007-2008:taskduec
package threadPoolConcurrencyDue; import java.util.concurrent.LinkedBlockingQueue; public class Task<T,R> implements Runnable { Compute<T,R> fun = null; T task = null; LinkedBlockingQueue<R> results = null; public Task(T task, Compute<T,R>fun, LinkedBlockingQueue<R> results) { this.fun = fun; this.task = task; this.results = results; } public void run() { R result = fun.compute(task); try { results.put(result); } catch (InterruptedException e) { e.printStackTrace(); } return; } }
lpr-b-2007-2008/taskduec.txt · Ultima modifica: 19/09/2008 alle 14:08 (16 anni fa) da 127.0.0.1