Strumenti Utente

Strumenti Sito


lpr-b: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/taskduec.txt · Ultima modifica: 24/10/2007 alle 09:05 (12 anni fa) da Marco Danelutto