Thread t1= new Thread(new Runnable() {
public void run() {
//perform Database stuff
}
});
t1.start();
initCache();//perform other Database stuff (Can this code be executed while thread 1 is running?)
How can I make sure the initCache method is forced to wait after t1 finishes?
Don’t run it in a different thread to start with?
You could call
t1.join()but really, if you want to run task X and then task Y, just run them in the same thread…