Skip to content
Snippets Groups Projects
Commit 630119b1 authored by brinn's avatar brinn
Browse files

Max max database connections easier to configure.

SVN: 26866
parent acac2a2c
No related branches found
No related tags found
No related merge requests found
...@@ -49,6 +49,10 @@ public class BasicDataSourceFactory implements IDataSourceFactory ...@@ -49,6 +49,10 @@ public class BasicDataSourceFactory implements IDataSourceFactory
private int activeNumConnectionsLogThreshold = DEFAULT_ACTIVE_NUM_CONNECTIONS_LOG_THRESHOLD; private int activeNumConnectionsLogThreshold = DEFAULT_ACTIVE_NUM_CONNECTIONS_LOG_THRESHOLD;
private boolean activeNumConnectionLogThresholdIsDefault = true;
private boolean maxIdleIsDefault = true;
private boolean logStackTraceOnConnectionLogging = false; private boolean logStackTraceOnConnectionLogging = false;
// //
...@@ -96,6 +100,7 @@ public class BasicDataSourceFactory implements IDataSourceFactory ...@@ -96,6 +100,7 @@ public class BasicDataSourceFactory implements IDataSourceFactory
public void setMaxIdle(int maxIdle) public void setMaxIdle(int maxIdle)
{ {
this.maxIdle = maxIdle; this.maxIdle = maxIdle;
this.maxIdleIsDefault = false;
} }
@Override @Override
...@@ -108,6 +113,14 @@ public class BasicDataSourceFactory implements IDataSourceFactory ...@@ -108,6 +113,14 @@ public class BasicDataSourceFactory implements IDataSourceFactory
public void setMaxActive(int maxActive) public void setMaxActive(int maxActive)
{ {
this.maxActive = maxActive; this.maxActive = maxActive;
if (activeNumConnectionLogThresholdIsDefault)
{
this.activeNumConnectionsLogThreshold = (int) (0.8 * maxActive);
}
if (maxIdleIsDefault)
{
this.maxIdle = maxActive;
}
} }
@Override @Override
...@@ -132,6 +145,7 @@ public class BasicDataSourceFactory implements IDataSourceFactory ...@@ -132,6 +145,7 @@ public class BasicDataSourceFactory implements IDataSourceFactory
public void setActiveNumConnectionsLogThreshold(int activeConnectionsLogThreshold) public void setActiveNumConnectionsLogThreshold(int activeConnectionsLogThreshold)
{ {
this.activeNumConnectionsLogThreshold = activeConnectionsLogThreshold; this.activeNumConnectionsLogThreshold = activeConnectionsLogThreshold;
this.activeNumConnectionLogThresholdIsDefault = false;
} }
@Override @Override
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment