public interface CoreEnvironment extends SecureEnvironment, ConfigParserEnvironment
A CoreEnvironment
provides all the core building blocks like environment settings and thread pools so that the application can work with it properly.
This interface defines the contract. How properties are loaded is chosen by the implementation. See the DefaultCoreEnvironment
class for the default implementation.
Note that the CoreEnvironment
is stateful, so be sure to call shutdown()
or shutdownAsync()
properly.
Modifier and Type | Method and Description |
---|---|
EventLoopGroup |
analyticsIoPool()
If set returns the IO Pool for the analytics service, if not returns null.
|
AnalyticsServiceConfig |
analyticsServiceConfig()
Returns the current
AnalyticsService configuration. |
long |
autoreleaseAfter()
The time in milliseconds after which a non-subscribed observable is going to be automatically released.
|
int |
bootstrapCarrierDirectPort()
The port to use when bootstrapping through carrier publication without SSL.
|
boolean |
bootstrapCarrierEnabled()
If bootstrapping through the advanced carrier publication is enabled.
|
int |
bootstrapCarrierSslPort()
The port to use when bootstrapping through carrier publication with SSL.
|
int |
bootstrapHttpDirectPort()
The port to use when bootstrapping through HTTP without SSL.
|
boolean |
bootstrapHttpEnabled()
If bootstrapping through HTTP is enabled.
|
int |
bootstrapHttpSslPort()
The port to use when bootstrapping through HTTP with SSL.
|
boolean |
bufferPoolingEnabled()
Returns if buffer pooling is enabled for greater GC efficiency.
|
boolean |
callbacksOnIoPool()
Returns true if the
Observable callbacks are completed on the IO event loops. |
boolean |
certAuthEnabled()
True if X.509 client certificate authentication is enabled.
|
double |
compressionMinRatio()
If the document is greater than the min compression size it is used for compression, but only sent if the compressed document has a greater compression ratio as the one provided.
|
int |
compressionMinSize()
Returns the minimum size of a document to be considered for compression in the first place.
|
int |
computationPoolSize()
Returns the pool size (number of threads) for all computation tasks.
|
long |
configPollFloorInterval()
Returns the minimum polling interval allowed.
|
long |
configPollInterval()
Returns the proactive polling interval for cluster configurations.
|
boolean |
continuousKeepAliveEnabled()
If set to true, KeepAlives will be sent on a regular basis in the interval also if there is traffic on the socket, not only if its idle.
|
String |
coreBuild()
Returns build information on the Couchbase Java SDK core.
|
String |
coreVersion()
Returns version information on the core.
|
CouchbaseCoreSendHook |
couchbaseCoreSendHook()
Returns the
CouchbaseCoreSendHook if set, null otherwise. |
long |
disconnectTimeout()
The default timeout for disconnect operations, set to
DefaultCoreEnvironment.DISCONNECT_TIMEOUT . |
EventBus |
eventBus()
Returns the event bus where events are broadcasted on and can be published to.
|
boolean |
forceSaslPlain()
Forces the KeyValue SASL Authentication method to PLAIN if set to true, specifically allowing LDAP-based users to authenticate.
|
EventLoopGroup |
ioPool()
Returns the IO pool for the underlying IO framework, used as the default pool if not overridden for the individual services.
|
int |
ioPoolSize()
Returns the configured IO pool size.
|
long |
keepAliveErrorThreshold()
Specifies the number of times a KeepAlive message on a socket can fail before the connection is recycled.
|
long |
keepAliveInterval()
The time in milliseconds after which some service will issue a form of keep-alive request.
|
long |
keepAliveTimeout()
Specifies the timeout of a keepalive operation on the socket in milliseconds.
|
int |
kvEndpoints()
The number of key/value service endpoints.
|
EventLoopGroup |
kvIoPool()
If set returns the IO Pool for the KV service, if not returns null.
|
KeyValueServiceConfig |
kvServiceConfig()
Returns the current
KeyValueService configuration. |
long |
maxRequestLifetime()
Returns the maximum time in milliseconds a request is allowed to life.
|
boolean |
mutationTokensEnabled()
Returns true if extended mutation tokens are enabled.
|
NetworkLatencyMetricsCollector |
networkLatencyMetricsCollector()
Returns the collector responsible for aggregating and publishing network latency information.
|
NetworkResolution |
networkResolution()
Allows to configure the network resolution, default being automatic.
|
Delay |
observeIntervalDelay()
|
boolean |
operationTracingEnabled()
True if tracing is enabled on the environment.
|
boolean |
operationTracingServerDurationEnabled()
True if additional server duration tracing is enabled.
|
OrphanResponseReporter |
orphanResponseReporter()
Returns the current orphan response reporter implementation.
|
boolean |
orphanResponseReportingEnabled()
Check if orphan response reporting is enabled.
|
String |
packageNameAndVersion()
Returns name and the version of the package.
|
int |
queryEndpoints()
The number of query service endpoints.
|
EventLoopGroup |
queryIoPool()
If set returns the IO Pool for the query service, if not returns null.
|
QueryServiceConfig |
queryServiceConfig()
Returns the current
QueryService configuration. |
Delay |
reconnectDelay()
Returns the
Delay for node reconnects. |
int |
requestBufferSize()
Returns the size of the request ringbuffer.
|
WaitStrategyFactory |
requestBufferWaitStrategy()
Waiting strategy used by request
EventProcessor s to wait for data from RingBuffer |
int |
responseBufferSize()
Returns the size of the response ringbuffer.
|
Delay |
retryDelay()
Returns the
Delay for request retries. |
RetryStrategy |
retryStrategy()
The retry strategy on how to dispatch requests in the failure case.
|
MetricsCollector |
runtimeMetricsCollector()
Returns the collector responsible for aggregating and publishing runtime information like gc and memory.
|
rx.Scheduler |
scheduler()
Returns the scheduler which should be used for all core actions that need to happen asynchronously.
|
int |
searchEndpoints()
The number of search service endpoints.
|
EventLoopGroup |
searchIoPool()
If set returns the IO Pool for the search service, if not returns null.
|
SearchServiceConfig |
searchServiceConfig()
Returns the current
SearchService configuration. |
boolean |
shutdown()
Shutdown the
CoreEnvironment with the default timeout. |
boolean |
shutdown(long timeout,
TimeUnit timeUnit)
Shutdown the
CoreEnvironment with a custom timeout. |
rx.Observable<Boolean> |
shutdownAsync()
Shutdown the
CoreEnvironment in an asynchronous fashion. |
int |
socketConnectTimeout()
Returns the amount of time the SDK will wait on the socket connect until an error is raised and handled.
|
boolean |
tcpNodelayEnabled()
Returns true if TCP_NODELAY is enabled (therefore Nagle’ing is disabled).
|
io.opentracing.Tracer |
tracer()
If tracing is enabled, contains the current tracer that should be used.
|
String |
userAgent()
Library identification string, which can be used as User-Agent header in HTTP requests.
|
int |
viewEndpoints()
The number of view service endpoints.
|
EventLoopGroup |
viewIoPool()
If set returns the IO Pool for the View service, if not returns null.
|
ViewServiceConfig |
viewServiceConfig()
Returns the current
ViewService configuration. |
sslEnabled, sslKeystore, sslKeystoreFile, sslKeystorePassword, sslTruststore, sslTruststoreFile, sslTruststorePassword
memcachedHashingStrategy
boolean shutdown()
Shutdown the CoreEnvironment
with the default timeout.
Note: If this Environment has been created by the user, it is very important to properly close it, but only after all the related cluster and bucket resources need to be closed! Once an environment is shut down, all its contained resources cannot be used any longer!
This method has been converted (after a deprecation phase) from an async method into a synchronous one. The async version can still be found at shutdownAsync()
.
boolean shutdown(long timeout, TimeUnit timeUnit)
Shutdown the CoreEnvironment
with a custom timeout.
Note: If this Environment has been created by the user, it is very important to properly close it, but only after all the related cluster and bucket resources need to be closed! Once an environment is shut down, all its contained resources cannot be used any longer!
This method has been converted (after a deprecation phase) from an async method into a synchronous one. The async version can still be found at shutdownAsync()
.
long disconnectTimeout()
The default timeout for disconnect operations, set to DefaultCoreEnvironment.DISCONNECT_TIMEOUT
.
rx.Observable<Boolean> shutdownAsync()
Shutdown the CoreEnvironment
in an asynchronous fashion.
Note: If this Environment has been created by the user, it is very important to properly close it, but only after all the related cluster and bucket resources need to be closed! Once an environment is shut down, all its contained resources cannot be used any longer!
Since this method is asynchronous and cold, it is important to subscribe to the observable to actually initiate the shutdown process.
Observable
eventually returning a boolean, indicating the success of the shutdown.EventLoopGroup ioPool()
Returns the IO pool for the underlying IO framework, used as the default pool if not overridden for the individual services.
EventLoopGroup kvIoPool()
If set returns the IO Pool for the KV service, if not returns null.
EventLoopGroup viewIoPool()
If set returns the IO Pool for the View service, if not returns null.
EventLoopGroup queryIoPool()
If set returns the IO Pool for the query service, if not returns null.
EventLoopGroup searchIoPool()
If set returns the IO Pool for the search service, if not returns null.
EventLoopGroup analyticsIoPool()
If set returns the IO Pool for the analytics service, if not returns null.
KeyValueServiceConfig kvServiceConfig()
Returns the current KeyValueService
configuration.
QueryServiceConfig queryServiceConfig()
Returns the current QueryService
configuration.
ViewServiceConfig viewServiceConfig()
Returns the current ViewService
configuration.
SearchServiceConfig searchServiceConfig()
Returns the current SearchService
configuration.
AnalyticsServiceConfig analyticsServiceConfig()
Returns the current AnalyticsService
configuration.
rx.Scheduler scheduler()
Returns the scheduler which should be used for all core actions that need to happen asynchronously.
boolean bootstrapHttpEnabled()
If bootstrapping through HTTP is enabled.
boolean bootstrapCarrierEnabled()
If bootstrapping through the advanced carrier publication is enabled.
int bootstrapHttpDirectPort()
The port to use when bootstrapping through HTTP without SSL.
int bootstrapHttpSslPort()
The port to use when bootstrapping through HTTP with SSL.
int bootstrapCarrierDirectPort()
The port to use when bootstrapping through carrier publication without SSL.
int bootstrapCarrierSslPort()
The port to use when bootstrapping through carrier publication with SSL.
int ioPoolSize()
Returns the configured IO pool size.
int computationPoolSize()
Returns the pool size (number of threads) for all computation tasks.
Delay observeIntervalDelay()
Delay reconnectDelay()
Returns the Delay
for node reconnects.
Delay retryDelay()
Returns the Delay
for request retries.
int requestBufferSize()
Returns the size of the request ringbuffer.
int responseBufferSize()
Returns the size of the response ringbuffer.
int kvEndpoints()
The number of key/value service endpoints.
int viewEndpoints()
The number of view service endpoints.
int queryEndpoints()
The number of query service endpoints.
int searchEndpoints()
The number of search service endpoints.
String coreVersion()
Returns version information on the core. Version number is in the form MAJOR.MINOR.PATCH, and is the one for the core-io layer.
for a more specific build information (relevant for tracking
the exact version of the code the core was built from)
String coreBuild()
Returns build information on the Couchbase Java SDK core. This has a better granularity than coreVersion()
and thus is more relevant to track the exact version of the code the core was built from.
Build information can contain VCS information like commit numbers, tags, etc…
for more generic version information.
String userAgent()
Library identification string, which can be used as User-Agent header in HTTP requests.
String packageNameAndVersion()
Returns name and the version of the package. This method used to by @{link userAgent()}.
RetryStrategy retryStrategy()
The retry strategy on how to dispatch requests in the failure case.
long maxRequestLifetime()
Returns the maximum time in milliseconds a request is allowed to life.
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.
long autoreleaseAfter()
The time in milliseconds after which a non-subscribed observable is going to be automatically released.
This prevents accidentally leaking buffers when requested but not consumed by the user.
long keepAliveInterval()
The time in milliseconds after which some service will issue a form of keep-alive request.
@InterfaceAudience.Public @InterfaceStability.Uncommitted boolean continuousKeepAliveEnabled()
If set to true, KeepAlives will be sent on a regular basis in the interval also if there is traffic on the socket, not only if its idle.
@InterfaceAudience.Public @InterfaceStability.Uncommitted long keepAliveErrorThreshold()
Specifies the number of times a KeepAlive message on a socket can fail before the connection is recycled.
@InterfaceAudience.Public @InterfaceStability.Uncommitted long keepAliveTimeout()
Specifies the timeout of a keepalive operation on the socket in milliseconds.
EventBus eventBus()
Returns the event bus where events are broadcasted on and can be published to.
boolean bufferPoolingEnabled()
Returns if buffer pooling is enabled for greater GC efficiency.
In general this is always set to true and should only be set to false if there are leaks reported that are not fixable by correcting user level code.
boolean tcpNodelayEnabled()
Returns true if TCP_NODELAY is enabled (therefore Nagle’ing is disabled).
boolean mutationTokensEnabled()
Returns true if extended mutation tokens are enabled.
Note that while this may return true, the server also needs to support it (Couchbase Server 4.0 and above). It will be negotiated during connection setup, but needs to be explicitly enabled on the environment as well to take effect (since it has a 16 bytes overhead on every mutation performed).
MetricsCollector runtimeMetricsCollector()
Returns the collector responsible for aggregating and publishing runtime information like gc and memory.
NetworkLatencyMetricsCollector networkLatencyMetricsCollector()
Returns the collector responsible for aggregating and publishing network latency information.
int socketConnectTimeout()
Returns the amount of time the SDK will wait on the socket connect until an error is raised and handled.
boolean callbacksOnIoPool()
Returns true if the Observable
callbacks are 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.
@InterfaceStability.Experimental @InterfaceAudience.Public WaitStrategyFactory requestBufferWaitStrategy()
Waiting strategy used by request EventProcessor
s to wait for data from RingBuffer
@InterfaceStability.Committed @InterfaceAudience.Public long configPollInterval()
Returns the proactive polling interval for cluster configurations.
@InterfaceStability.Committed @InterfaceAudience.Public long configPollFloorInterval()
Returns the minimum polling interval allowed.
@InterfaceStability.Uncommitted @InterfaceAudience.Public boolean certAuthEnabled()
True if X.509 client certificate authentication is enabled.
@InterfaceStability.Experimental @InterfaceAudience.Public CouchbaseCoreSendHook couchbaseCoreSendHook()
Returns the CouchbaseCoreSendHook
if set, null otherwise.
boolean forceSaslPlain()
Forces the KeyValue SASL Authentication method to PLAIN if set to true, specifically allowing LDAP-based users to authenticate.
@InterfaceStability.Committed boolean operationTracingEnabled()
True if tracing is enabled on the environment.
@InterfaceStability.Committed boolean operationTracingServerDurationEnabled()
True if additional server duration tracing is enabled.
@InterfaceStability.Committed io.opentracing.Tracer tracer()
If tracing is enabled, contains the current tracer that should be used.
int compressionMinSize()
Returns the minimum size of a document to be considered for compression in the first place.
double compressionMinRatio()
If the document is greater than the min compression size it is used for compression, but only sent if the compressed document has a greater compression ratio as the one provided.
@InterfaceStability.Committed boolean orphanResponseReportingEnabled()
Check if orphan response reporting is enabled. If it is, operations that are not listened to anymore are being fed into the orphan reporter and depending on the implementation (by default) logged.
@InterfaceStability.Committed OrphanResponseReporter orphanResponseReporter()
Returns the current orphan response reporter implementation.
@InterfaceAudience.Public @InterfaceStability.Uncommitted NetworkResolution networkResolution()
Allows to configure the network resolution, default being automatic.
Copyright © 2018 Couchbase, Inc.. All rights reserved.