Skip to content

Commit 42e7f9e

Browse files
authored
Merge pull request #1675 from Dreamroute/master
Remove unnecessary code.
2 parents 834bb6f + bf5db14 commit 42e7f9e

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

src/main/java/org/apache/ibatis/executor/statement/StatementUtil.java

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2009-2016 the original author or authors.
2+
* Copyright 2009-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -41,17 +41,11 @@ private StatementUtil() {
4141
* @throws SQLException if a database access error occurs, this method is called on a closed <code>Statement</code>
4242
*/
4343
public static void applyTransactionTimeout(Statement statement, Integer queryTimeout, Integer transactionTimeout) throws SQLException {
44-
if (transactionTimeout == null){
44+
if (transactionTimeout == null) {
4545
return;
4646
}
47-
Integer timeToLiveOfQuery = null;
48-
if (queryTimeout == null || queryTimeout == 0) {
49-
timeToLiveOfQuery = transactionTimeout;
50-
} else if (transactionTimeout < queryTimeout) {
51-
timeToLiveOfQuery = transactionTimeout;
52-
}
53-
if (timeToLiveOfQuery != null) {
54-
statement.setQueryTimeout(timeToLiveOfQuery);
47+
if (queryTimeout == null || queryTimeout == 0 || transactionTimeout < queryTimeout) {
48+
statement.setQueryTimeout(transactionTimeout);
5549
}
5650
}
5751

0 commit comments

Comments
 (0)