From: gu.martinm@gmail.com Date: Fri, 10 Oct 2014 17:32:29 +0000 (+0200) Subject: Data base deadlocks. How to deal with them (retries) X-Git-Url: https://git.gumartinm.name/?a=commitdiff_plain;h=300061a2291b8058f5495a6d50887032c470f524;p=JavaForFun Data base deadlocks. How to deal with them (retries) --- diff --git a/SpringJava/DeadLocksSQL/src/main/java/de/example/sql/deadlocks/example/FirstTransaction.java b/SpringJava/DeadLocksSQL/src/main/java/de/example/sql/deadlocks/example/FirstTransaction.java index 23d72a5..5370788 100644 --- a/SpringJava/DeadLocksSQL/src/main/java/de/example/sql/deadlocks/example/FirstTransaction.java +++ b/SpringJava/DeadLocksSQL/src/main/java/de/example/sql/deadlocks/example/FirstTransaction.java @@ -49,8 +49,6 @@ public class FirstTransaction { } this.trx1Gate.close(); - trx2Gate.open(); - this.doThirdStep(); logger.info("End doFirstStepWithGate"); diff --git a/SpringJava/DeadLocksSQL/src/main/java/de/example/sql/deadlocks/example/SecondTransaction.java b/SpringJava/DeadLocksSQL/src/main/java/de/example/sql/deadlocks/example/SecondTransaction.java index 2dd9631..1d059f2 100644 --- a/SpringJava/DeadLocksSQL/src/main/java/de/example/sql/deadlocks/example/SecondTransaction.java +++ b/SpringJava/DeadLocksSQL/src/main/java/de/example/sql/deadlocks/example/SecondTransaction.java @@ -50,15 +50,6 @@ public class SecondTransaction { // trx1 continue trx1Gate.open(); - try { - this.trx2Gate.await(); - } catch (InterruptedException e) { - logger.warn("interrupt error", e); - - Thread.currentThread().interrupt(); - } - this.trx2Gate.close(); - this.doFourthStep(); logger.info("End doSecondStepWithGate");