Class SplitClientConfig.Builder
- java.lang.Object
-
- io.split.client.SplitClientConfig.Builder
-
- Enclosing class:
- SplitClientConfig
public static final class SplitClientConfig.Builder extends Object
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description SplitClientConfigbuild()SplitClientConfig.BuilderconnectionTimeout(int ms)Http client connection timeout.SplitClientConfig.BuilderdisableDestroyOnShutDown()Disables running destroy() on shutdown by default.SplitClientConfig.BuilderdisableIPAddress()SplitClientConfig.BuilderdisableLabels()Disable label capturingSplitClientConfig.BuilderenableDebug()SplitClientConfig.Builderendpoint(String endpoint, String eventsEndpoint)The rest endpoint that sdk will hit for latest features and segments.SplitClientConfig.BuildereventFlushIntervalInMillis(long eventFlushIntervalInMillis)How often to flush data to the collection servicesSplitClientConfig.BuildereventsQueueSize(int eventsQueueSize)Max size of the queue to trigger a flushSplitClientConfig.BuilderfeaturesRefreshRate(int seconds)The SDK will poll the endpoint for changes to features at this period.SplitClientConfig.BuilderimpressionListener(ImpressionListener impressionListener, int queueSize)Deprecated.As of release 3.2.5, replaced bySplitClientConfig.integrationsConfig()} You can provide your own ImpressionListener to capture all impressions generated by SplitClient.SplitClientConfig.BuilderimpressionsQueueSize(int impressionsQueueSize)The impression listener captures the which key saw what treatment ("on", "off", etc) at what time.SplitClientConfig.BuilderimpressionsRefreshRate(int seconds)The ImpressionListener captures the which key saw what treatment ("on", "off", etc) at what time.SplitClientConfig.Builderintegrations(IntegrationsConfig config)Sets up integrations for the Split SDK (Currently Impressions outgoing integrations supported only).SplitClientConfig.BuildermetricsRefreshRate(int seconds)The diagnostic metrics collected by the SDK are pushed back to split endpoint at this period.SplitClientConfig.BuildernumThreadsForSegmentFetch(int numThreadsForSegmentFetch)The amount of threads used for the thread pool that fetches segments.SplitClientConfig.BuilderproxyHost(String proxyHost)The host location of the proxy.SplitClientConfig.BuilderproxyPassword(String proxyPassword)Set the password for authentication against the proxy (if proxy settings are enabled).SplitClientConfig.BuilderproxyPort(int proxyPort)The port of the proxy.SplitClientConfig.BuilderproxyUsername(String proxyUsername)Set the username for authentication against the proxy (if proxy settings are enabled).SplitClientConfig.BuilderreadTimeout(int ms)Http client read timeout.SplitClientConfig.BuildersegmentsRefreshRate(int seconds)The SDK will poll the endpoint for changes to segments at this period in seconds.SplitClientConfig.BuildersetBlockUntilReadyTimeout(int milliseconds)The SDK kicks off background threads to download data necessary for using the SDK.SplitClientConfig.BuildersplitFile(String splitFile)Set the location of the new yaml file for localhost mode defaulting to .split (legacy and deprecated format) This setting is optional.SplitClientConfig.BuilderwaitBeforeShutdown(int waitTime)How long to wait for impressions background thread before shutting down the underlying connections.
-
-
-
Method Detail
-
numThreadsForSegmentFetch
public SplitClientConfig.Builder numThreadsForSegmentFetch(int numThreadsForSegmentFetch)
The amount of threads used for the thread pool that fetches segments. Usually and for most cases 2 is more than enough. But for organization that have a lot of segments, increasing this value can help expedite the time to ready. This is an ADVANCED parameter.- Parameters:
numThreadsForSegmentFetch- MUST be > 0. Default is 2.- Returns:
- this builder
-
eventsQueueSize
public SplitClientConfig.Builder eventsQueueSize(int eventsQueueSize)
Max size of the queue to trigger a flush- Parameters:
eventsQueueSize-- Returns:
- this builder
-
eventFlushIntervalInMillis
public SplitClientConfig.Builder eventFlushIntervalInMillis(long eventFlushIntervalInMillis)
How often to flush data to the collection services- Parameters:
eventFlushIntervalInMillis-- Returns:
- this builder
-
endpoint
public SplitClientConfig.Builder endpoint(String endpoint, String eventsEndpoint)
The rest endpoint that sdk will hit for latest features and segments.- Parameters:
endpoint- MUST NOT be null- Returns:
- this builder
-
featuresRefreshRate
public SplitClientConfig.Builder featuresRefreshRate(int seconds)
The SDK will poll the endpoint for changes to features at this period.Implementation Note: The SDK actually polls at a random interval chosen between (0.5 * n, n). This is to ensure that SDKs that are deployed simultaneously on different machines do not inundate the backend with requests at the same interval.
- Parameters:
seconds- MUST be greater than 0. Default value is 60.- Returns:
- this builder
-
segmentsRefreshRate
public SplitClientConfig.Builder segmentsRefreshRate(int seconds)
The SDK will poll the endpoint for changes to segments at this period in seconds.Implementation Note: The SDK actually polls at a random interval chosen between (0.5 * n, n). This is to ensure that SDKs that are deployed simultaneously on different machines do not inundate the backend with requests at the same interval.
- Parameters:
seconds- MUST be greater than 0. Default value is 60.- Returns:
- this builder
-
impressionsRefreshRate
public SplitClientConfig.Builder impressionsRefreshRate(int seconds)
The ImpressionListener captures the which key saw what treatment ("on", "off", etc) at what time. This log is periodically pushed back to split endpoint. This parameter controls how quickly does the cache expire after a write. This is an ADVANCED parameter- Parameters:
seconds- MUST be > 0.- Returns:
- this builder
-
impressionsQueueSize
public SplitClientConfig.Builder impressionsQueueSize(int impressionsQueueSize)
The impression listener captures the which key saw what treatment ("on", "off", etc) at what time. This log is periodically pushed back to split endpoint. This parameter controls the in-memory queue size to store them before they are pushed back to split endpoint. If the value chosen is too small and more than the default size(5000) of impressions are generated, the old ones will be dropped and the sdk will show a warning.This is an ADVANCED parameter.
- Parameters:
impressionsQueueSize- MUST be > 0. Default is 5000.- Returns:
- this builder
-
impressionListener
@Deprecated public SplitClientConfig.Builder impressionListener(ImpressionListener impressionListener, int queueSize)
Deprecated.As of release 3.2.5, replaced bySplitClientConfig.integrationsConfig()} You can provide your own ImpressionListener to capture all impressions generated by SplitClient. An Impression is generated each time getTreatment is called.Note that we will wrap any ImpressionListener provided in our own implementation with an Executor controlling impressions going into your ImpressionListener. This is done to protect SplitClient from any slowness caused by your ImpressionListener. The Executor will be given the capacity you provide as parameter which is the number of impressions that can be saved in a blocking queue while waiting for your ImpressionListener to log them. Of course, the larger the value of capacity, the more memory can be taken up.
The executor will create two threads.
This is an ADVANCED function.
- Parameters:
impressionListener-queueSize- maximum number of impressions that will be queued in memory. If the impressionListener is slow, the queue will fill up and any subsequent impressions will be dropped.- Returns:
- this builder
-
metricsRefreshRate
public SplitClientConfig.Builder metricsRefreshRate(int seconds)
The diagnostic metrics collected by the SDK are pushed back to split endpoint at this period. This is an ADVANCED parameter- Parameters:
seconds- MUST be > 0.- Returns:
- this builder
-
connectionTimeout
public SplitClientConfig.Builder connectionTimeout(int ms)
Http client connection timeout. Default value is 15000ms.- Parameters:
ms- MUST be greater than 0.- Returns:
- this builder
-
readTimeout
public SplitClientConfig.Builder readTimeout(int ms)
Http client read timeout. Default value is 15000ms.- Parameters:
ms- MUST be greater than 0.- Returns:
- this builder
-
enableDebug
public SplitClientConfig.Builder enableDebug()
-
disableLabels
public SplitClientConfig.Builder disableLabels()
Disable label capturing- Returns:
- this builder
-
disableIPAddress
public SplitClientConfig.Builder disableIPAddress()
-
setBlockUntilReadyTimeout
public SplitClientConfig.Builder setBlockUntilReadyTimeout(int milliseconds)
The SDK kicks off background threads to download data necessary for using the SDK. You can choose to block until the SDK has downloaded split definitions so that you will not get the 'control' treatment.If this parameter is set to a non-negative value, the SDK will block for that number of milliseconds for the data to be downloaded when
SplitClient.blockUntilReady()orSplitManager.blockUntilReady()is called- Parameters:
milliseconds- MUST BE greater than or equal to 0;- Returns:
- this builder
-
waitBeforeShutdown
public SplitClientConfig.Builder waitBeforeShutdown(int waitTime)
How long to wait for impressions background thread before shutting down the underlying connections.- Parameters:
waitTime- tine in milliseconds- Returns:
- this builder
-
proxyHost
public SplitClientConfig.Builder proxyHost(String proxyHost)
The host location of the proxy. Default is localhost.- Parameters:
proxyHost- location of the proxy- Returns:
- this builder
-
proxyPort
public SplitClientConfig.Builder proxyPort(int proxyPort)
The port of the proxy. Default is -1.- Parameters:
proxyPort- port for the proxy- Returns:
- this builder
-
proxyUsername
public SplitClientConfig.Builder proxyUsername(String proxyUsername)
Set the username for authentication against the proxy (if proxy settings are enabled). (Optional).- Parameters:
proxyUsername-- Returns:
- this builder
-
proxyPassword
public SplitClientConfig.Builder proxyPassword(String proxyPassword)
Set the password for authentication against the proxy (if proxy settings are enabled). (Optional).- Parameters:
proxyPassword-- Returns:
- this builder
-
disableDestroyOnShutDown
public SplitClientConfig.Builder disableDestroyOnShutDown()
Disables running destroy() on shutdown by default.- Returns:
- this builder
-
splitFile
public SplitClientConfig.Builder splitFile(String splitFile)
Set the location of the new yaml file for localhost mode defaulting to .split (legacy and deprecated format) This setting is optional.- Parameters:
splitFile- location- Returns:
- this builder
-
integrations
public SplitClientConfig.Builder integrations(IntegrationsConfig config)
Sets up integrations for the Split SDK (Currently Impressions outgoing integrations supported only).- Parameters:
config-- Returns:
-
build
public SplitClientConfig build()
-
-