Skip to content

Commit 1d81787

Browse files
committed
Validate maxLifetime & idleTimeout and document their zero values.
1 parent 51e6760 commit 1d81787

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

vertx-sql-client/src/main/java/io/vertx/sqlclient/PoolOptions.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,12 +188,13 @@ public int getIdleTimeout() {
188188
}
189189

190190
/**
191-
* Establish an idle timeout for pooled connections.
191+
* Establish an idle timeout for pooled connections, a value of zero disables the idle timeout.
192192
*
193193
* @param idleTimeout the pool connection idle timeout
194194
* @return a reference to this, so the API can be used fluently
195195
*/
196196
public PoolOptions setIdleTimeout(int idleTimeout) {
197+
Arguments.require(idleTimeout >= 0, "idleTimeout must be >= 0");
197198
this.idleTimeout = idleTimeout;
198199
return this;
199200
}
@@ -224,12 +225,13 @@ public int getMaxLifetime() {
224225
}
225226

226227
/**
227-
* Establish a max lifetime for pooled connections.
228+
* Establish a max lifetime for pooled connections, a value of zero disables the maximum lifetime.
228229
*
229230
* @param maxLifetime the pool connection max lifetime
230231
* @return a reference to this, so the API can be used fluently
231232
*/
232233
public PoolOptions setMaxLifetime(int maxLifetime) {
234+
Arguments.require(maxLifetime >= 0, "maxLifetime must be >= 0");
233235
this.maxLifetime = maxLifetime;
234236
return this;
235237
}

0 commit comments

Comments
 (0)