I have a quad core processor and the ThreadPoolExecutor is set to 4 core threads, but when I submit my callables (hundred or so) to the ThreadPoolExecutor, Java never uses more than 25% CPU. Why does it not use all of them?
Code in question:
static class Sum implements Callable{
private double bigarray[];
public Sum(double [] bigarray){
this.bigarray = bigarray;
}
@Override
public Double call(){
double sum = 0;
for (int i = 0; i < bigarray.length; i++){
sum += bigarray[i];
}
return sum;
}
}