class A implements Callable{
List result // want to share this List amongst thread and their function call
public Search call() {
List<Job> Jobs = api. Jobs(a,b,c); // Multiple threads
}
}
class API{
public void jobs(a,b,c){
// want to access the A.Result and populate the result
}
}
我如何在所有线程中共享一个数组列表,我不想使用静态,因为它每次运行都会不断累积结果,线程本地是一个不错的选择吗?
试图避免额外的对象及其各自的 getter / setter ?