package threadPoolConcurrency; public class Task<T,R> implements Runnable { Compute<T,R> fun = null; T task = null; Repository<R> results = null; public Task(T task, Compute<T,R>fun, Repository<R> results) { this.fun = fun; this.task = task; this.results = results; } public void run() { R result = fun.compute(task); results.insert(result); return; } }