Class CoreEnvironment.Builder<SELF extends CoreEnvironment.Builder<SELF>>
- java.lang.Object
-
- com.couchbase.client.core.env.CoreEnvironment.Builder<SELF>
-
- Enclosing class:
- CoreEnvironment
public static class CoreEnvironment.Builder<SELF extends CoreEnvironment.Builder<SELF>> extends Object
-
-
Field Summary
Fields Modifier and Type Field Description protected CoreTransactionsConfigtransactionsConfig
-
Constructor Summary
Constructors Modifier Constructor Description protectedBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description SELFaddRequestCallback(RequestCallback requestCallback)Allows to configure callbacks across the lifetime of a request.SELFapplyProfile(String profileName)Applies custom properties based on a profile name.CoreEnvironmentbuild()Turns this builder into a realCoreEnvironment.CompressionConfig.BuildercompressionConfig()Returns the currently stored config builder.SELFcompressionConfig(CompressionConfig.Builder compressionConfig)Deprecated.Please usecompressionConfig(Consumer)instead.SELFcompressionConfig(Consumer<CompressionConfig.Builder> builderConsumer)Allows to configure theCompressionConfigthrough a provided builder.SELFeventBus(EventBus eventBus)Customizes the event bus for the SDK.IoConfig.BuilderioConfig()Returns the currently stored config builder.SELFioConfig(IoConfig.Builder ioConfig)Deprecated.Please useioConfig(Consumer)instead.SELFioConfig(Consumer<IoConfig.Builder> builderConsumer)Allows to configure theIoConfigthrough a provided builder.IoEnvironment.BuilderioEnvironment()Deprecated.Please useioEnvironmentConfig()instead.SELFioEnvironment(IoEnvironment.Builder ioEnvironment)Deprecated.Please useioEnvironment(Consumer)instead.SELFioEnvironment(Consumer<IoEnvironment.Builder> builderConsumer)Allows to configure theIoEnvironmentthrough a provided builder.IoEnvironment.BuilderioEnvironmentConfig()Returns the currently stored IoEnvironment builder.SELFload(PropertyLoader<CoreEnvironment.Builder> loader)Immediately loads the properties from the given loader into the environment.LoggerConfig.BuilderloggerConfig()Returns the currently stored config builder.SELFloggerConfig(LoggerConfig.Builder loggerConfig)Deprecated.Please useloggerConfig(Consumer)instead.SELFloggerConfig(Consumer<LoggerConfig.Builder> builderConsumer)Allows to configure theLoggerConfigthrough a provided builder.LoggingMeterConfig.BuilderloggingMeterConfig()SELFloggingMeterConfig(LoggingMeterConfig.Builder loggingMeterConfig)Deprecated.Please useloggingMeterConfig(Consumer)instead.SELFloggingMeterConfig(Consumer<LoggingMeterConfig.Builder> builderConsumer)Allows to configure theLoggingMeterConfigthrough a provided builder.SELFmaxNumRequestsInRetry(long maxNumRequestsInRetry)Allows to customize the maximum number of requests allowed in the retry timer.SELFmeter(Meter meter)Allows to configure a custom metrics implementation.OrphanReporterConfig.BuilderorphanReporterConfig()Returns the currently stored config builder.SELForphanReporterConfig(OrphanReporterConfig.Builder orphanReporterConfig)Deprecated.Please useorphanReporterConfig(Consumer)instead.SELForphanReporterConfig(Consumer<OrphanReporterConfig.Builder> builderConsumer)Allows to configure theOrphanReporterConfigthrough a provided builder.SELFrequestTracer(RequestTracer requestTracer)Allows to configure a custom tracer implementation.SELFretryStrategy(RetryStrategy retryStrategy)Allows to customize the default retry strategy.SELFscheduler(Scheduler scheduler)Customizes the default Reactor scheduler used for parallel operations.SELFschedulerThreadCount(int schedulerThreadCount)Customizes the thread count for theCoreEnvironment.scheduler()if not customized byscheduler(Scheduler).SecurityConfig.BuildersecurityConfig()Returns the currently stored config builder.SELFsecurityConfig(SecurityConfig.Builder securityConfig)Deprecated.Please usesecurityConfig(Consumer)instead.SELFsecurityConfig(Consumer<SecurityConfig.Builder> builderConsumer)Allows to configure theSecurityConfigthrough a provided builder.protected SELFself()ThresholdLoggingTracerConfig.BuilderthresholdLoggingTracerConfig()SELFthresholdLoggingTracerConfig(ThresholdLoggingTracerConfig.Builder thresholdLoggingTracerConfig)Deprecated.Please usethresholdLoggingTracerConfig(Consumer)instead.SELFthresholdLoggingTracerConfig(Consumer<ThresholdLoggingTracerConfig.Builder> builderConsumer)Allows to configure theThresholdLoggingTracerConfigthrough a provided builder.ThresholdRequestTracerConfig.BuilderthresholdRequestTracerConfig()Deprecated.SELFthresholdRequestTracerConfig(ThresholdRequestTracerConfig.Builder thresholdRequestTracerConfig)Deprecated.Please usethresholdLoggingTracerConfig(Consumer)instead.TimeoutConfig.BuildertimeoutConfig()Returns the currently stored config builder.SELFtimeoutConfig(TimeoutConfig.Builder timeoutConfig)Deprecated.Please usetimeoutConfig(Consumer)instead.SELFtimeoutConfig(Consumer<TimeoutConfig.Builder> builderConsumer)Allows to configure theTimeoutConfigthrough a provided builder.
-
-
-
Field Detail
-
transactionsConfig
protected CoreTransactionsConfig transactionsConfig
-
-
Method Detail
-
ioEnvironment
public SELF ioEnvironment(Consumer<IoEnvironment.Builder> builderConsumer)
Allows to configure theIoEnvironmentthrough a provided builder.This method is preferred over
ioEnvironment(IoEnvironment.Builder)since then properties on an already existing configuration are not overridden.- Parameters:
builderConsumer- the builder for theIoEnvironmentto customize.- Returns:
- this
CoreEnvironment.Builderfor chaining purposes.
-
ioConfig
public SELF ioConfig(Consumer<IoConfig.Builder> builderConsumer)
Allows to configure theIoConfigthrough a provided builder.This method is preferred over
ioConfig(IoConfig.Builder)since then properties on an already existing configuration are not overridden.- Parameters:
builderConsumer- the builder for theIoConfigto customize.- Returns:
- this
CoreEnvironment.Builderfor chaining purposes.
-
compressionConfig
public SELF compressionConfig(Consumer<CompressionConfig.Builder> builderConsumer)
Allows to configure theCompressionConfigthrough a provided builder.This method is preferred over
compressionConfig(CompressionConfig.Builder)since then properties on an already existing configuration are not overridden.- Parameters:
builderConsumer- the builder for theCompressionConfigto customize.- Returns:
- this
CoreEnvironment.Builderfor chaining purposes.
-
securityConfig
public SELF securityConfig(Consumer<SecurityConfig.Builder> builderConsumer)
Allows to configure theSecurityConfigthrough a provided builder.This method is preferred over
securityConfig(SecurityConfig.Builder)since then properties on an already existing configuration are not overridden.- Parameters:
builderConsumer- the builder for theSecurityConfigto customize.- Returns:
- this
CoreEnvironment.Builderfor chaining purposes.
-
timeoutConfig
public SELF timeoutConfig(Consumer<TimeoutConfig.Builder> builderConsumer)
Allows to configure theTimeoutConfigthrough a provided builder.This method is preferred over
timeoutConfig(TimeoutConfig.Builder)since then properties on an already existing configuration are not overridden.- Parameters:
builderConsumer- the builder for theTimeoutConfigto customize.- Returns:
- this
CoreEnvironment.Builderfor chaining purposes.
-
loggerConfig
public SELF loggerConfig(Consumer<LoggerConfig.Builder> builderConsumer)
Allows to configure theLoggerConfigthrough a provided builder.This method is preferred over
loggerConfig(LoggerConfig.Builder)since then properties on an already existing configuration are not overridden.- Parameters:
builderConsumer- the builder for theLoggerConfigto customize.- Returns:
- this
CoreEnvironment.Builderfor chaining purposes.
-
orphanReporterConfig
public SELF orphanReporterConfig(Consumer<OrphanReporterConfig.Builder> builderConsumer)
Allows to configure theOrphanReporterConfigthrough a provided builder.This method is preferred over
orphanReporterConfig(OrphanReporterConfig.Builder)since then properties on an already existing configuration are not overridden.- Parameters:
builderConsumer- the builder for theOrphanReporterConfigto customize.- Returns:
- this
CoreEnvironment.Builderfor chaining purposes.
-
thresholdLoggingTracerConfig
public SELF thresholdLoggingTracerConfig(Consumer<ThresholdLoggingTracerConfig.Builder> builderConsumer)
Allows to configure theThresholdLoggingTracerConfigthrough a provided builder.This method is preferred over
thresholdLoggingTracerConfig(ThresholdLoggingTracerConfig.Builder)since then properties on an already existing configuration are not overridden.- Parameters:
builderConsumer- the builder for theThresholdLoggingTracerConfigto customize.- Returns:
- this
CoreEnvironment.Builderfor chaining purposes.
-
loggingMeterConfig
public SELF loggingMeterConfig(Consumer<LoggingMeterConfig.Builder> builderConsumer)
Allows to configure theLoggingMeterConfigthrough a provided builder.This method is preferred over
loggingMeterConfig(LoggingMeterConfig.Builder)since then properties on an already existing configuration are not overridden.- Parameters:
builderConsumer- the builder for theLoggingMeterConfigto customize.- Returns:
- this
CoreEnvironment.Builderfor chaining purposes.
-
self
protected SELF self()
-
maxNumRequestsInRetry
public SELF maxNumRequestsInRetry(long maxNumRequestsInRetry)
Allows to customize the maximum number of requests allowed in the retry timer.If the
CoreEnvironment.DEFAULT_MAX_NUM_REQUESTS_IN_RETRYis reached, each request that would be queued for retry is instead cancelled with aCancellationReason.TOO_MANY_REQUESTS_IN_RETRY. This acts as a form of safety net and backpressure.- Parameters:
maxNumRequestsInRetry- the maximum number of requests outstanding for retry.- Returns:
- this
CoreEnvironment.Builderfor chaining purposes.
-
load
public SELF load(PropertyLoader<CoreEnvironment.Builder> loader)
Immediately loads the properties from the given loader into the environment.- Parameters:
loader- the loader to load the properties from.- Returns:
- this
CoreEnvironment.Builderfor chaining purposes.
-
ioEnvironment
@Deprecated public SELF ioEnvironment(IoEnvironment.Builder ioEnvironment)
Deprecated.Please useioEnvironment(Consumer)instead.Allows to customize I/O thread pools.Note that the
IoEnvironmentholds thread pools and other resources. If you do not want to customize thread pool sizes, you likely want to look at theIoConfiginstead.- Parameters:
ioEnvironment- the IO environment to customize.- Returns:
- this
CoreEnvironment.Builderfor chaining purposes.
-
ioEnvironment
@Deprecated public IoEnvironment.Builder ioEnvironment()
Deprecated.Please useioEnvironmentConfig()instead.Returns the currently stored IoEnvironment builder.- Returns:
- the current builder.
-
ioEnvironmentConfig
public IoEnvironment.Builder ioEnvironmentConfig()
Returns the currently stored IoEnvironment builder.- Returns:
- the current builder.
-
ioConfig
@Deprecated public SELF ioConfig(IoConfig.Builder ioConfig)
Deprecated.Please useioConfig(Consumer)instead.Allows to customize various I/O-related configuration properties.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.
- Parameters:
ioConfig- the custom I/O config to use.- Returns:
- this
CoreEnvironment.Builderfor chaining purposes.
-
ioConfig
public IoConfig.Builder ioConfig()
Returns the currently stored config builder.- Returns:
- the current builder.
-
orphanReporterConfig
@Deprecated public SELF orphanReporterConfig(OrphanReporterConfig.Builder orphanReporterConfig)
Deprecated.Please useorphanReporterConfig(Consumer)instead.Allows to customize 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.
- Parameters:
orphanReporterConfig- the custom orphan reporter config.- Returns:
- this
CoreEnvironment.Builderfor chaining purposes.
-
orphanReporterConfig
public OrphanReporterConfig.Builder orphanReporterConfig()
Returns the currently stored config builder.- Returns:
- the current builder.
-
loggingMeterConfig
@Deprecated public SELF loggingMeterConfig(LoggingMeterConfig.Builder loggingMeterConfig)
Deprecated.Please useloggingMeterConfig(Consumer)instead.
-
loggingMeterConfig
public LoggingMeterConfig.Builder loggingMeterConfig()
-
thresholdRequestTracerConfig
@Deprecated public SELF thresholdRequestTracerConfig(ThresholdRequestTracerConfig.Builder thresholdRequestTracerConfig)
Deprecated.Please usethresholdLoggingTracerConfig(Consumer)instead.Allows to customize the threshold request tracer configuration.- Parameters:
thresholdRequestTracerConfig- the configuration which should be used.- Returns:
- this
CoreEnvironment.Builderfor chaining purposes.
-
thresholdRequestTracerConfig
@Deprecated public ThresholdRequestTracerConfig.Builder thresholdRequestTracerConfig()
Deprecated.
-
thresholdLoggingTracerConfig
@Deprecated public SELF thresholdLoggingTracerConfig(ThresholdLoggingTracerConfig.Builder thresholdLoggingTracerConfig)
Deprecated.Please usethresholdLoggingTracerConfig(Consumer)instead.Allows to customize the threshold request tracer configuration.- Parameters:
thresholdLoggingTracerConfig- the configuration which should be used.- Returns:
- this
CoreEnvironment.Builderfor chaining purposes.
-
thresholdLoggingTracerConfig
public ThresholdLoggingTracerConfig.Builder thresholdLoggingTracerConfig()
-
compressionConfig
@Deprecated public SELF compressionConfig(CompressionConfig.Builder compressionConfig)
Deprecated.Please usecompressionConfig(Consumer)instead.Allows to customize 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.
- Parameters:
compressionConfig- the custom compression config.- Returns:
- this
CoreEnvironment.Builderfor chaining purposes.
-
compressionConfig
public CompressionConfig.Builder compressionConfig()
Returns the currently stored config builder.- Returns:
- the current builder.
-
securityConfig
@Deprecated public SELF securityConfig(SecurityConfig.Builder securityConfig)
Deprecated.Please usesecurityConfig(Consumer)instead.Allows to configure everything related to TLS/encrypted connections.Note that if you are looking to use client certificate authentication, please refer to the
CertificateAuthenticatorinstead.- Parameters:
securityConfig- the custom security config to use.- Returns:
- this
CoreEnvironment.Builderfor chaining purposes.
-
securityConfig
public SecurityConfig.Builder securityConfig()
Returns the currently stored config builder.- Returns:
- the current builder.
-
timeoutConfig
@Deprecated public SELF timeoutConfig(TimeoutConfig.Builder timeoutConfig)
Deprecated.Please usetimeoutConfig(Consumer)instead.Allows to customize the default timeouts for all operations.Each timeout can also be modified on a per-request basis in their respective options blocks.
- Parameters:
timeoutConfig- the custom timeout config to use.- Returns:
- this
CoreEnvironment.Builderfor chaining purposes.
-
timeoutConfig
public TimeoutConfig.Builder timeoutConfig()
Returns the currently stored config builder.- Returns:
- the current builder.
-
loggerConfig
@Deprecated public SELF loggerConfig(LoggerConfig.Builder loggerConfig)
Deprecated.Please useloggerConfig(Consumer)instead.Allows to provide a custom configuration for the default logger used.The default logger attaches itself to the
EventBuson the environment and logs consumed events. This configuration allows to customize its behavior, diagnostic context etc.- Parameters:
loggerConfig- the custom logger config to use.- Returns:
- this
CoreEnvironment.Builderfor chaining purposes.
-
loggerConfig
public LoggerConfig.Builder loggerConfig()
Returns the currently stored config builder.- Returns:
- the current builder.
-
eventBus
@Uncommitted public SELF eventBus(EventBus eventBus)
Customizes the event bus for the SDK.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))!- Parameters:
eventBus- the event bus to use.- Returns:
- this
CoreEnvironment.Builderfor chaining purposes.
-
scheduler
@Uncommitted public SELF scheduler(Scheduler scheduler)
Customizes the default Reactor scheduler used for parallel operations.Usually you do not need to modify the scheduler, use with care.
- Parameters:
scheduler- a custom scheduler to use.- Returns:
- this
CoreEnvironment.Builderfor chaining purposes.
-
schedulerThreadCount
@Uncommitted public SELF schedulerThreadCount(int schedulerThreadCount)
Customizes the thread count for theCoreEnvironment.scheduler()if not customized byscheduler(Scheduler).By default,
Schedulers.DEFAULT_POOL_SIZEis used. Note that if the scheduler itself is customized, this value is ignored.- Parameters:
schedulerThreadCount- the number of threads to use for the scheduler.- Returns:
- this
CoreEnvironment.Builderfor chaining purposes.
-
retryStrategy
public SELF retryStrategy(RetryStrategy retryStrategy)
Allows to customize the default retry strategy.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.
- Parameters:
retryStrategy- the default retry strategy to use for all operations.- Returns:
- this
CoreEnvironment.Builderfor chaining purposes.
-
requestTracer
@Volatile public SELF requestTracer(RequestTracer requestTracer)
Allows to configure a custom tracer implementation.IMPORTANT: this is a volatile, likely to change API!
- Parameters:
requestTracer- the custom request tracer to use.- Returns:
- this
CoreEnvironment.Builderfor chaining purposes.
-
meter
@Volatile public SELF meter(Meter meter)
Allows to configure a custom metrics implementation.IMPORTANT: this is a volatile, likely to change API!
- Parameters:
meter- the custom metrics implementation to use.- Returns:
- this
CoreEnvironment.Builderfor chaining purposes.
-
addRequestCallback
@Internal public SELF addRequestCallback(RequestCallback requestCallback)
Allows to configure callbacks across the lifetime of a request.IMPORTANT: this is internal API and might change at any point in time.
- Parameters:
requestCallback- the callback to use.- Returns:
- this
CoreEnvironment.Builderfor chaining purposes.
-
build
public CoreEnvironment build()
Turns this builder into a realCoreEnvironment.- Returns:
- the created core environment.
-
applyProfile
@Volatile public SELF applyProfile(String profileName)
Applies custom properties based on a profile name.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
WanDevelopmentProfilefor examples and usage.- Returns:
- this
CoreEnvironment.Builderfor chaining purposes.
-
-