I have a logging code which needs to be executed after all
Thread t1 = new MyThread();
Thread t2 = new MyThread();
join() all threads before your
t1.join(); t2.join(); // the following line will be executed when both threads are done doLogging();
Note that the order of
join() calls doesn't matter if you want to wait for all of your threads.