public static final class PoolConfig.Builder extends Object
PoolConfig
objects.Modifier and Type | Method and Description |
---|---|
PoolConfig |
build()
Creates a new
PoolConfig object based on the settings of this builder. |
PoolConfig.Builder |
withInitialSize(int initialSize)
Sets the initial pool size.
|
PoolConfig.Builder |
withMaxIdleTime(Duration maxIdleTime)
Sets the maximum time that objects can be idle.
|
PoolConfig.Builder |
withMaxSize(int maxSize)
Sets the maximum pool size.
|
PoolConfig.Builder |
withMaxWaitTime(Duration maxWaitTime)
Sets the maximum time to wait when acquiring objects using
Pool.acquire() or Pool.acquire(Supplier) . |
public PoolConfig.Builder withMaxWaitTime(Duration maxWaitTime)
Pool.acquire()
or Pool.acquire(Supplier)
.
If null
or negative, acquiring objects should block until an object is available.
The default is to wait indefinitely.maxWaitTime
- The maximum wait time.public PoolConfig.Builder withMaxIdleTime(Duration maxIdleTime)
maxIdleTime
- The maximum idle time, or null
if objects can be idle indefinitely.public PoolConfig.Builder withInitialSize(int initialSize)
If the maximum pool size is smaller than the given initial size, it will be set to be equal to the given initial size.
initialSize
- The initial pool size.IllegalArgumentException
- If the initial size is negative.public PoolConfig.Builder withMaxSize(int maxSize)
If the initial pool size is larger than the given maximum size, it will be set to be equal to the given maximum size.
maxSize
- The maximum pool size.IllegalArgumentException
- If the given size is not positive.public PoolConfig build()
PoolConfig
object based on the settings of this builder.PoolConfig
object.Copyright © 2022. All rights reserved.