Skip to content

Commit

Permalink
Permit a zero value for the scavenge interval configuration option. T…
Browse files Browse the repository at this point in the history
…he JavaDoc says you can set a zero value to disable the scavenger, and the ObjectPool respects this, but setScavengeIntervalMilliseconds throws an exception if you try to actually set the interval to zero.

Closes #38
  • Loading branch information
ianroberts committed Oct 17, 2021
1 parent 7b5932e commit 8217e8f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/cn/danielw/fop/PoolConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ public int getScavengeIntervalMilliseconds() {
* @return the pool config
*/
public PoolConfig setScavengeIntervalMilliseconds(int scavengeIntervalMilliseconds) {
if (scavengeIntervalMilliseconds < 5000) {
if (scavengeIntervalMilliseconds != 0 && scavengeIntervalMilliseconds < 5000) {
throw new IllegalArgumentException("Cannot set interval too short (" + scavengeIntervalMilliseconds +
"), must be at least 5 seconds");
"), must be at least 5 seconds, or zero to disable scavenger");
}
this.scavengeIntervalMilliseconds = scavengeIntervalMilliseconds;
return this;
Expand Down

0 comments on commit 8217e8f

Please sign in to comment.