Loader should be thread safe. But your threading code is strange. You aren't doing any multi-threading in it (because you are calling run() instead of start()) and if you were, you aren't waiting for the loaders to finish. Have you tried something like
List<MyLoader> loaders=new ArrayList<MyLoader>();
for (int i = 0; i < cpus; i++) {
MyLoader loader = new MyLoader();
loaders.add(loader);
loader.start();
}
for (MyLoader loader:loaders) {
try {
loader.join();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
instead?