99
1010/**
1111 * Configuration information for a DataSource.
12+ *
13+ * <pre>{@code
14+ *
15+ * DataSourceConfig config = new DataSourceConfig()
16+ * .setUrl("jdbc:postgresql://127.0.0.1:5432/unit");
17+ * .setUsername("foo");
18+ * .setPassword("bar");
19+ *
20+ * DataSource pool = DataSourceFactory.create("app", config);
21+ *
22+ * }</pre>
1223 */
1324public class DataSourceConfig {
1425
@@ -381,8 +392,7 @@ public DataSourceConfig setListener(DataSourcePoolListener listener) {
381392 /**
382393 * Return a SQL statement used to test the database is accessible.
383394 * <p>
384- * Note that if this is not set then it can get defaulted from the
385- * DatabasePlatform.
395+ * Note that if this is not set then it can get defaulted from the DatabasePlatform.
386396 */
387397 public String getHeartbeatSql () {
388398 return heartbeatSql ;
@@ -391,8 +401,7 @@ public String getHeartbeatSql() {
391401 /**
392402 * Set a SQL statement used to test the database is accessible.
393403 * <p>
394- * Note that if this is not set then it can get defaulted from the
395- * DatabasePlatform.
404+ * Note that if this is not set then it can get defaulted from the DatabasePlatform.
396405 */
397406 public DataSourceConfig setHeartbeatSql (String heartbeatSql ) {
398407 this .heartbeatSql = heartbeatSql ;
@@ -433,8 +442,7 @@ public DataSourceConfig setHeartbeatTimeoutSeconds(int heartbeatTimeoutSeconds)
433442 }
434443
435444 /**
436- * Return true if a stack trace should be captured when obtaining a connection
437- * from the pool.
445+ * Return true if a stack trace should be captured when obtaining a connection from the pool.
438446 * <p>
439447 * This can be used to diagnose a suspected connection pool leak.
440448 * <p>
@@ -445,8 +453,7 @@ public boolean isCaptureStackTrace() {
445453 }
446454
447455 /**
448- * Set to true if a stack trace should be captured when obtaining a connection
449- * from the pool.
456+ * Set to true if a stack trace should be captured when obtaining a connection from the pool.
450457 * <p>
451458 * This can be used to diagnose a suspected connection pool leak.
452459 * <p>
@@ -473,16 +480,14 @@ public DataSourceConfig setMaxStackTraceSize(int maxStackTraceSize) {
473480 }
474481
475482 /**
476- * Return the time in minutes after which a connection could be considered to
477- * have leaked.
483+ * Return the time in minutes after which a connection could be considered to have leaked.
478484 */
479485 public int getLeakTimeMinutes () {
480486 return leakTimeMinutes ;
481487 }
482488
483489 /**
484- * Set the time in minutes after which a connection could be considered to
485- * have leaked.
490+ * Set the time in minutes after which a connection could be considered to have leaked.
486491 */
487492 public DataSourceConfig setLeakTimeMinutes (int leakTimeMinutes ) {
488493 this .leakTimeMinutes = leakTimeMinutes ;
@@ -550,7 +555,7 @@ public int getMaxInactiveTimeSecs() {
550555 /**
551556 * Return the maximum age a connection is allowed to be before it is closed.
552557 * <p>
553- * This can be used to close really old connections.
558+ * This can be used to close old connections.
554559 */
555560 public int getMaxAgeMinutes () {
556561 return maxAgeMinutes ;
@@ -815,10 +820,10 @@ public boolean useInitDatabase() {
815820 * You can use this when you have your own properties to use for configuration.
816821 *
817822 * @param properties the properties to configure the dataSource
818- * @param serverName the name of the specific dataSource (optional)
823+ * @param poolName the name of the specific dataSource pool (optional)
819824 */
820- public DataSourceConfig loadSettings (Properties properties , String serverName ) {
821- ConfigPropertiesHelper dbProps = new ConfigPropertiesHelper ("datasource" , serverName , properties );
825+ public DataSourceConfig loadSettings (Properties properties , String poolName ) {
826+ ConfigPropertiesHelper dbProps = new ConfigPropertiesHelper ("datasource" , poolName , properties );
822827 loadSettings (dbProps );
823828 return this ;
824829 }
0 commit comments