Skip to content

Commit

Permalink
Remove ability to modify minConnections at runtime
Browse files Browse the repository at this point in the history
This was not publically exposed so more removing an unused method.
  • Loading branch information
rbygrave committed Jun 14, 2024
1 parent 2c410e6 commit 5d095d5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ final class ConnectionPool implements DataSourcePool {
private final AtomicBoolean dataSourceUp = new AtomicBoolean(false);
private SQLException dataSourceDownReason;
private final AtomicBoolean inWarningMode = new AtomicBoolean();
private int minConnections;
private final int minConnections;
private int maxConnections;
private int warningSize;
private final int waitTimeoutMillis;
Expand Down Expand Up @@ -197,8 +197,8 @@ private void initialiseConnections() throws SQLException {
}

final var ro = readOnly ? "readOnly[true] " : "";
Log.info("DataSource [{0}] {1}autoCommit[{2}] transIsolation[{3}] min[{4}] max[{5}] in[{6}ms]",
name, ro, autoCommit, description(transactionIsolation), minConnections, maxConnections, (System.currentTimeMillis() - start));
Log.info("DataSource [{0}] {1}autoCommit[{2}] [{3}] min[{4}] max[{5}] in[{6}ms]",
name, ro, autoCommit, description(transactionIsolation), minConnections, maxConnections, (System.currentTimeMillis() - start), validateOnHeartbeat);
}

/**
Expand Down Expand Up @@ -443,22 +443,14 @@ public void setMaxSize(int max) {
/**
* Return the max size this pool can grow to.
*/
public int getMaxSize() {
int getMaxSize() {
return maxConnections;
}

/**
* Set the min size this pool should maintain.
*/
public void setMinSize(int min) {
queue.setMinSize(min);
this.minConnections = min;
}

/**
* Return the min size this pool should maintain.
*/
public int getMinSize() {
int getMinSize() {
return minConnections;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ final class PooledConnectionQueue {
private final long waitTimeoutMillis;
private final long leakTimeMinutes;
private final long maxAgeMillis;
private final int minSize;
private int warningSize;
private int maxSize;
private int minSize;
/**
* Number of threads in the wait queue.
*/
Expand Down Expand Up @@ -115,18 +115,6 @@ PoolStatus status(boolean reset) {
}
}

void setMinSize(int minSize) {
lock.lock();
try {
if (minSize > this.maxSize) {
throw new IllegalArgumentException("minSize " + minSize + " > maxSize " + this.maxSize);
}
this.minSize = minSize;
} finally {
lock.unlock();
}
}

void setMaxSize(int maxSize) {
lock.lock();
try {
Expand Down

0 comments on commit 5d095d5

Please sign in to comment.