public interface CoreEnvironment extends SecureEnvironment
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 |
---|---|
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. |
int |
computationPoolSize()
Returns the pool size (number of threads) for all computation tasks.
|
String |
coreBuild()
Returns build information on the Couchbase Java SDK core.
|
String |
coreVersion()
Returns version information on the core.
|
double |
dcpConnectionBufferAckThreshold()
When a DCP connection read bytes reaches this percentage of the
dcpConnectionBufferSize() , a DCP Buffer Acknowledge message is sent to the server |
int |
dcpConnectionBufferSize()
Size of the buffer to control speed of DCP producer.
|
String |
dcpConnectionName() |
boolean |
dcpEnabled()
Identifies if DCP should be enabled.
|
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.
|
EventLoopGroup |
ioPool()
Returns the IO pool for the underlying IO framework.
|
int |
ioPoolSize()
Returns the configured IO pool size.
|
long |
keepAliveInterval()
The time in milliseconds after which some service will issue a form of keep-alive request.
|
int |
kvEndpoints()
The number of key/value service endpoints.
|
long |
maxRequestLifetime()
Returns the maximum time in milliseconds a request is allowed to life.
|
MemcachedHashingStrategy |
memcachedHashingStrategy()
Allows to specify a custom strategy to hash memcached bucket documents.
|
boolean |
mutationTokensEnabled()
Returns true if extended mutation tokens are enabled.
|
NetworkLatencyMetricsCollector |
networkLatencyMetricsCollector()
Returns the collector responsible for aggregating and publishing network latency information.
|
Delay |
observeIntervalDelay()
|
String |
packageNameAndVersion()
Returns name and the version of the package.
|
int |
queryEndpoints()
The number of query service endpoints.
|
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.
|
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.
|
boolean |
shutdown()
Shutdown the
CoreEnvironment with the default timeout. |
boolean |
shutdown(long timeout,
TimeUnit timeUnit)
Shutdown the
CoreEnvironment with a custom timeout. |
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).
|
String |
userAgent()
Library identification string, which can be used as User-Agent header in HTTP requests.
|
int |
viewEndpoints()
The number of view service endpoints.
|
sslEnabled, sslKeystore, sslKeystoreFile, sslKeystorePassword
boolean shutdown()
Shutdown the CoreEnvironment
with the default timeout.
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.
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
.
Observable<Boolean> shutdownAsync()
Shutdown the CoreEnvironment
in an asynchronous fashion.
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.
Scheduler scheduler()
Returns the scheduler which should be used for all core actions that need to happen asynchronously.
boolean dcpEnabled()
Identifies if DCP should be enabled.
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 dcpConnectionBufferSize()
Size of the buffer to control speed of DCP producer.
double dcpConnectionBufferAckThreshold()
When a DCP connection read bytes reaches this percentage of the dcpConnectionBufferSize()
, a DCP Buffer Acknowledge message is sent to the server
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.
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 String dcpConnectionName()
@InterfaceStability.Experimental @InterfaceAudience.Public WaitStrategyFactory requestBufferWaitStrategy()
Waiting strategy used by request EventProcessor
s to wait for data from RingBuffer
MemcachedHashingStrategy memcachedHashingStrategy()
Allows to specify a custom strategy to hash memcached bucket documents.
If you want to use this SDK side by side with 1.x SDKs on memcached buckets, configure the environment to use the LegacyMemcachedHashingStrategy
instead.
Copyright © 2017 Couchbase, Inc.. All rights reserved.