From 630119b1be94a85ce726e089d36ce26b932c34a8 Mon Sep 17 00:00:00 2001 From: brinn <brinn> Date: Mon, 1 Oct 2012 11:33:27 +0000 Subject: [PATCH] Max max database connections easier to configure. SVN: 26866 --- .../cisd/dbmigration/BasicDataSourceFactory.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/dbmigration/source/java/ch/systemsx/cisd/dbmigration/BasicDataSourceFactory.java b/dbmigration/source/java/ch/systemsx/cisd/dbmigration/BasicDataSourceFactory.java index 45481aa4070..016786e6ace 100644 --- a/dbmigration/source/java/ch/systemsx/cisd/dbmigration/BasicDataSourceFactory.java +++ b/dbmigration/source/java/ch/systemsx/cisd/dbmigration/BasicDataSourceFactory.java @@ -49,6 +49,10 @@ public class BasicDataSourceFactory implements IDataSourceFactory private int activeNumConnectionsLogThreshold = DEFAULT_ACTIVE_NUM_CONNECTIONS_LOG_THRESHOLD; + private boolean activeNumConnectionLogThresholdIsDefault = true; + + private boolean maxIdleIsDefault = true; + private boolean logStackTraceOnConnectionLogging = false; // @@ -96,6 +100,7 @@ public class BasicDataSourceFactory implements IDataSourceFactory public void setMaxIdle(int maxIdle) { this.maxIdle = maxIdle; + this.maxIdleIsDefault = false; } @Override @@ -108,6 +113,14 @@ public class BasicDataSourceFactory implements IDataSourceFactory public void setMaxActive(int maxActive) { this.maxActive = maxActive; + if (activeNumConnectionLogThresholdIsDefault) + { + this.activeNumConnectionsLogThreshold = (int) (0.8 * maxActive); + } + if (maxIdleIsDefault) + { + this.maxIdle = maxActive; + } } @Override @@ -132,6 +145,7 @@ public class BasicDataSourceFactory implements IDataSourceFactory public void setActiveNumConnectionsLogThreshold(int activeConnectionsLogThreshold) { this.activeNumConnectionsLogThreshold = activeConnectionsLogThreshold; + this.activeNumConnectionLogThresholdIsDefault = false; } @Override -- GitLab