Class WebSeedClientConfiguration.Builder
- java.lang.Object
-
- io.github.pr0methean.betterrandom.seed.WebSeedClientConfiguration.Builder
-
- Enclosing class:
- WebSeedClientConfiguration
public static class WebSeedClientConfiguration.Builder extends Object
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description WebSeedClientConfiguration
build()
Builds aWebSeedClientConfiguration
with this builder's parameters.WebSeedClientConfiguration.Builder
setProxy(Proxy proxy)
Sets the proxy to use to connect to the server.WebSeedClientConfiguration.Builder
setRetryDelay(long amount, TimeUnit unit)
Sets the delay after anIOException
before we will try connecting again.WebSeedClientConfiguration.Builder
setRetryDelay(Duration delay)
Sets the delay after anIOException
before we will try connecting again.WebSeedClientConfiguration.Builder
setSocketFactory(SSLSocketFactory socketFactory)
Sets theSSLSocketFactory
used to connect to the server.
-
-
-
Method Detail
-
setProxy
public WebSeedClientConfiguration.Builder setProxy(@Nullable Proxy proxy)
Sets the proxy to use to connect to the server.- Parameters:
proxy
- the proxy, or null (default) to use the system default- Returns:
- this builder
-
setSocketFactory
public WebSeedClientConfiguration.Builder setSocketFactory(SSLSocketFactory socketFactory)
Sets theSSLSocketFactory
used to connect to the server.- Parameters:
socketFactory
- the socket factory, or null (default) to use the system default- Returns:
- this builder
-
setRetryDelay
public WebSeedClientConfiguration.Builder setRetryDelay(Duration delay)
Sets the delay after anIOException
before we will try connecting again. ForRandomDotOrgApi2Client
, this also controls the maximum "advisory delay" that will be honored. Attempting to use theWebSeedClient
before the delay ends will throw aSeedException
, so this is best used in aSeedGeneratorPreferenceList
.- Parameters:
delay
- the delay after a failed request- Returns:
- this builder
-
setRetryDelay
public WebSeedClientConfiguration.Builder setRetryDelay(long amount, TimeUnit unit)
Sets the delay after anIOException
before we will try connecting again. ForRandomDotOrgApi2Client
, this also controls the maximum "advisory delay" that will be honored. Attempting to use theWebSeedClient
before the delay ends will throw aSeedException
, so this is best used in aSeedGeneratorPreferenceList
.- Parameters:
amount
- the number of units to delay byunit
- the time unit in which the delay is measured- Returns:
- this builder
-
build
public WebSeedClientConfiguration build()
Builds aWebSeedClientConfiguration
with this builder's parameters.- Returns:
- a
WebSeedClientConfiguration
-
-