public static class CoreEnvironment.Builder<SELF extends CoreEnvironment.Builder<SELF>> extends Object
Modifier and Type | Field and Description |
---|---|
protected CoreTransactionsConfig |
transactionsConfig |
Modifier | Constructor and Description |
---|---|
protected |
Builder() |
Modifier and Type | Method and Description |
---|---|
SELF |
addRequestCallback(RequestCallback requestCallback)
Allows to configure callbacks across the lifetime of a request.
|
SELF |
applyProfile(String profileName)
Applies custom properties based on a profile name.
|
CoreEnvironment |
build()
Turns this builder into a real
CoreEnvironment . |
CompressionConfig.Builder |
compressionConfig()
Returns the currently stored config builder.
|
SELF |
compressionConfig(CompressionConfig.Builder compressionConfig)
Deprecated.
This method clobbers any previously configured values. Please use
compressionConfig(Consumer) instead. |
SELF |
compressionConfig(Consumer<CompressionConfig.Builder> builderConsumer)
Passes the
CompressionConfig.Builder to the provided consumer. |
SELF |
eventBus(EventBus eventBus)
Customizes the event bus for the SDK.
|
IoConfig.Builder |
ioConfig()
Returns the currently stored config builder.
|
SELF |
ioConfig(Consumer<IoConfig.Builder> builderConsumer)
Passes the
IoConfig.Builder to the provided consumer. |
SELF |
ioConfig(IoConfig.Builder ioConfig)
Deprecated.
This method clobbers any previously configured values. Please use
ioConfig(Consumer) instead. |
IoEnvironment.Builder |
ioEnvironment()
Deprecated.
Please use
ioEnvironmentConfig() instead. |
SELF |
ioEnvironment(Consumer<IoEnvironment.Builder> builderConsumer)
Passes the
IoEnvironment.Builder to the provided consumer. |
SELF |
ioEnvironment(IoEnvironment.Builder ioEnvironment)
Deprecated.
This method clobbers any previously configured values. Please use
ioEnvironment(Consumer) instead. |
IoEnvironment.Builder |
ioEnvironmentConfig()
Returns the currently stored IoEnvironment builder.
|
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(Consumer<LoggerConfig.Builder> builderConsumer)
Passes the
LoggerConfig.Builder to the provided consumer. |
SELF |
loggerConfig(LoggerConfig.Builder loggerConfig)
Deprecated.
This method clobbers any previously configured values. Please use
loggerConfig(Consumer) instead. |
LoggingMeterConfig.Builder |
loggingMeterConfig() |
SELF |
loggingMeterConfig(Consumer<LoggingMeterConfig.Builder> builderConsumer)
Passes the
LoggingMeterConfig.Builder to the provided consumer. |
SELF |
loggingMeterConfig(LoggingMeterConfig.Builder loggingMeterConfig)
Deprecated.
This method clobbers any previously configured values. Please use
loggingMeterConfig(Consumer) instead. |
SELF |
maxNumRequestsInRetry(long maxNumRequestsInRetry)
Allows to customize the maximum number of requests allowed in the retry timer.
|
SELF |
meter(Meter meter)
Allows to configure a custom metrics implementation.
|
OrphanReporterConfig.Builder |
orphanReporterConfig()
Returns the currently stored config builder.
|
SELF |
orphanReporterConfig(Consumer<OrphanReporterConfig.Builder> builderConsumer)
Passes the
OrphanReporterConfig.Builder to the provided consumer. |
SELF |
orphanReporterConfig(OrphanReporterConfig.Builder orphanReporterConfig)
Deprecated.
This method clobbers any previously configured values. Please use
orphanReporterConfig(Consumer) instead. |
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.
|
SELF |
schedulerThreadCount(int schedulerThreadCount)
Customizes the thread count for the
CoreEnvironment.scheduler() if not customized by scheduler(Scheduler) . |
SecurityConfig.Builder |
securityConfig()
Returns the currently stored config builder.
|
SELF |
securityConfig(Consumer<SecurityConfig.Builder> builderConsumer)
Passes the
SecurityConfig.Builder to the provided consumer. |
SELF |
securityConfig(SecurityConfig.Builder securityConfig)
Deprecated.
This method clobbers any previously configured values. Please use
securityConfig(Consumer) instead. |
protected SELF |
self() |
ThresholdLoggingTracerConfig.Builder |
thresholdLoggingTracerConfig() |
SELF |
thresholdLoggingTracerConfig(Consumer<ThresholdLoggingTracerConfig.Builder> builderConsumer)
Passes the
ThresholdLoggingTracerConfig.Builder to the provided consumer. |
SELF |
thresholdLoggingTracerConfig(ThresholdLoggingTracerConfig.Builder thresholdLoggingTracerConfig)
Deprecated.
This method clobbers any previously configured values. Please use
thresholdLoggingTracerConfig(Consumer) instead. |
ThresholdRequestTracerConfig.Builder |
thresholdRequestTracerConfig()
Deprecated.
|
SELF |
thresholdRequestTracerConfig(ThresholdRequestTracerConfig.Builder thresholdRequestTracerConfig)
Deprecated.
This method clobbers any previously configured values. Please use
thresholdLoggingTracerConfig(Consumer) instead. |
TimeoutConfig.Builder |
timeoutConfig()
Returns the currently stored config builder.
|
SELF |
timeoutConfig(Consumer<TimeoutConfig.Builder> builderConsumer)
Passes the
TimeoutConfig.Builder to the provided consumer. |
SELF |
timeoutConfig(TimeoutConfig.Builder timeoutConfig)
Deprecated.
This method clobbers any previously configured values. Please use
timeoutConfig(Consumer) instead. |
SELF |
transactionsConfig(CoreTransactionsConfig transactionsConfig)
Allows configuring the transactions config.
|
protected CoreTransactionsConfig transactionsConfig
public SELF ioEnvironment(Consumer<IoEnvironment.Builder> builderConsumer)
IoEnvironment.Builder
to the provided consumer.
Allows customizing I/O thread pools and other resources.
For more I/O settings, see: ioConfig(Consumer)
builderConsumer
- configures the builder.CoreEnvironment.Builder
for chaining purposes.public SELF ioConfig(Consumer<IoConfig.Builder> builderConsumer)
IoConfig.Builder
to the provided consumer.
This is the main way to control how the SDK behaves at the lower levels. It allows customizing settings such as tcp keepalive, number of connections, circuit breakers, etc.
builderConsumer
- configures the builder.CoreEnvironment.Builder
for chaining purposes.public SELF compressionConfig(Consumer<CompressionConfig.Builder> builderConsumer)
CompressionConfig.Builder
to the provided consumer.
Allows customizing document value compression settings.
Usually this does not need to be tuned, but thresholds can be modified or compression can be disabled completely if needed.
builderConsumer
- configures the builder.CoreEnvironment.Builder
for chaining purposes.public SELF securityConfig(Consumer<SecurityConfig.Builder> builderConsumer)
SecurityConfig.Builder
to the provided consumer.
Allows configuring everything related to TLS/encrypted connections.
Note that if you are looking to use client certificate authentication,
please refer to the CertificateAuthenticator
instead.
builderConsumer
- configures the builder.CoreEnvironment.Builder
for chaining purposes.public SELF timeoutConfig(Consumer<TimeoutConfig.Builder> builderConsumer)
TimeoutConfig.Builder
to the provided consumer.
Allows customizing the default timeouts for all operations.
The default timeout can be overridden on a per-request basis using the "timeout" property of the request's option block.
builderConsumer
- configures the builder.CoreEnvironment.Builder
for chaining purposes.public SELF loggerConfig(Consumer<LoggerConfig.Builder> builderConsumer)
LoggerConfig.Builder
to the provided consumer.builderConsumer
- configures the builder.CoreEnvironment.Builder
for chaining purposes.public SELF orphanReporterConfig(Consumer<OrphanReporterConfig.Builder> builderConsumer)
OrphanReporterConfig.Builder
to the provided consumer.
Allows customizing the behavior of the orphan response reporter.
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.
builderConsumer
- configures the builder.CoreEnvironment.Builder
for chaining purposes.public SELF thresholdLoggingTracerConfig(Consumer<ThresholdLoggingTracerConfig.Builder> builderConsumer)
ThresholdLoggingTracerConfig.Builder
to the provided consumer.builderConsumer
- configures the builder.CoreEnvironment.Builder
for chaining purposes.public SELF loggingMeterConfig(Consumer<LoggingMeterConfig.Builder> builderConsumer)
LoggingMeterConfig.Builder
to the provided consumer.builderConsumer
- configures the builder.CoreEnvironment.Builder
for chaining purposes.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.@Deprecated public SELF ioEnvironment(IoEnvironment.Builder ioEnvironment)
ioEnvironment(Consumer)
instead.
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.@Deprecated public IoEnvironment.Builder ioEnvironment()
ioEnvironmentConfig()
instead.public IoEnvironment.Builder ioEnvironmentConfig()
@Deprecated public SELF ioConfig(IoConfig.Builder ioConfig)
ioConfig(Consumer)
instead.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()
@Deprecated public SELF orphanReporterConfig(OrphanReporterConfig.Builder orphanReporterConfig)
orphanReporterConfig(Consumer)
instead.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()
@Deprecated public SELF loggingMeterConfig(LoggingMeterConfig.Builder loggingMeterConfig)
loggingMeterConfig(Consumer)
instead.public LoggingMeterConfig.Builder loggingMeterConfig()
@Deprecated public SELF thresholdRequestTracerConfig(ThresholdRequestTracerConfig.Builder thresholdRequestTracerConfig)
thresholdLoggingTracerConfig(Consumer)
instead.thresholdRequestTracerConfig
- the configuration which should be used.CoreEnvironment.Builder
for chaining purposes.@Deprecated public ThresholdRequestTracerConfig.Builder thresholdRequestTracerConfig()
@Deprecated public SELF thresholdLoggingTracerConfig(ThresholdLoggingTracerConfig.Builder thresholdLoggingTracerConfig)
thresholdLoggingTracerConfig(Consumer)
instead.thresholdLoggingTracerConfig
- the configuration which should be used.CoreEnvironment.Builder
for chaining purposes.public ThresholdLoggingTracerConfig.Builder thresholdLoggingTracerConfig()
@Deprecated public SELF compressionConfig(CompressionConfig.Builder compressionConfig)
compressionConfig(Consumer)
instead.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()
@Deprecated public SELF securityConfig(SecurityConfig.Builder securityConfig)
securityConfig(Consumer)
instead.
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()
@Deprecated public SELF timeoutConfig(TimeoutConfig.Builder timeoutConfig)
timeoutConfig(Consumer)
instead.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()
@Deprecated public SELF loggerConfig(LoggerConfig.Builder loggerConfig)
loggerConfig(Consumer)
instead.
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.@Stability.Uncommitted public SELF schedulerThreadCount(int schedulerThreadCount)
CoreEnvironment.scheduler()
if not customized by scheduler(Scheduler)
.
By default, Schedulers.DEFAULT_POOL_SIZE
is used. Note that if the scheduler itself is customized, this
value is ignored.
schedulerThreadCount
- the number of threads to use for the scheduler.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.@Stability.Volatile public SELF meter(Meter meter)
IMPORTANT: this is a volatile, likely to change API!
meter
- the custom metrics implementation to use.CoreEnvironment.Builder
for chaining purposes.@Stability.Internal public SELF transactionsConfig(CoreTransactionsConfig transactionsConfig)
CoreEnvironment.Builder
for chaining purposes.@Stability.Internal public SELF addRequestCallback(RequestCallback requestCallback)
IMPORTANT: this is internal API and might change at any point in time.
requestCallback
- the callback to use.CoreEnvironment.Builder
for chaining purposes.public CoreEnvironment build()
CoreEnvironment
.@Stability.Volatile public SELF applyProfile(String profileName)
At the moment only the "wan-development" profile is supported, but its actual values are not determined yet. Since this is volatile API, the actual profile names and their properties are subject to change.
New profiles can be registered by utilizing the ServiceRegistry mechanism. Create a file with the name of
"com.couchbase.client.core.env.ConfigurationProfile" in your META-INF/services folder and the content contains
each line of classes that implement the "EnvironmentProfile" interface. See the WanDevelopmentProfile
for
examples and usage.
CoreEnvironment.Builder
for chaining purposes.Copyright © 2024 Couchbase, Inc.. All rights reserved.