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 SplitClientConfig.BuilderalternativeHTTPModule(CustomHttpModule alternativeHTTPModule)Alternative Http ClientSplitClientConfig.BuilderauthRetryBackoffBase(int authRetryBackoffBase)Set how many seconds to wait before re attempting to authenticate for push notifications.SplitClientConfig.BuilderauthServiceURL(String authServiceURL)Set Authentication service URL.SplitClientConfigbuild()SplitClientConfig.BuilderconnectionTimeout(int ms)Http client connection timeout.SplitClientConfig.BuildercustomHeaderDecorator(CustomHeaderDecorator customHeaderDecorator)User Custom Header DecoratorSplitClientConfig.BuildercustomStorageWrapper(CustomStorageWrapper customStorageWrapper)Storage wrapperSplitClientConfig.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.BuilderfallbackTreatments(FallbackTreatmentsConfiguration fallbackTreatments)Fallback TreatmentsSplitClientConfig.BuilderfeaturesRefreshRate(int seconds)The SDK will poll the endpoint for changes to features at this period.SplitClientConfig.BuilderflagSetsFilter(List<String> flagSetsFilter)Flag Sets FilterSplitClientConfig.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.BuilderimpressionsMode(ImpressionsManager.Mode mode)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.BuilderlocalhostRefreshEnable(boolean localhostRefreshEnable)Set if refresh is enabled or not for localhost mode.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.BuilderoperationMode(OperationMode mode)Type of storageSplitClientConfig.BuilderproxyConfiguration(ProxyConfiguration proxyConfiguration)Set the mtls authentication against the proxy (if proxy settings are enabled).SplitClientConfig.BuilderproxyHost(String proxyHost)Deprecated.This method is deprecated.SplitClientConfig.BuilderproxyPassword(String proxyPassword)Set the password for authentication against the proxy (if proxy settings are enabled).SplitClientConfig.BuilderproxyPort(int proxyPort)Deprecated.This method is deprecated.SplitClientConfig.BuilderproxyUsername(String proxyUsername)Deprecated.This method is deprecated.SplitClientConfig.BuilderreadTimeout(int ms)Http client read timeout.SplitClientConfig.BuildersegmentDirectory(String sementDirectory)Set the location of the directory where are the segment json files for localhost mode.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(InputStream inputStream, FileTypeEnum fileType)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.BuilderstorageMode(StorageMode mode)SplitClientConfig.BuilderstreamingEnabled(boolean streamingEnabled)Set if streaming is enabled or not.SplitClientConfig.BuilderstreamingReconnectBackoffBase(int streamingReconnectBackoffBase)Set how many seconds to wait before re attempting to connect to streaming.SplitClientConfig.BuilderstreamingServiceURL(String streamingServiceURL)Set Streaming service URL.SplitClientConfig.BuildertelemetryRefreshRate(int telemetryRefreshRate)How often send telemetry dataSplitClientConfig.BuildertelemetryURL(String telemetryURL)Set telemetry service URL.SplitClientConfig.BuilderthreadFactory(ThreadFactory threadFactory)Thread FactorySplitClientConfig.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
-
impressionsMode
public SplitClientConfig.Builder impressionsMode(ImpressionsManager.Mode mode)
-
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
@Deprecated public SplitClientConfig.Builder proxyHost(String proxyHost)
Deprecated.This method is deprecated.Use {@link ProxyConfiguration)} instead.
The host location of the proxy. Default is localhost.- Parameters:
proxyHost- location of the proxy- Returns:
- this builder
-
proxyPort
@Deprecated public SplitClientConfig.Builder proxyPort(int proxyPort)
Deprecated.This method is deprecated.Use {@link ProxyConfiguration)} instead.
The port of the proxy. Default is -1.- Parameters:
proxyPort- port for the proxy- Returns:
- this builder
-
proxyUsername
@Deprecated public SplitClientConfig.Builder proxyUsername(String proxyUsername)
Deprecated.This method is deprecated.Use {@link ProxyConfiguration)} instead.
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
-
proxyConfiguration
public SplitClientConfig.Builder proxyConfiguration(ProxyConfiguration proxyConfiguration)
Set the mtls authentication against the proxy (if proxy settings are enabled). (Optional).- Parameters:
proxyConfiguration-- 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
-
splitFile
public SplitClientConfig.Builder splitFile(InputStream inputStream, FileTypeEnum fileType)
-
segmentDirectory
public SplitClientConfig.Builder segmentDirectory(String sementDirectory)
Set the location of the directory where are the segment json files for localhost mode. This setting is optional.- Parameters:
sementDirectory- 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:
-
streamingEnabled
public SplitClientConfig.Builder streamingEnabled(boolean streamingEnabled)
Set if streaming is enabled or not. Default is true.- Parameters:
streamingEnabled-- Returns:
-
localhostRefreshEnable
public SplitClientConfig.Builder localhostRefreshEnable(boolean localhostRefreshEnable)
Set if refresh is enabled or not for localhost mode. Default is false.- Parameters:
localhostRefreshEnable-- Returns:
-
authRetryBackoffBase
public SplitClientConfig.Builder authRetryBackoffBase(int authRetryBackoffBase)
Set how many seconds to wait before re attempting to authenticate for push notifications. Default 1 second. Minimum 1 second.- Parameters:
authRetryBackoffBase-- Returns:
-
streamingReconnectBackoffBase
public SplitClientConfig.Builder streamingReconnectBackoffBase(int streamingReconnectBackoffBase)
Set how many seconds to wait before re attempting to connect to streaming. Default 1 second. Minimum 1 second.- Parameters:
streamingReconnectBackoffBase-- Returns:
-
authServiceURL
public SplitClientConfig.Builder authServiceURL(String authServiceURL)
Set Authentication service URL.- Parameters:
authServiceURL-- Returns:
-
streamingServiceURL
public SplitClientConfig.Builder streamingServiceURL(String streamingServiceURL)
Set Streaming service URL.- Parameters:
streamingServiceURL-- Returns:
-
telemetryURL
public SplitClientConfig.Builder telemetryURL(String telemetryURL)
Set telemetry service URL.- Parameters:
telemetryURL-- Returns:
-
telemetryRefreshRate
public SplitClientConfig.Builder telemetryRefreshRate(int telemetryRefreshRate)
How often send telemetry data- Parameters:
telemetryRefreshRate-- Returns:
- this builder
-
operationMode
public SplitClientConfig.Builder operationMode(OperationMode mode)
Type of storage- Parameters:
mode-- Returns:
- this builder
-
storageMode
public SplitClientConfig.Builder storageMode(StorageMode mode)
- Parameters:
mode-- Returns:
- this builder
-
customStorageWrapper
public SplitClientConfig.Builder customStorageWrapper(CustomStorageWrapper customStorageWrapper)
Storage wrapper- Parameters:
customStorageWrapper-- Returns:
- this builder
-
flagSetsFilter
public SplitClientConfig.Builder flagSetsFilter(List<String> flagSetsFilter)
Flag Sets Filter- Parameters:
flagSetsFilter-- Returns:
- this builder
-
customHeaderDecorator
public SplitClientConfig.Builder customHeaderDecorator(CustomHeaderDecorator customHeaderDecorator)
User Custom Header Decorator- Parameters:
customHeaderDecorator-- Returns:
- this builder
-
alternativeHTTPModule
public SplitClientConfig.Builder alternativeHTTPModule(CustomHttpModule alternativeHTTPModule)
Alternative Http Client- Parameters:
alternativeHTTPModule-- Returns:
- this builder
-
fallbackTreatments
public SplitClientConfig.Builder fallbackTreatments(FallbackTreatmentsConfiguration fallbackTreatments)
Fallback Treatments- Parameters:
fallbackTreatments-- Returns:
- this builder
-
threadFactory
public SplitClientConfig.Builder threadFactory(ThreadFactory threadFactory)
Thread Factory- Parameters:
threadFactory-- Returns:
- this builder
-
build
public SplitClientConfig build()
-
-