From dd0f8bbefb05bb1a3d4ab419c8aa57ad2f8eb83e Mon Sep 17 00:00:00 2001 From: Hylke van der Schaaf Date: Mon, 4 Jun 2018 11:55:43 +0200 Subject: [PATCH] Exposed database connection options conn.max, conn.idle.max, conn.idle.min --- CHANGELOG.md | 10 ++++++++-- .../postgres/PostgresPersistenceManager.java | 4 +++- docs/settings.adoc | 3 +++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1254002e4..c187ea000 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,9 +2,15 @@ # Release Version 1.7 Version 1.7 is not released yet. +**New Features** +* Observation.result can be explicitly set to null. This is useful in cases where + an observation did not produce a value, but the fact that an observation was attempted + must still be recorded. +* Exposed database connection options `persistence.db.conn.max`, `persistence.db.conn.idle.max`, `persistence.db.conn.idle.min` + **Bugfixes** -Fixed #53: Query parser not Unicode aware. -Fixed #52: Generating FeatureOfInterest did not work for Things with multiple Location entities when some of these entities were not geoJSON. +* Fixed #53: Query parser not Unicode aware. +* Fixed #52: Generating FeatureOfInterest did not work for Things with multiple Location entities when some of these entities were not geoJSON. # Release Version 1.6 diff --git a/FROST-Server.SQL/src/main/java/de/fraunhofer/iosb/ilt/sta/persistence/postgres/PostgresPersistenceManager.java b/FROST-Server.SQL/src/main/java/de/fraunhofer/iosb/ilt/sta/persistence/postgres/PostgresPersistenceManager.java index 2d62bb5af..8d26cbf7f 100644 --- a/FROST-Server.SQL/src/main/java/de/fraunhofer/iosb/ilt/sta/persistence/postgres/PostgresPersistenceManager.java +++ b/FROST-Server.SQL/src/main/java/de/fraunhofer/iosb/ilt/sta/persistence/postgres/PostgresPersistenceManager.java @@ -51,7 +51,8 @@ public interface PostgresPersistenceManager { public static final String TAG_DB_USERNAME = "db.username"; public static final String TAG_DB_PASSWORD = "db.password"; public static final String TAG_DB_MAXCONN = "db.conn.max"; - public static final String TAG_DB_MAXIDLE = "db.conn.idle"; + public static final String TAG_DB_MAXIDLE = "db.conn.idle.max"; + public static final String TAG_DB_MINIDLE = "db.conn.idle.min"; public static final DateTime DATETIME_MAX = DateTime.parse("9999-12-31T23:59:59.999Z"); public static final DateTime DATETIME_MIN = DateTime.parse("-4000-01-01T00:00:00.000Z"); @@ -109,6 +110,7 @@ static ConnectionSource setupBasicDataSource(Settings settings) { ds.setPassword(settings.get(TAG_DB_PASSWORD)); ds.setMaxIdle(settings.getInt(TAG_DB_MAXIDLE, ds.getMaxIdle())); ds.setMaxTotal(settings.getInt(TAG_DB_MAXCONN, ds.getMaxTotal())); + ds.setMinIdle(settings.getInt(TAG_DB_MINIDLE, ds.getMinIdle())); return new ConnectionSourceBasicDataSource(ds); } catch (ClassNotFoundException exc) { LOGGER.error("Failed to set up a Connection pool for the database.", exc); diff --git a/docs/settings.adoc b/docs/settings.adoc index bd5650a2a..29bb9fe42 100644 --- a/docs/settings.adoc +++ b/docs/settings.adoc @@ -71,6 +71,9 @@ persistence.db.driver:: The Database driver to use when not using JNDI. For Post persistence.db.url:: The database connection url when not using JNDI. Example: `jdbc:postgresql://localhost:5432/sensorthings` persistence.db.username:: The username to use when connecting to the database when not using JNDI. persistence.db.password:: The password to use when connecting to the database when not using JNDI. +persistence.db.conn.max:: The maximum number of database connections to use, when not using JNDI. +persistence.db.conn.idle.max:: The maximum number of idle database connections to keep open, when not using JNDI. +persistence.db.conn.idle.min:: The minimum number of idle database connections to keep open, when not using JNDI. === message bus settings