This is an automated email from the ASF dual-hosted git repository.
adamsaghy pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract.git
The following commit(s) were added to refs/heads/develop by this push:
new 23850a1b7 FINERACT-2081: Fix `Connection is not available, request
timed out after 30000ms` issue of "read-only" check
23850a1b7 is described below
commit 23850a1b731214ad3730a3172cadbc935f70b6d5
Author: Adam Saghy <[email protected]>
AuthorDate: Thu Dec 19 17:55:12 2024 +0100
FINERACT-2081: Fix `Connection is not available, request timed out after
30000ms` issue of "read-only" check
---
.../core/persistence/ExtendedJpaTransactionManager.java | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git
a/fineract-core/src/main/java/org/apache/fineract/infrastructure/core/persistence/ExtendedJpaTransactionManager.java
b/fineract-core/src/main/java/org/apache/fineract/infrastructure/core/persistence/ExtendedJpaTransactionManager.java
index c8716ff83..37b04b999 100644
---
a/fineract-core/src/main/java/org/apache/fineract/infrastructure/core/persistence/ExtendedJpaTransactionManager.java
+++
b/fineract-core/src/main/java/org/apache/fineract/infrastructure/core/persistence/ExtendedJpaTransactionManager.java
@@ -25,6 +25,7 @@ import java.sql.SQLException;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.function.Consumer;
+import org.springframework.jdbc.datasource.DataSourceUtils;
import org.springframework.jdbc.datasource.JdbcTransactionObjectSupport;
import org.springframework.orm.jpa.EntityManagerHolder;
import org.springframework.orm.jpa.JpaTransactionManager;
@@ -65,10 +66,13 @@ public class ExtendedJpaTransactionManager extends
JpaTransactionManager {
}
public boolean isReadOnlyConnection() {
- try (Connection connection = getDataSource().getConnection()) {
+ Connection connection = DataSourceUtils.getConnection(getDataSource());
+ try {
return connection.isReadOnly();
} catch (SQLException e) {
throw new IllegalStateException(e);
+ } finally {
+ DataSourceUtils.releaseConnection(connection, getDataSource());
}
}