title: How to calculate the total time it takes for multiple threads to finish executing?
body: <p>I am starting multiple threads(around 1000) from my code. They are Runnable threads called from a while loop. How do I calculate the total time taken for all threads to finish executing?</p>
  
  <p>Also I am opening a DB Connection and have a set of queries for which I am starting these threads(1 thread for 1 query). When do I close the connection?</p>