use synchronized method to get rows to avoid concurrent modification exception