public static class CoreEnvironment.Builder<SELF extends CoreEnvironment.Builder<SELF>> extends Object
Modifier | Constructor and Description |
---|---|
protected |
Builder() |
Modifier and Type | Method and Description |
---|---|
CoreEnvironment |
build()
Turns this builder into a real
CoreEnvironment . |
CompressionConfig.Builder |
compressionConfig()
Returns the currently stored config builder.
|
SELF |
compressionConfig(CompressionConfig.Builder compressionConfig)
Allows to customize document value compression settings.
|
SELF |
eventBus(EventBus eventBus)
Customizes the event bus for the SDK.
|
IoConfig.Builder |
ioConfig()
Returns the currently stored config builder.
|
SELF |
ioConfig(IoConfig.Builder ioConfig)
Allows to customize various I/O-related configuration properties.
|
SELF |
ioEnvironment(IoEnvironment.Builder ioEnvironment)
Allows to customize I/O thread pools.
|
SELF |
load(PropertyLoader<CoreEnvironment.Builder> loader)
Immediately loads the properties from the given loader into the environment.
|
LoggerConfig.Builder |
loggerConfig()
Returns the currently stored config builder.
|
SELF |
loggerConfig(LoggerConfig.Builder loggerConfig)
Allows to provide a custom configuration for the default logger used.
|
SELF |
maxNumRequestsInRetry(long maxNumRequestsInRetry)
Allows to customize the maximum number of requests allowed in the retry timer.
|
OrphanReporterConfig.Builder |
orphanReporterConfig()
Returns the currently stored config builder.
|
SELF |
orphanReporterConfig(OrphanReporterConfig.Builder orphanReporterConfig)
Allows to customize the behavior of the orphan response reporter.
|
SELF |
requestTracer(RequestTracer requestTracer)
Allows to configure a custom tracer implementation.
|
SELF |
retryStrategy(RetryStrategy retryStrategy)
Allows to customize the default retry strategy.
|
SELF |
scheduler(Scheduler scheduler)
Customizes the default Reactor scheduler used for parallel operations.
|
SecurityConfig.Builder |
securityConfig()
Returns the currently stored config builder.
|
SELF |
securityConfig(SecurityConfig.Builder securityConfig)
Allows to configure everything related to TLS/encrypted connections.
|
protected SELF |
self() |
TimeoutConfig.Builder |
timeoutConfig()
Returns the currently stored config builder.
|
SELF |
timeoutConfig(TimeoutConfig.Builder timeoutConfig)
Allows to customize the default timeouts for all operations.
|
protected SELF self()
public SELF maxNumRequestsInRetry(long maxNumRequestsInRetry)
If the CoreEnvironment.DEFAULT_MAX_NUM_REQUESTS_IN_RETRY
is reached, each request that would be queued for retry is
instead cancelled with a CancellationReason.TOO_MANY_REQUESTS_IN_RETRY
. This acts as a form of
safety net and backpressure.
maxNumRequestsInRetry
- the maximum number of requests outstanding for retry.CoreEnvironment.Builder
for chaining purposes.public SELF load(PropertyLoader<CoreEnvironment.Builder> loader)
loader
- the loader to load the properties from.CoreEnvironment.Builder
for chaining purposes.public SELF ioEnvironment(IoEnvironment.Builder ioEnvironment)
Note that the IoEnvironment
holds thread pools and other resources. If you do not want to customize
thread pool sizes, you likely want to look at the IoConfig
instead.
ioEnvironment
- the IO environment to customize.CoreEnvironment.Builder
for chaining purposes.public SELF ioConfig(IoConfig.Builder ioConfig)
The I/O config is the main way to control how the SDK behaves at the lower levels. It allows to customize properties such as tcp keepalive, number of connections, circuit breakers, etc.
ioConfig
- the custom I/O config to use.CoreEnvironment.Builder
for chaining purposes.public IoConfig.Builder ioConfig()
public SELF orphanReporterConfig(OrphanReporterConfig.Builder orphanReporterConfig)
The orphan reporter logs all responses that arrived when the requesting side is not listening anymore (usually because of a timeout). The config can be modified to tune certain properties like the sample size or the emit interval.
orphanReporterConfig
- the custom orphan reporter config.CoreEnvironment.Builder
for chaining purposes.public OrphanReporterConfig.Builder orphanReporterConfig()
public SELF compressionConfig(CompressionConfig.Builder compressionConfig)
Usually this does not need to be tuned, but thresholds can be modified or compression can be disabled completely if needed.
compressionConfig
- the custom compression config.CoreEnvironment.Builder
for chaining purposes.public CompressionConfig.Builder compressionConfig()
public SELF securityConfig(SecurityConfig.Builder securityConfig)
Note that if you are looking to use client certificate authentication, please refer to the
CertificateAuthenticator
instead.
securityConfig
- the custom security config to use.CoreEnvironment.Builder
for chaining purposes.public SecurityConfig.Builder securityConfig()
public SELF timeoutConfig(TimeoutConfig.Builder timeoutConfig)
Each timeout can also be modified on a per-request basis in their respective options blocks.
timeoutConfig
- the custom timeout config to use.CoreEnvironment.Builder
for chaining purposes.public TimeoutConfig.Builder timeoutConfig()
public SELF loggerConfig(LoggerConfig.Builder loggerConfig)
The default logger attaches itself to the EventBus
on the environment and logs consumed events. This
configuration allows to customize its behavior, diagnostic context etc.
loggerConfig
- the custom logger config to use.CoreEnvironment.Builder
for chaining purposes.public LoggerConfig.Builder loggerConfig()
@Stability.Uncommitted public SELF eventBus(EventBus eventBus)
The SDK ships with a high-performance implementation of a event bus. Only swap out if you have special needs,
usually what you want instead is to register your own consumer on the event bus instead
(EventBus.subscribe(Consumer)
)!
eventBus
- the event bus to use.CoreEnvironment.Builder
for chaining purposes.@Stability.Uncommitted public SELF scheduler(Scheduler scheduler)
Usually you do not need to modify the scheduler, use with care.
scheduler
- a custom scheduler to use.CoreEnvironment.Builder
for chaining purposes.public SELF retryStrategy(RetryStrategy retryStrategy)
Note that this setting modifies the SDK-wide retry strategy. It can still be overridden on a per-request basis in the respective options block.
retryStrategy
- the default retry strategy to use for all operations.CoreEnvironment.Builder
for chaining purposes.@Stability.Volatile public SELF requestTracer(RequestTracer requestTracer)
IMPORTANT: this is a volatile, likely to change API!
requestTracer
- the custom request tracer to use.CoreEnvironment.Builder
for chaining purposes.public CoreEnvironment build()
CoreEnvironment
.Copyright © 2020 Couchbase, Inc.. All rights reserved.