Skip to content

Commit

Permalink
Review fixes:
Browse files Browse the repository at this point in the history
removed reference to c3p0 and set default values for the connection pool in the JdbcProperties class

Signed-off-by: Matthias Kaemmer <[email protected]>
  • Loading branch information
mattkaem committed Oct 9, 2023
1 parent d2e1e6a commit 7536dab
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
public class JdbcProperties {

private static final Logger log = LoggerFactory.getLogger(JdbcProperties.class);
private static final Integer MAXIMUM_POOL_SIZE_DEFAULT = 15;
private static final Integer MINIMUM_POOL_SIZE_DEFAULT = 3;
private static final Integer INITIAL_POOL_SIZE_DEFAULT = 3;
private static final Integer MAXIMUM_IDLE_TIME_DEFAULT = 3600;

private String url;
private String driverClass;
Expand Down Expand Up @@ -59,10 +63,10 @@ public JdbcProperties() {
public JdbcProperties(final JdbcOptions options) {
Objects.requireNonNull(options);
setDriverClass(options.driverClass());
options.maximumPoolSize().ifPresent(this::setMaximumPoolSize);
options.minimumPoolSize().ifPresent(this::setMinimumPoolSize);
options.initialPoolSize().ifPresent(this::setInitialPoolSize);
options.maximumIdleTime().ifPresent(this::setMaximumIdleTime);
options.maximumPoolSize().ifPresentOrElse(this::setMaximumPoolSize, () -> setMaximumPoolSize(MAXIMUM_POOL_SIZE_DEFAULT));
options.minimumPoolSize().ifPresentOrElse(this::setMinimumPoolSize, () -> setMinimumPoolSize(MINIMUM_POOL_SIZE_DEFAULT));
options.initialPoolSize().ifPresentOrElse(this::setInitialPoolSize, () -> setInitialPoolSize(INITIAL_POOL_SIZE_DEFAULT));
options.maximumIdleTime().ifPresentOrElse(this::setMaximumIdleTime, () -> setMaximumIdleTime(MAXIMUM_IDLE_TIME_DEFAULT));
options.password().ifPresent(this::setPassword);
options.tableName().ifPresent(this::setTableName);
setUrl(options.url());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,19 @@ and availability.
| `HONO_REGISTRY_JDBC_ADAPTER_DRIVERCLASS` <br> `hono.registry.jdbc.adapter.driverClass` | no | The default driver registered for the JDBC URL. | The class name of the JDBC driver.|
| `HONO_REGISTRY_JDBC_ADAPTER_USERNAME` <br> `hono.registry.jdbc.adapter.username` | no | - | The username used to access the database. |
| `HONO_REGISTRY_JDBC_ADAPTER_PASSWORD` <br> `hono.registry.jdbc.adapter.password` | no | - | The password used to access the database. |
| `HONO_REGISTRY_JDBC_ADAPTER_MAXIMUMPOOLSIZE` <br> `hono.registry.jdbc.adapter.maximumPoolSize` | no | Depends on the connection pool implementation. `15` for C3P0. | The maximum size of the connection pool. |
| `HONO_REGISTRY_JDBC_ADAPTER_MINIMUMPOOLSIZE` <br> `hono.registry.jdbc.adapter.minimumPoolSize` | no | Depends on the connection pool implementation. `3` for C3P0. | The minimum size of the connection pool. |
| `HONO_REGISTRY_JDBC_ADAPTER_INITIALPOOLSIZE` <br> `hono.registry.jdbc.adapter.initialPoolSize` | no | Depends on the connection pool implementation. `3` for C3P0. | Number of connections a pool will try to acquire upon startup. Should be between minPoolSize and maxPoolSize. |
| `HONO_REGISTRY_JDBC_ADAPTER_MAXIMUMIDLETIME` <br> `hono.registry.jdbc.adapter.maximumIdleTime` | no | Depends on the connection pool implementation. `0` for C3P0. | Seconds a connection can remain pooled but unused before being discarded. Zero means idle connections never expire. |
| `HONO_REGISTRY_JDBC_ADAPTER_MAXIMUMPOOLSIZE` <br> `hono.registry.jdbc.adapter.maximumPoolSize` | no | `15` | The maximum size of the connection pool. |
| `HONO_REGISTRY_JDBC_ADAPTER_MINIMUMPOOLSIZE` <br> `hono.registry.jdbc.adapter.minimumPoolSize` | no | `3` | The minimum size of the connection pool. |
| `HONO_REGISTRY_JDBC_ADAPTER_INITIALPOOLSIZE` <br> `hono.registry.jdbc.adapter.initialPoolSize` | no | `3` | Number of connections a pool will try to acquire upon startup. Should be between minPoolSize and maxPoolSize. |
| `HONO_REGISTRY_JDBC_ADAPTER_MAXIMUMIDLETIME` <br> `hono.registry.jdbc.adapter.maximumIdleTime` | no | `3600` | Seconds a connection can remain pooled but unused before being discarded. Zero means idle connections never expire. |
| `HONO_REGISTRY_JDBC_ADAPTER_TABLENAME` <br> `hono.registry.jdbc.adapter.tableName` | no | - | The name of the table the datastore uses. If the datastore requires multiple tables, this is the prefix. |
| `HONO_REGISTRY_JDBC_MANAGEMENT_URL` <br> `hono.registry.jdbc.management.url` | yes | - | The JDBC URL to the database. |
| `HONO_REGISTRY_JDBC_MANAGEMENT_DRIVERCLASS` <br> `hono.registry.jdbc.management.driverClass` | no | The default driver registered for the JDBC URL. | The class name of the JDBC driver. |
| `HONO_REGISTRY_JDBC_MANAGEMENT_USERNAME` <br> `hono.registry.jdbc.management.username` | no | - | The username used to access the database. |
| `HONO_REGISTRY_JDBC_MANAGEMENT_PASSWORD` <br> `hono.registry.jdbc.management.password` | no | - | The password used to access the database. |
| `HONO_REGISTRY_JDBC_MANAGEMENT_MAXIMUMPOOLSIZE` <br> `hono.registry.jdbc.management.maximumPoolSize` | no | Depends on the connection pool implementation. `15` for C3P0. | The maximum size of the connection pool. |
| `HONO_REGISTRY_JDBC_MANAGEMENT_MINIMUMPOOLSIZE` <br> `hono.registry.jdbc.management.minimumPoolSize` | no | Depends on the connection pool implementation. `3` for C3P0. | The minimum size of the connection pool. |
| `HONO_REGISTRY_JDBC_MANAGEMENT_INITIALPOOLSIZE` <br> `hono.registry.jdbc.management.initialPoolSize` | no | Depends on the connection pool implementation. `3` for C3P0. | Number of connections a pool will try to acquire upon startup. Should be between minPoolSize and maxPoolSize. |
| `HONO_REGISTRY_JDBC_MANAGEMENT_MAXIMUMIDLETIME` <br> `hono.registry.jdbc.management.maximumIdleTime` | no | Depends on the connection pool implementation. `0` for C3P0. | Seconds a connection can remain pooled but unused before being discarded. Zero means idle connections never expire. |
| `HONO_REGISTRY_JDBC_MANAGEMENT_MAXIMUMPOOLSIZE` <br> `hono.registry.jdbc.management.maximumPoolSize` | no | `15` | The maximum size of the connection pool. |
| `HONO_REGISTRY_JDBC_MANAGEMENT_MINIMUMPOOLSIZE` <br> `hono.registry.jdbc.management.minimumPoolSize` | no | `3` | The minimum size of the connection pool. |
| `HONO_REGISTRY_JDBC_MANAGEMENT_INITIALPOOLSIZE` <br> `hono.registry.jdbc.management.initialPoolSize` | no | `3` | Number of connections a pool will try to acquire upon startup. Should be between minPoolSize and maxPoolSize. |
| `HONO_REGISTRY_JDBC_MANAGEMENT_MAXIMUMIDLETIME` <br> `hono.registry.jdbc.management.maximumIdleTime` | no | `3600` | Seconds a connection can remain pooled but unused before being discarded. Zero means idle connections never expire. |
| `HONO_REGISTRY_JDBC_MANAGEMENT_TABLENAME` <br> `hono.registry.jdbc.management.tableName` | no | - | The name of the table the datastore uses. If the datastore requires multiple tables, this is the prefix. |
| `HONO_REGISTRY_SVC_CREDENTIALSTTL` <br> `hono.registry.svc.credentialsTtl` | no | `1m` | The TTL for credentials responses. |
| `HONO_REGISTRY_SVC_HASHALGORITHMSWHITELIST` <br> `hono.registry.svc.hashAlgorithmsWhitelist` | no | `empty` | An array of supported hashing algorithms to be used with the `hashed-password` type of credentials. When not set, all values will be accepted. |
Expand All @@ -89,19 +89,19 @@ and availability.
| `HONO_TENANT_JDBC_ADAPTER_DRIVERCLASS` <br> `hono.tenant.jdbc.adapter.driverClass` | no | The default driver registered for the JDBC URL. | The class name of the JDBC driver.|
| `HONO_TENANT_JDBC_ADAPTER_USERNAME` <br> `hono.tenant.jdbc.adapter.username` | no | - | The username used to access the database. |
| `HONO_TENANT_JDBC_ADAPTER_PASSWORD` <br> `hono.tenant.jdbc.adapter.password` | no | - | The password used to access the database. |
| `HONO_TENANT_JDBC_ADAPTER_MAXIMUMPOOLSIZE` <br> `hono.tenant.jdbc.adapter.maximumPoolSize` | no | Depends on the connection pool implementation. `15` for C3P0. | The maximum size of the connection pool. |
| `HONO_TENANT_JDBC_ADAPTER_MINIMUMPOOLSIZE` <br> `hono.tenant.jdbc.adapter.minimumPoolSize` | no | Depends on the connection pool implementation. `3` for C3P0. | The minimum size of the connection pool. |
| `HONO_TENANT_JDBC_ADAPTER_INITIALPOOLSIZE` <br> `hono.tenant.jdbc.adapter.initialPoolSize` | no | Depends on the connection pool implementation. `3` for C3P0. | Number of connections a pool will try to acquire upon startup. Should be between minPoolSize and maxPoolSize. |
| `HONO_TENANT_JDBC_ADAPTER_MAXIMUMIDLETIME` <br> `hono.tenant.jdbc.adapter.maximumIdleTime` | no | Depends on the connection pool implementation. `0` for C3P0. | Seconds a connection can remain pooled but unused before being discarded. Zero means idle connections never expire. |
| `HONO_TENANT_JDBC_ADAPTER_MAXIMUMPOOLSIZE` <br> `hono.tenant.jdbc.adapter.maximumPoolSize` | no | `15` | The maximum size of the connection pool. |
| `HONO_TENANT_JDBC_ADAPTER_MINIMUMPOOLSIZE` <br> `hono.tenant.jdbc.adapter.minimumPoolSize` | no | `3` | The minimum size of the connection pool. |
| `HONO_TENANT_JDBC_ADAPTER_INITIALPOOLSIZE` <br> `hono.tenant.jdbc.adapter.initialPoolSize` | no | `3` | Number of connections a pool will try to acquire upon startup. Should be between minPoolSize and maxPoolSize. |
| `HONO_TENANT_JDBC_ADAPTER_MAXIMUMIDLETIME` <br> `hono.tenant.jdbc.adapter.maximumIdleTime` | no | `3600` | Seconds a connection can remain pooled but unused before being discarded. Zero means idle connections never expire. |
| `HONO_TENANT_JDBC_ADAPTER_TABLENAME` <br> `hono.tenant.jdbc.adapter.tableName` | no | - | The name of the table the datastore uses. If the datastore requires multiple tables, this is the prefix. |
| `HONO_TENANT_JDBC_MANAGEMENT_URL` <br> `hono.tenant.jdbc.management.url` | yes | - | The JDBC URL to the database. |
| `HONO_TENANT_JDBC_MANAGEMENT_DRIVERCLASS` <br> `hono.tenant.jdbc.management.driverClass` | no | The default driver registered for the JDBC URL. | The class name of the JDBC driver. |
| `HONO_TENANT_JDBC_MANAGEMENT_USERNAME` <br> `hono.tenant.jdbc.management.username` | no | - | The username used to access the database. |
| `HONO_TENANT_JDBC_MANAGEMENT_PASSWORD` <br> `hono.tenant.jdbc.management.password` | no | - | The password used to access the database. |
| `HONO_TENANT_JDBC_MANAGEMENT_MAXIMUMPOOLSIZE` <br> `hono.tenant.jdbc.management.maximumPoolSize` | no | Depends on the connection pool implementation. `15` for C3P0. | The maximum size of the connection pool. |
| `HONO_TENANT_JDBC_MANAGEMENT_MINIMUMPOOLSIZE` <br> `hono.tenant.jdbc.management.minimumPoolSize` | no | Depends on the connection pool implementation. `3` for C3P0. | The minimum size of the connection pool. |
| `HONO_TENANT_JDBC_MANAGEMENT_INITIALPOOLSIZE` <br> `hono.tenant.jdbc.management.initialPoolSize` | no | Depends on the connection pool implementation. `3` for C3P0. | Number of connections a pool will try to acquire upon startup. Should be between minPoolSize and maxPoolSize. |
| `HONO_TENANT_JDBC_MANAGEMENT_MAXIMUMIDLETIME` <br> `hono.tenant.jdbc.management.maximumIdleTime` | no | Depends on the connection pool implementation. `0` for C3P0. | Seconds a connection can remain pooled but unused before being discarded. Zero means idle connections never expire. |
| `HONO_TENANT_JDBC_MANAGEMENT_MAXIMUMPOOLSIZE` <br> `hono.tenant.jdbc.management.maximumPoolSize` | no | `15` | The maximum size of the connection pool. |
| `HONO_TENANT_JDBC_MANAGEMENT_MINIMUMPOOLSIZE` <br> `hono.tenant.jdbc.management.minimumPoolSize` | no | `3` | The minimum size of the connection pool. |
| `HONO_TENANT_JDBC_MANAGEMENT_INITIALPOOLSIZE` <br> `hono.tenant.jdbc.management.initialPoolSize` | no | `3` | Number of connections a pool will try to acquire upon startup. Should be between minPoolSize and maxPoolSize. |
| `HONO_TENANT_JDBC_MANAGEMENT_MAXIMUMIDLETIME` <br> `hono.tenant.jdbc.management.maximumIdleTime` | no | `3600` | Seconds a connection can remain pooled but unused before being discarded. Zero means idle connections never expire. |
| `HONO_TENANT_JDBC_MANAGEMENT_TABLENAME` <br> `hono.tenant.jdbc.management.tableName` | no | - | The name of the table the datastore uses. If the datastore requires multiple tables, this is the prefix. |
| `HONO_TENANT_SVC_TENANTTTL` <br> `hono.tenant.service.tenantTtl` | no | `1m` | The TTL for tenant responses. |

Expand Down

0 comments on commit 7536dab

Please sign in to comment.