Skip to content

Commit 6160216

Browse files
Merge pull request #58 from aquality-automation/feature/fix_deadlock
Feature/fix deadlock
2 parents 3363b01 + 06a8a9a commit 6160216

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
Features:
66
- [Doc] Update Swagger with Statistic endpoints -> [View Issue](https://github.com/aquality-automation/aquality-tracking/issues/76)
77

8+
Features:
9+
- [BUG] Import was finished with Error! You are trying to edit entity which is locked -> [View Issue](https://github.com/aquality-automation/aquality-tracking/issues/44)
810
## 0.3.7 (2020-03-02)
911

1012
Features:

src/main/java/main/model/db/dao/DAO.java

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -270,13 +270,22 @@ private CallableStatement executeCallableStatement(String sql, List<Pair<String,
270270
}
271271
}
272272

273-
try {
274-
callableStatement.execute();
275-
} catch (SQLException e) {
276-
throw new AqualitySQLException(e);
277-
}
273+
return tryExecute(callableStatement);
274+
}
278275

279-
return callableStatement;
276+
private CallableStatement tryExecute(CallableStatement callableStatement) throws AqualitySQLException {
277+
int counter = 0;
278+
SQLException lastException = null;
279+
while(counter < 5) {
280+
try {
281+
callableStatement.execute();
282+
return callableStatement;
283+
} catch (SQLException e) {
284+
counter++;
285+
lastException = e;
286+
}
287+
}
288+
throw new AqualitySQLException(lastException);
280289
}
281290

282291
private CallableStatement getCallableStatement(String sql) throws AqualityException {

0 commit comments

Comments
 (0)