Class FTPPoolConfig.Builder
- java.lang.Object
-
- com.github.robtimus.filesystems.ftp.FTPPoolConfig.Builder
-
- Enclosing class:
- FTPPoolConfig
public static final class FTPPoolConfig.Builder extends Object
A builder forFTPPoolConfig
objects.- Author:
- Rob Spoor
- Since:
- 3.0
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FTPPoolConfig
build()
Creates a newFTPPoolConfig
object based on the settings of this builder.FTPPoolConfig.Builder
withInitialSize(int initialSize)
Sets the initial pool size.FTPPoolConfig.Builder
withMaxIdleTime(Duration maxIdleTime)
Sets the maximum time that client connections can be idle.FTPPoolConfig.Builder
withMaxSize(int maxSize)
Sets the maximum pool size.FTPPoolConfig.Builder
withMaxWaitTime(Duration maxWaitTime)
Sets the maximum time to wait when acquiring client connections.
-
-
-
Method Detail
-
withMaxWaitTime
public FTPPoolConfig.Builder withMaxWaitTime(Duration maxWaitTime)
Sets the maximum time to wait when acquiring client connections. Ifnull
or negative, acquiring client connections should block until a connection is available. The default is to wait indefinitely.- Parameters:
maxWaitTime
- The maximum wait time.- Returns:
- This builder.
-
withMaxIdleTime
public FTPPoolConfig.Builder withMaxIdleTime(Duration maxIdleTime)
Sets the maximum time that client connections can be idle. The default is indefinitely.- Parameters:
maxIdleTime
- The maximum idle time, ornull
if client connections can be idle indefinitely.- Returns:
- This builder.
-
withInitialSize
public FTPPoolConfig.Builder withInitialSize(int initialSize)
Sets the initial pool size. This is the number of idle client connections to start with. The default is 1.If the maximum pool size is smaller than the given initial size, it will be set to be equal to the given initial size.
- Parameters:
initialSize
- The initial pool size.- Returns:
- This builder.
- Throws:
IllegalArgumentException
- If the initial size is negative.
-
withMaxSize
public FTPPoolConfig.Builder withMaxSize(int maxSize)
Sets the maximum pool size. This is the maximum number of client connections, both idle and currently in use. The default is 5.If the initial pool size is larger than the given maximum size, it will be set to be equal to the given maximum size.
- Parameters:
maxSize
- The maximum pool size.- Returns:
- This builder.
- Throws:
IllegalArgumentException
- If the given size is not positive.
-
build
public FTPPoolConfig build()
Creates a newFTPPoolConfig
object based on the settings of this builder.- Returns:
- The created
FTPPoolConfig
object.
-
-