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 |
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 |
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 |
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 |
kvEndpoints(int kvEndpoints)
Sets the number of Key/Value endpoints to open per nodes in the cluster (default value ).
|
DefaultCoreEnvironment.Builder |
maxRequestLifetime(long maxRequestLifetime)
Sets the maximum time in milliseconds a request is allowed to live.
|
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 |
queryEnabled(boolean queryEnabled)
Toggles the N1QL Query feature (default value ).
|
DefaultCoreEnvironment.Builder |
queryEndpoints(int queryEndpoints)
Sets the number of Query (N1QL) endpoints to open per node in the cluster (default value ).
|
DefaultCoreEnvironment.Builder |
queryPort(int queryPort)
Defines the port for N1QL Query (default value ).
|
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 |
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(Scheduler scheduler)
Deprecated.
use
ioPool(EventLoopGroup, ShutdownHook) to also provide a shutdown hook. |
DefaultCoreEnvironment.Builder |
scheduler(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 |
socketConnectTimeout(int socketConnectTimeout)
Sets a custom socket connect timeout.
|
DefaultCoreEnvironment.Builder |
sslEnabled(boolean sslEnabled)
Set if SSL should be enabled (default value ).
|
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)
Sets the number of View endpoints to open per node in the cluster (default value ).
|
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).
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 queryEnabled(boolean queryEnabled)
Toggles the N1QL Query feature (default value ). This parameter will be deprecated once N1QL is in General Availability and shipped with the server.
If not bundled with the server, the N1QL service must run on all the cluster’s nodes.
public DefaultCoreEnvironment.Builder queryPort(int queryPort)
Defines the port for N1QL Query (default value ). This parameter will be deprecated once N1QL is in General Availability and shipped with the server.
If not bundled with the server, the N1QL service must run on all the cluster’s nodes.
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 kvEndpoints(int kvEndpoints)
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)
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)
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 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.
@Deprecated public DefaultCoreEnvironment.Builder scheduler(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(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 build()
Copyright © 2015 Couchbase, Inc.. All rights reserved.