Package io.dropwizard.db
Interface PooledDataSourceFactory
-
- All Known Implementing Classes:
DataSourceFactory
public interface PooledDataSourceFactory
Interface of a factory that produces JDBC data sources backed by the connection pool.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description void
asSingleConnectionPool()
Configures the pool as a single connection pool.ManagedDataSource
build(com.codahale.metrics.MetricRegistry metricRegistry, String name)
Builds a new JDBC data source backed by the connection pool and managed by Dropwizard.String
getDriverClass()
Returns the Java class of the database driver.String
getHealthCheckValidationQuery()
Deprecated.Optional<Duration>
getHealthCheckValidationTimeout()
Deprecated.Map<String,String>
getProperties()
Returns the configuration properties for ORM tools.String
getUrl()
Returns the JDBC connection URL.Optional<String>
getValidationQuery()
Returns the SQL query, which is being used for the database connection health check.Optional<Duration>
getValidationQueryTimeout()
Returns the timeout for awaiting a response from the database during connection health checks.boolean
isAutoCommentsEnabled()
Whether ORM tools allowed to add comments to SQL queries.
-
-
-
Method Detail
-
isAutoCommentsEnabled
boolean isAutoCommentsEnabled()
Whether ORM tools allowed to add comments to SQL queries.- Returns:
true
, if allowed
-
getProperties
Map<String,String> getProperties()
Returns the configuration properties for ORM tools.- Returns:
- configuration properties as a map
-
getValidationQueryTimeout
Optional<Duration> getValidationQueryTimeout()
Returns the timeout for awaiting a response from the database during connection health checks.- Returns:
- the timeout as
Duration
-
getHealthCheckValidationTimeout
@Deprecated Optional<Duration> getHealthCheckValidationTimeout()
Deprecated.Returns the timeout for awaiting a response from the database during connection health checks.- Returns:
- the timeout as
Duration
-
getValidationQuery
Optional<String> getValidationQuery()
Returns the SQL query, which is being used for the database connection health check.- Returns:
- the SQL query as a string
-
getHealthCheckValidationQuery
@Deprecated String getHealthCheckValidationQuery()
Deprecated.Returns the SQL query, which is being used for the database connection health check.- Returns:
- the SQL query as a string
-
getDriverClass
String getDriverClass()
Returns the Java class of the database driver.- Returns:
- the JDBC driver class as a string
-
getUrl
String getUrl()
Returns the JDBC connection URL.- Returns:
- the JDBC connection URL as a string
-
asSingleConnectionPool
void asSingleConnectionPool()
Configures the pool as a single connection pool. It's useful for tools that use only one database connection, such as database migrations.
-
build
ManagedDataSource build(com.codahale.metrics.MetricRegistry metricRegistry, String name)
Builds a new JDBC data source backed by the connection pool and managed by Dropwizard.- Parameters:
metricRegistry
- the application metric registryname
- name of the connection pool- Returns:
- a new JDBC data source as
ManagedDataSource
-
-