Skip to content

Commit

Permalink
Merge pull request #878 from 9tigerio/feature/777_max_connections
Browse files Browse the repository at this point in the history
#777 - introduce new parameter max pool size or maximum no of connect…
  • Loading branch information
kdhrubo authored Mar 9, 2025
2 parents d63264b + 2cb6b08 commit 831f181
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ private DataSource buildDataSource(DatabaseConnectionDetail connectionDetail) {
config.setJdbcUrl(connectionDetail.url());
config.setUsername(connectionDetail.username());
config.setPassword(connectionDetail.password());
config.setMaximumPoolSize(connectionDetail.maxConnections());

config.setAutoCommit(false);
return new HikariDataSource(config);
Expand Down
1 change: 1 addition & 0 deletions api-rest/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ app:
username: ${DB_USER}
password: ${DB_PASSWORD}
schemas: ${INCLUDED_SCHEMAS:}
maxConnections: ${MAX_POOL_SIZE:5}

server:
port: ${SERVER_PORT:8080}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@ public final class JdbcManager {
private final Map<String, DbDetailHolder> dbDetailHolderMap = new ConcurrentHashMap<>();
private final Map<String, NamedParameterJdbcTemplate> namedParameterJdbcTemplateMap =
new ConcurrentHashMap<>();
/*
private final Map<String, JdbcTransactionManager> jdbcTransactionManagerMap =
new ConcurrentHashMap<>();

*/
private final Map<String, TransactionTemplate> transactionTemplateMap =
new ConcurrentHashMap<>();

Expand Down Expand Up @@ -101,7 +102,7 @@ private void loadAllMetaData() {

JdbcTransactionManager jdbcTransactionManager = new JdbcTransactionManager(ds);

this.jdbcTransactionManagerMap.put((String) dbId, jdbcTransactionManager);
//this.jdbcTransactionManagerMap.put((String) dbId, jdbcTransactionManager);
this.transactionTemplateMap.put((String) dbId, new TransactionTemplate(jdbcTransactionManager));

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,13 @@ public record DatabaseConnectionDetail(String id, String type, String url, Strin
String password, String database
, List<String> catalog, List<String> schemas, List<String> tables,
Map<String, String> connectionProperties,
EnvironmentProperties envProperties) {
EnvironmentProperties envProperties, int maxConnections) {
public boolean isMongo() {
return StringUtils.equalsIgnoreCase(type, "MONGO");
}

public boolean isJdbcPresent() {

return StringUtils.isNotBlank(url);

// && !StringUtils.equalsIgnoreCase(url, "${DB_URL}");
}

public boolean includeAllSchemas() {
Expand Down

0 comments on commit 831f181

Please sign in to comment.