So you basically want to continue the execution only after the th
thread is finished? Just don't run it in a separate thread, but rather:
for(FileContainerBean fileContainer:fileContainerList){
FileUpload fileUpload=new FileUpload(fileContainer.getFile());
fileUpload.run();
// continues after the file is uploaded
}
If you want to keep this in a separate thread after all (as you said in a comment), then execute the whole loop in the background:
Runnable uploadJob = new Runnable() {
public void run() {
for(FileContainerBean fileContainer:fileContainerList){
FileUpload fileUpload=new FileUpload(fileContainer.getFile());
fileUpload.run();
// continues after the file is uploaded
}
}
};
new Thread(uploadJob).start();