Package com.mongodb.connection
Class SocketSettings.Builder
- java.lang.Object
-
- com.mongodb.connection.SocketSettings.Builder
-
- Enclosing class:
- SocketSettings
public static final class SocketSettings.Builder extends Object
A builder for an instance ofSocketSettings
.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SocketSettings.Builder
applyConnectionStringβ(ConnectionString connectionString)
Takes the settings from the givenConnectionString
and applies them to the builderSocketSettings.Builder
applySettingsβ(SocketSettings socketSettings)
Applies the socketSettings to the builderSocketSettings
build()
Build an instance ofSocketSettings
.SocketSettings.Builder
connectTimeoutβ(int connectTimeout, TimeUnit timeUnit)
Sets the socket connect timeout.SocketSettings.Builder
readTimeoutβ(int readTimeout, TimeUnit timeUnit)
Sets the socket read timeout.SocketSettings.Builder
receiveBufferSizeβ(int receiveBufferSize)
Sets the receive buffer size.SocketSettings.Builder
sendBufferSizeβ(int sendBufferSize)
Sets the send buffer size.
-
-
-
Method Detail
-
applySettings
public SocketSettings.Builder applySettingsβ(SocketSettings socketSettings)
Applies the socketSettings to the builderNote: Overwrites all existing settings
- Parameters:
socketSettings
- the socketSettings- Returns:
- this
- Since:
- 3.7
-
connectTimeout
public SocketSettings.Builder connectTimeoutβ(int connectTimeout, TimeUnit timeUnit)
Sets the socket connect timeout.- Parameters:
connectTimeout
- the connect timeouttimeUnit
- the time unit- Returns:
- this
-
readTimeout
public SocketSettings.Builder readTimeoutβ(int readTimeout, TimeUnit timeUnit)
Sets the socket read timeout.- Parameters:
readTimeout
- the read timeouttimeUnit
- the time unit- Returns:
- this
-
receiveBufferSize
public SocketSettings.Builder receiveBufferSizeβ(int receiveBufferSize)
Sets the receive buffer size.- Parameters:
receiveBufferSize
- the receive buffer size- Returns:
- this
-
sendBufferSize
public SocketSettings.Builder sendBufferSizeβ(int sendBufferSize)
Sets the send buffer size.- Parameters:
sendBufferSize
- the send buffer size- Returns:
- this
-
applyConnectionString
public SocketSettings.Builder applyConnectionStringβ(ConnectionString connectionString)
Takes the settings from the givenConnectionString
and applies them to the builder- Parameters:
connectionString
- the connection string containing details of how to connect to MongoDB- Returns:
- this
- See Also:
ConnectionString.getConnectTimeout()
,ConnectionString.getSocketTimeout()
-
build
public SocketSettings build()
Build an instance ofSocketSettings
.- Returns:
- the socket settings for this builder
-
-