public static class DefaultCoreEnvironment.Builder extends Object
Modifier | Constructor and Description |
---|---|
protected |
Builder() |
Modifier and Type | Method and Description |
---|---|
DefaultCoreEnvironment.Builder |
autoreleaseAfter(long autoreleaseAfter)
Sets the time after which any non-consumed buffers will be automatically released.
|
DefaultCoreEnvironment.Builder |
bootstrapCarrierDirectPort(int bootstrapCarrierDirectPort)
If carrier publication bootstrap is enabled and not SSL, sets the port to use (default value ).
|
DefaultCoreEnvironment.Builder |
bootstrapCarrierEnabled(boolean bootstrapCarrierEnabled)
Toggles bootstrap via carrier publication (default value ).
|
DefaultCoreEnvironment.Builder |
bootstrapCarrierSslPort(int bootstrapCarrierSslPort)
If carrier publication bootstrap and SSL are enabled, sets the port to use (default value ).
|
DefaultCoreEnvironment.Builder |
bootstrapHttpDirectPort(int bootstrapHttpDirectPort)
If Http bootstrap is enabled and not SSL, sets the port to use (default value ).
|
DefaultCoreEnvironment.Builder |
bootstrapHttpEnabled(boolean bootstrapHttpEnabled)
Toggles bootstrap via Http (default value ).
|
DefaultCoreEnvironment.Builder |
bootstrapHttpSslPort(int bootstrapHttpSslPort)
If Http bootstrap and SSL are enabled, sets the port to use (default value ).
|
DefaultCoreEnvironment.Builder |
bufferPoolingEnabled(boolean bufferPoolingEnabled)
Forcefully disable buffer pooling by setting the value to false.
|
DefaultCoreEnvironment |
build() |
DefaultCoreEnvironment.Builder |
callbacksOnIoPool(boolean callbacksOnIoPool)
Set to true if the
Observable callbacks should be completed on the IO event loops. |
DefaultCoreEnvironment.Builder |
computationPoolSize(int computationPoolSize)
Sets the pool size (number of threads to use) for all non blocking operations in the core and clients (default value is the number of CPUs).
|
DefaultCoreEnvironment.Builder |
dcpConnectionBufferAckThreshold(double dcpConnectionBufferAckThreshold)
When a DCP connection read bytes reaches this percentage of the
dcpConnectionBufferSize , a DCP Buffer Acknowledge message is sent to the server to signal producer how much data has been processed. |
DefaultCoreEnvironment.Builder |
dcpConnectionBufferSize(int dcpConnectionBufferSize)
Sets the size of the buffer to control speed of DCP producer.
|
DefaultCoreEnvironment.Builder |
dcpConnectionName(String dcpConnectionName)
Sets default name for DCP connection.
|
DefaultCoreEnvironment.Builder |
dcpEnabled(boolean dcpEnabled)
Set if DCP should be enabled (only makes sense with server versions >= 3.0.0, default ).
|
DefaultCoreEnvironment.Builder |
defaultMetricsLoggingConsumer(boolean enabled,
CouchbaseLogLevel level) |
DefaultCoreEnvironment.Builder |
defaultMetricsLoggingConsumer(boolean enabled,
CouchbaseLogLevel level,
LoggingConsumer.OutputFormat format) |
DefaultCoreEnvironment.Builder |
disconnectTimeout(long disconnectTimeout)
Sets a custom disconnect timeout.
|
DefaultCoreEnvironment.Builder |
eventBus(EventBus eventBus)
Sets the event bus to an alternative implementation.
|
DefaultCoreEnvironment.Builder |
ioPool(EventLoopGroup group)
Deprecated.
use
ioPool(EventLoopGroup, ShutdownHook) to also provide a shutdown hook. |
DefaultCoreEnvironment.Builder |
ioPool(EventLoopGroup group,
ShutdownHook shutdownHook)
Sets the I/O Pool implementation for the underlying IO framework, along with the action to execute when this environment is shut down.
|
DefaultCoreEnvironment.Builder |
ioPoolSize(int ioPoolSize)
Sets the pool size (number of threads to use) for I/O operations (default value is the number of CPUs).
|
DefaultCoreEnvironment.Builder |
keepAliveInterval(long keepAliveIntervalMilliseconds)
Sets the time of inactivity, in milliseconds, after which some services will issue a form of keep-alive request to their corresponding server/nodes (default is 30s, values <= 0 deactivate the idle check).
|
DefaultCoreEnvironment.Builder |
keyValueServiceConfig(KeyValueServiceConfig keyValueServiceConfig)
Allows to set a custom configuration for the KV service.
|
DefaultCoreEnvironment.Builder |
kvEndpoints(int kvEndpoints)
Deprecated.
Please use
keyValueServiceConfig(KeyValueServiceConfig) going forward. |
DefaultCoreEnvironment.Builder |
kvIoPool(EventLoopGroup group,
ShutdownHook shutdownHook)
Sets the KV I/O Pool implementation for the underlying IO framework, along with the action to execute when this environment is shut down.
|
DefaultCoreEnvironment.Builder |
maxRequestLifetime(long maxRequestLifetime)
Sets the maximum time in milliseconds a request is allowed to live.
|
DefaultCoreEnvironment.Builder |
memcachedHashingStrategy(MemcachedHashingStrategy memcachedHashingStrategy)
Sets a custom memcached node hashing strategy, mainly used for compatibility with other clients.
|
DefaultCoreEnvironment.Builder |
mutationTokensEnabled(boolean mutationTokensEnabled)
If mutation tokens are enabled, they can be used for advanced durability requirements, as well as optimized RYOW consistency.
|
DefaultCoreEnvironment.Builder |
networkLatencyMetricsCollectorConfig(LatencyMetricsCollectorConfig metricsCollectorConfig)
Sets a custom configuration for the
NetworkLatencyMetricsCollector . |
DefaultCoreEnvironment.Builder |
observeIntervalDelay(Delay observeIntervalDelay)
|
DefaultCoreEnvironment.Builder |
packageNameAndVersion(String packageNameAndVersion)
Sets the String to be used as identifier for the library namespace and version.
|
DefaultCoreEnvironment.Builder |
queryEndpoints(int queryEndpoints)
Deprecated.
Please use
queryServiceConfig(QueryServiceConfig) going forward. |
DefaultCoreEnvironment.Builder |
queryIoPool(EventLoopGroup group,
ShutdownHook shutdownHook)
Sets the Query I/O Pool implementation for the underlying IO framework, along with the action to execute when this environment is shut down.
|
DefaultCoreEnvironment.Builder |
queryServiceConfig(QueryServiceConfig queryServiceConfig)
Allows to set a custom configuration for the Query service.
|
DefaultCoreEnvironment.Builder |
reconnectDelay(Delay reconnectDelay)
Sets the
Delay for node reconnects (default value is a delay growing exponentially between 32ms and 4096ms). |
DefaultCoreEnvironment.Builder |
requestBufferSize(int requestBufferSize)
Sets the size of the RingBuffer structure that queues requests (default value ).
|
DefaultCoreEnvironment.Builder |
requestBufferWaitStrategy(WaitStrategyFactory waitStrategy)
Sets a custom waiting strategy for requests.
|
DefaultCoreEnvironment.Builder |
responseBufferSize(int responseBufferSize)
Sets the size of the RingBuffer structure that queues responses (default value ).
|
DefaultCoreEnvironment.Builder |
retryDelay(Delay retryDelay)
Sets the
Delay for retries of requests (default value is a delay growing exponentially between 100us and 100ms). |
DefaultCoreEnvironment.Builder |
retryStrategy(RetryStrategy retryStrategy)
Sets the
RetryStrategy to be used during request retries (default value is a BestEffortRetryStrategy ). |
DefaultCoreEnvironment.Builder |
runtimeMetricsCollectorConfig(MetricsCollectorConfig metricsCollectorConfig)
Sets a custom configuration for the
RuntimeMetricsCollector . |
DefaultCoreEnvironment.Builder |
scheduler(rx.Scheduler scheduler)
Deprecated.
use
ioPool(EventLoopGroup, ShutdownHook) to also provide a shutdown hook. |
DefaultCoreEnvironment.Builder |
scheduler(rx.Scheduler scheduler,
ShutdownHook shutdownHook)
Sets the Scheduler implementation for the underlying computation framework, along with the action to execute when this environment is shut down.
|
DefaultCoreEnvironment.Builder |
searchEndpoints(int searchEndpoints)
Deprecated.
Please use
searchServiceConfig(SearchServiceConfig) going forward. |
DefaultCoreEnvironment.Builder |
searchIoPool(EventLoopGroup group,
ShutdownHook shutdownHook)
Sets the Search I/O Pool implementation for the underlying IO framework, along with the action to execute when this environment is shut down.
|
DefaultCoreEnvironment.Builder |
searchServiceConfig(SearchServiceConfig searchServiceConfig)
Allows to set a custom configuration for the Search service.
|
DefaultCoreEnvironment.Builder |
socketConnectTimeout(int socketConnectTimeout)
Sets a custom socket connect timeout.
|
DefaultCoreEnvironment.Builder |
sslEnabled(boolean sslEnabled)
Set if SSL should be enabled (default value ).
|
DefaultCoreEnvironment.Builder |
sslKeystore(KeyStore sslKeystore)
Sets the SSL Keystore directly and not indirectly via filepath.
|
DefaultCoreEnvironment.Builder |
sslKeystoreFile(String sslKeystoreFile)
Defines the location of the SSL Keystore file (default value null, none).
|
DefaultCoreEnvironment.Builder |
sslKeystorePassword(String sslKeystorePassword)
Sets the SSL Keystore password to be used with the Keystore file (default value null, none).
|
DefaultCoreEnvironment.Builder |
tcpNodelayEnabled(boolean tcpNodelayEnabled)
If TCP_NODELAY is manually disabled, Nagle’ing will take effect on both the client and (if supported) the server side.
|
DefaultCoreEnvironment.Builder |
userAgent(String userAgent)
Sets the USER-AGENT String to be sent in HTTP requests headers (should usually not be tweaked, default value is computed from the SDK
DefaultCoreEnvironment.packageNameAndVersion() ). |
DefaultCoreEnvironment.Builder |
viewEndpoints(int viewEndpoints)
Deprecated.
Please use
viewServiceConfig(ViewServiceConfig) going forward. |
DefaultCoreEnvironment.Builder |
viewIoPool(EventLoopGroup group,
ShutdownHook shutdownHook)
Sets the View I/O Pool implementation for the underlying IO framework, along with the action to execute when this environment is shut down.
|
DefaultCoreEnvironment.Builder |
viewServiceConfig(ViewServiceConfig viewServiceConfig)
Allows to set a custom configuration for the View service.
|
public DefaultCoreEnvironment.Builder dcpEnabled(boolean dcpEnabled)
Set if DCP should be enabled (only makes sense with server versions >= 3.0.0, default ).
public DefaultCoreEnvironment.Builder sslEnabled(boolean sslEnabled)
Set if SSL should be enabled (default value ). If true, also set sslKeystoreFile(String)
and sslKeystorePassword(String)
.
public DefaultCoreEnvironment.Builder sslKeystoreFile(String sslKeystoreFile)
Defines the location of the SSL Keystore file (default value null, none).
You can either specify a file or the keystore directly via sslKeystore(KeyStore)
. If the explicit keystore is used it takes precedence over the file approach.
public DefaultCoreEnvironment.Builder sslKeystorePassword(String sslKeystorePassword)
Sets the SSL Keystore password to be used with the Keystore file (default value null, none).
sslKeystoreFile(String)
public DefaultCoreEnvironment.Builder sslKeystore(KeyStore sslKeystore)
Sets the SSL Keystore directly and not indirectly via filepath.
You can either specify a file or the keystore directly via sslKeystore(KeyStore)
. If the explicit keystore is used it takes precedence over the file approach.
sslKeystore
- the keystore to use.public DefaultCoreEnvironment.Builder bootstrapHttpEnabled(boolean bootstrapHttpEnabled)
Toggles bootstrap via Http (default value ).
public DefaultCoreEnvironment.Builder bootstrapCarrierEnabled(boolean bootstrapCarrierEnabled)
Toggles bootstrap via carrier publication (default value ).
public DefaultCoreEnvironment.Builder bootstrapHttpDirectPort(int bootstrapHttpDirectPort)
If Http bootstrap is enabled and not SSL, sets the port to use (default value ).
public DefaultCoreEnvironment.Builder bootstrapHttpSslPort(int bootstrapHttpSslPort)
If Http bootstrap and SSL are enabled, sets the port to use (default value ).
public DefaultCoreEnvironment.Builder bootstrapCarrierDirectPort(int bootstrapCarrierDirectPort)
If carrier publication bootstrap is enabled and not SSL, sets the port to use (default value ).
public DefaultCoreEnvironment.Builder bootstrapCarrierSslPort(int bootstrapCarrierSslPort)
If carrier publication bootstrap and SSL are enabled, sets the port to use (default value ).
public DefaultCoreEnvironment.Builder ioPoolSize(int ioPoolSize)
Sets the pool size (number of threads to use) for I/O operations (default value is the number of CPUs).
If there is more nodes in the cluster than the defined ioPoolSize, multiplexing will automatically happen.
public DefaultCoreEnvironment.Builder computationPoolSize(int computationPoolSize)
Sets the pool size (number of threads to use) for all non blocking operations in the core and clients (default value is the number of CPUs).
Don’t size it too small since it would significantly impact performance.
public DefaultCoreEnvironment.Builder requestBufferSize(int requestBufferSize)
Sets the size of the RingBuffer structure that queues requests (default value ). This is an advanced parameter that usually shouldn’t need to be changed.
public DefaultCoreEnvironment.Builder responseBufferSize(int responseBufferSize)
Sets the size of the RingBuffer structure that queues responses (default value ). This is an advanced parameter that usually shouldn’t need to be changed
public DefaultCoreEnvironment.Builder dcpConnectionBufferSize(int dcpConnectionBufferSize)
Sets the size of the buffer to control speed of DCP producer. The server will stop emitting data if the current value of the buffer reach this limit. Set it to zero to disable DCP flow control. (default value ).
public DefaultCoreEnvironment.Builder dcpConnectionBufferAckThreshold(double dcpConnectionBufferAckThreshold)
When a DCP connection read bytes reaches this percentage of the dcpConnectionBufferSize
, a DCP Buffer Acknowledge message is sent to the server to signal producer how much data has been processed. (default value ).
@InterfaceStability.Experimental @InterfaceAudience.Public public DefaultCoreEnvironment.Builder dcpConnectionName(String dcpConnectionName)
Sets default name for DCP connection. It is used to identify streams on the server. (default value ).
public DefaultCoreEnvironment.Builder kvEndpoints(int kvEndpoints)
keyValueServiceConfig(KeyValueServiceConfig)
going forward.Sets the number of Key/Value endpoints to open per nodes in the cluster (default value ).
Only tune to more if IO has been identified as the most probable bottleneck, since it can reduce batching on the tcp/network level.
public DefaultCoreEnvironment.Builder viewEndpoints(int viewEndpoints)
viewServiceConfig(ViewServiceConfig)
going forward.Sets the number of View endpoints to open per node in the cluster (default value ).
Setting this to a higher number is advised in heavy view workloads.
public DefaultCoreEnvironment.Builder queryEndpoints(int queryEndpoints)
queryServiceConfig(QueryServiceConfig)
going forward.Sets the number of Query (N1QL) endpoints to open per node in the cluster (default value ).
Setting this to a higher number is advised in heavy query workloads.
public DefaultCoreEnvironment.Builder searchEndpoints(int searchEndpoints)
searchServiceConfig(SearchServiceConfig)
going forward.Sets the number of Search (CBFT) endpoints to open per node in the cluster (default value ).
Setting this to a higher number is advised in heavy query workloads.
public DefaultCoreEnvironment.Builder userAgent(String userAgent)
Sets the USER-AGENT String to be sent in HTTP requests headers (should usually not be tweaked, default value is computed from the SDK DefaultCoreEnvironment.packageNameAndVersion()
).
public DefaultCoreEnvironment.Builder packageNameAndVersion(String packageNameAndVersion)
Sets the String to be used as identifier for the library namespace and version. (should usually not be tweaked, default value is computed at build time from VCS tags/commits).
This is used in DefaultCoreEnvironment.userAgent()
notably.
public DefaultCoreEnvironment.Builder observeIntervalDelay(Delay observeIntervalDelay)
public DefaultCoreEnvironment.Builder reconnectDelay(Delay reconnectDelay)
Sets the Delay
for node reconnects (default value is a delay growing exponentially between 32ms and 4096ms).
public DefaultCoreEnvironment.Builder retryDelay(Delay retryDelay)
Sets the Delay
for retries of requests (default value is a delay growing exponentially between 100us and 100ms).
@Deprecated public DefaultCoreEnvironment.Builder ioPool(EventLoopGroup group)
ioPool(EventLoopGroup, ShutdownHook)
to also provide a shutdown hook.Sets the I/O Pool implementation for the underlying IO framework. This is an advanced configuration that should only be used if you know what you are doing.
public DefaultCoreEnvironment.Builder ioPool(EventLoopGroup group, ShutdownHook shutdownHook)
Sets the I/O Pool implementation for the underlying IO framework, along with the action to execute when this environment is shut down. This is an advanced configuration that should only be used if you know what you are doing.
public DefaultCoreEnvironment.Builder kvIoPool(EventLoopGroup group, ShutdownHook shutdownHook)
Sets the KV I/O Pool implementation for the underlying IO framework, along with the action to execute when this environment is shut down. This is an advanced configuration that should only be used if you know what you are doing.
public DefaultCoreEnvironment.Builder viewIoPool(EventLoopGroup group, ShutdownHook shutdownHook)
Sets the View I/O Pool implementation for the underlying IO framework, along with the action to execute when this environment is shut down. This is an advanced configuration that should only be used if you know what you are doing.
public DefaultCoreEnvironment.Builder queryIoPool(EventLoopGroup group, ShutdownHook shutdownHook)
Sets the Query I/O Pool implementation for the underlying IO framework, along with the action to execute when this environment is shut down. This is an advanced configuration that should only be used if you know what you are doing.
public DefaultCoreEnvironment.Builder searchIoPool(EventLoopGroup group, ShutdownHook shutdownHook)
Sets the Search I/O Pool implementation for the underlying IO framework, along with the action to execute when this environment is shut down. This is an advanced configuration that should only be used if you know what you are doing.
@Deprecated public DefaultCoreEnvironment.Builder scheduler(rx.Scheduler scheduler)
ioPool(EventLoopGroup, ShutdownHook)
to also provide a shutdown hook.Sets the Scheduler implementation for the underlying computation framework. This is an advanced configuration that should only be used if you know what you are doing.
public DefaultCoreEnvironment.Builder scheduler(rx.Scheduler scheduler, ShutdownHook shutdownHook)
Sets the Scheduler implementation for the underlying computation framework, along with the action to execute when this environment is shut down. This is an advanced configuration that should only be used if you know what you are doing.
public DefaultCoreEnvironment.Builder retryStrategy(RetryStrategy retryStrategy)
Sets the RetryStrategy
to be used during request retries (default value is a BestEffortRetryStrategy
).
public DefaultCoreEnvironment.Builder maxRequestLifetime(long maxRequestLifetime)
Sets the maximum time in milliseconds a request is allowed to live.
If the best effort retry strategy is used, the request will still be cancelled after this period to make sure that requests are not sticking around forever. Make sure it is longer than any timeout you potentially have configured.
Default is 75s.
public DefaultCoreEnvironment.Builder keepAliveInterval(long keepAliveIntervalMilliseconds)
Sets the time of inactivity, in milliseconds, after which some services will issue a form of keep-alive request to their corresponding server/nodes (default is 30s, values <= 0 deactivate the idle check).
public DefaultCoreEnvironment.Builder autoreleaseAfter(long autoreleaseAfter)
Sets the time after which any non-consumed buffers will be automatically released. Setting this to a higher value than a few seconds is not recommended since this may lead to increased garbage collection.
public DefaultCoreEnvironment.Builder eventBus(EventBus eventBus)
Sets the event bus to an alternative implementation.
This setting should only be tweaked in advanced cases.
public DefaultCoreEnvironment.Builder bufferPoolingEnabled(boolean bufferPoolingEnabled)
Forcefully disable buffer pooling by setting the value to false.
This should not be used in general because buffer pooling is in place to reduce GC pressure during workloads. It is implemented to be used as a “last resort” if the client is suspect to a buffer leak which can terminate the application. Until a solution is found to the leak buffer pooling can be disabled at the cost of higher GC.
public DefaultCoreEnvironment.Builder tcpNodelayEnabled(boolean tcpNodelayEnabled)
If TCP_NODELAY is manually disabled, Nagle’ing will take effect on both the client and (if supported) the server side.
public DefaultCoreEnvironment.Builder mutationTokensEnabled(boolean mutationTokensEnabled)
If mutation tokens are enabled, they can be used for advanced durability requirements, as well as optimized RYOW consistency.
Note that just enabling it here won’t help if the server does not support it as well. Use at least Couchbase Server 4.0. Also, consider the additional overhead of 16 bytes per mutation response (8 byte for the vbucket uuid and 8 byte for the sequence number).
public DefaultCoreEnvironment.Builder runtimeMetricsCollectorConfig(MetricsCollectorConfig metricsCollectorConfig)
Sets a custom configuration for the RuntimeMetricsCollector
.
metricsCollectorConfig
- the custom configurationpublic DefaultCoreEnvironment.Builder networkLatencyMetricsCollectorConfig(LatencyMetricsCollectorConfig metricsCollectorConfig)
Sets a custom configuration for the NetworkLatencyMetricsCollector
.
metricsCollectorConfig
- the custom configuration for the collector.public DefaultCoreEnvironment.Builder defaultMetricsLoggingConsumer(boolean enabled, CouchbaseLogLevel level, LoggingConsumer.OutputFormat format)
public DefaultCoreEnvironment.Builder defaultMetricsLoggingConsumer(boolean enabled, CouchbaseLogLevel level)
public DefaultCoreEnvironment.Builder socketConnectTimeout(int socketConnectTimeout)
Sets a custom socket connect timeout.
socketConnectTimeout
- the socket connect timeout in milliseconds.public DefaultCoreEnvironment.Builder callbacksOnIoPool(boolean callbacksOnIoPool)
Set to true if the Observable
callbacks should be completed on the IO event loops.
Note: this is an advanced option and must be used with care. It can be used to improve performance since it removes additional scheduling overhead on the response path, but any blocking calls in the callbacks will lead to more work on the event loops itself and eventually stall them.
USE WITH CARE!
public DefaultCoreEnvironment.Builder disconnectTimeout(long disconnectTimeout)
Sets a custom disconnect timeout.
disconnectTimeout
- the disconnect timeout in milliseconds.@InterfaceStability.Experimental @InterfaceAudience.Public public DefaultCoreEnvironment.Builder requestBufferWaitStrategy(WaitStrategyFactory waitStrategy)
Sets a custom waiting strategy for requests. Default is BlockingWaitStrategy
.
waitStrategy
- waiting strategypublic DefaultCoreEnvironment.Builder memcachedHashingStrategy(MemcachedHashingStrategy memcachedHashingStrategy)
Sets a custom memcached node hashing strategy, mainly used for compatibility with other clients.
memcachedHashingStrategy
- the strategy to use.public DefaultCoreEnvironment.Builder keyValueServiceConfig(KeyValueServiceConfig keyValueServiceConfig)
Allows to set a custom configuration for the KV service.
keyValueServiceConfig
- the config to apply.public DefaultCoreEnvironment.Builder viewServiceConfig(ViewServiceConfig viewServiceConfig)
Allows to set a custom configuration for the View service.
viewServiceConfig
- the config to apply.public DefaultCoreEnvironment.Builder queryServiceConfig(QueryServiceConfig queryServiceConfig)
Allows to set a custom configuration for the Query service.
queryServiceConfig
- the config to apply.public DefaultCoreEnvironment.Builder searchServiceConfig(SearchServiceConfig searchServiceConfig)
Allows to set a custom configuration for the Search service.
searchServiceConfig
- the config to apply.public DefaultCoreEnvironment build()
Copyright © 2017 Couchbase, Inc.. All rights reserved.