Package com.lucimber.dbus.connection
Class ConnectionConfig.Builder
java.lang.Object
com.lucimber.dbus.connection.ConnectionConfig.Builder
- Enclosing class:
- ConnectionConfig
Builder class for creating ConnectionConfig instances.
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds a new ConnectionConfig instance with the configured values.withAutoReconnectEnabled
(boolean enabled) Sets whether automatic reconnection is enabled.withCloseTimeout
(Duration timeout) Sets the timeout for connection close operations.withConnectTimeout
(Duration timeout) Sets the timeout for establishing connections.withHealthCheckEnabled
(boolean enabled) Sets whether health check monitoring is enabled.withHealthCheckInterval
(Duration interval) Sets the interval between health checks.withHealthCheckTimeout
(Duration timeout) Sets the timeout for individual health checks.withMaxReconnectAttempts
(int attempts) Sets the maximum number of reconnection attempts.withMethodCallTimeout
(Duration timeout) Sets the timeout for method call responses.withReadTimeout
(Duration timeout) Sets the timeout for read operations.withReconnectBackoffMultiplier
(double multiplier) Sets the backoff multiplier for reconnection delays.Sets the initial delay before the first reconnection attempt.withReconnectMaxDelay
(Duration delay) Sets the maximum delay between reconnection attempts.withWriteTimeout
(Duration timeout) Sets the timeout for write operations.
-
Method Details
-
withMethodCallTimeout
Sets the timeout for method call responses.- Parameters:
timeout
- The timeout duration (must be positive)- Returns:
- This builder instance
- Throws:
IllegalArgumentException
- if timeout is null or not positive
-
withConnectTimeout
Sets the timeout for establishing connections.- Parameters:
timeout
- The timeout duration (must be positive)- Returns:
- This builder instance
- Throws:
IllegalArgumentException
- if timeout is null or not positive
-
withReadTimeout
Sets the timeout for read operations.- Parameters:
timeout
- The timeout duration (must be positive)- Returns:
- This builder instance
- Throws:
IllegalArgumentException
- if timeout is null or not positive
-
withWriteTimeout
Sets the timeout for write operations.- Parameters:
timeout
- The timeout duration (must be positive)- Returns:
- This builder instance
- Throws:
IllegalArgumentException
- if timeout is null or not positive
-
withHealthCheckEnabled
Sets whether health check monitoring is enabled.- Parameters:
enabled
- true to enable health checks- Returns:
- This builder instance
-
withHealthCheckInterval
Sets the interval between health checks.- Parameters:
interval
- The health check interval (must be positive)- Returns:
- This builder instance
- Throws:
IllegalArgumentException
- if interval is null or not positive
-
withHealthCheckTimeout
Sets the timeout for individual health checks.- Parameters:
timeout
- The health check timeout (must be positive)- Returns:
- This builder instance
- Throws:
IllegalArgumentException
- if timeout is null or not positive
-
withAutoReconnectEnabled
Sets whether automatic reconnection is enabled.- Parameters:
enabled
- true to enable auto-reconnect- Returns:
- This builder instance
-
withReconnectInitialDelay
Sets the initial delay before the first reconnection attempt.- Parameters:
delay
- The initial reconnection delay (must be positive)- Returns:
- This builder instance
- Throws:
IllegalArgumentException
- if delay is null or not positive
-
withReconnectMaxDelay
Sets the maximum delay between reconnection attempts.- Parameters:
delay
- The maximum reconnection delay (must be positive)- Returns:
- This builder instance
- Throws:
IllegalArgumentException
- if delay is null or not positive
-
withReconnectBackoffMultiplier
Sets the backoff multiplier for reconnection delays.- Parameters:
multiplier
- The backoff multiplier (must be >= 1.0)- Returns:
- This builder instance
- Throws:
IllegalArgumentException
- if multiplier is less than 1.0
-
withMaxReconnectAttempts
Sets the maximum number of reconnection attempts.- Parameters:
attempts
- The maximum reconnection attempts (must be >= 0, 0 means unlimited)- Returns:
- This builder instance
- Throws:
IllegalArgumentException
- if attempts is negative
-
withCloseTimeout
Sets the timeout for connection close operations.- Parameters:
timeout
- The close timeout duration (must be positive)- Returns:
- This builder instance
- Throws:
IllegalArgumentException
- if timeout is null or not positive
-
build
Builds a new ConnectionConfig instance with the configured values.- Returns:
- A new ConnectionConfig instance
-