Created loop to handle deadlocks in method runTransaction in class Transaction. When it detecs a deadlock, the process of acquiring locks are aborted and restarted.