Package com.couchbase.client.core.env
Class DefaultCoreEnvironment
- java.lang.Object
-
- com.couchbase.client.core.env.DefaultCoreEnvironment
-
- All Implemented Interfaces:
ConfigParserEnvironment
,CoreEnvironment
,SecureEnvironment
public class DefaultCoreEnvironment extends Object implements CoreEnvironment
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DefaultCoreEnvironment.Builder<SELF extends DefaultCoreEnvironment.Builder<SELF>>
-
Field Summary
-
Constructor Summary
Constructors Modifier Constructor Description protected
DefaultCoreEnvironment(DefaultCoreEnvironment.Builder builder)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description EventLoopGroup
analyticsIoPool()
If set returns the IO Pool for the analytics service, if not returns null.AnalyticsServiceConfig
analyticsServiceConfig()
Returns the current service configuration for the Analytics service.long
autoreleaseAfter()
The time in milliseconds after which a non-subscribed observable is going to be automatically released.protected boolean
booleanPropertyOr(String path, boolean def)
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.static DefaultCoreEnvironment.Builder
builder()
boolean
callbacksOnIoPool()
Returns true if theObservable
callbacks are completed on the IO event loops.boolean
certAuthEnabled()
True if X.509 client certificate authentication is enabled.boolean
compressionEnabled()
If true, compression is enabled and will be used if the min size and other thresholds match as well.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 theCouchbaseCoreSendHook
if set, null otherwise.static DefaultCoreEnvironment
create()
long
disconnectTimeout()
The default timeout for disconnect operations, set toDISCONNECT_TIMEOUT
.protected static double
doublePropertyOr(String path, double def)
protected StringBuilder
dumpParameters(StringBuilder sb)
Dumps the environment parameters known to this implementation into aStringBuilder
, which is returned for method chaining.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.static int
instanceCounter()
protected int
intPropertyOr(String path, int def)
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 service configuration for the KV service.protected static long
longPropertyOr(String path, long def)
static int
maxAllowedInstances()
Returns the number of maximal allowed instances before warning log will be emitted.static void
maxAllowedInstances(int max)
Allows to set the maximum allowed instances to higher than 1 to silence warning logs in environments where it can be disregarded.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.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 service configuration for the Query service.Delay
reconnectDelay()
Returns theDelay
for node reconnects.int
requestBufferSize()
Returns the size of the request ringbuffer.WaitStrategyFactory
requestBufferWaitStrategy()
Waiting strategy used by requestEventProcessor
s to wait for data fromRingBuffer
int
responseBufferSize()
Returns the size of the response ringbuffer.Delay
retryDelay()
Returns theDelay
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 service configuration for the Search service.boolean
shutdown()
Shutdown theCoreEnvironment
with the default timeout.boolean
shutdown(long timeout, TimeUnit timeUnit)
Shutdown theCoreEnvironment
with a custom timeout.rx.Observable<Boolean>
shutdownAsync()
Shutdown theCoreEnvironment
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
sslEnabled()
Identifies if SSL should be enabled.boolean
sslHostnameVerificationEnabled()
If set to true, hostname verification is enabled.KeyStore
sslKeystore()
Allows to directly configure aKeyStore
.String
sslKeystoreFile()
Identifies the filepath to the ssl keystore.String
sslKeystorePassword()
The password which is used to protect the keystore.KeyStore
sslTruststore()
Allows to directly configure aKeyStore
.String
sslTruststoreFile()
Identifies the filepath to the ssl TrustManager keystore.String
sslTruststorePassword()
The password which is used to protect the TrustManager keystore.protected String
stringPropertyOr(String path, String def)
boolean
tcpNodelayEnabled()
Returns true if TCP_NODELAY is enabled (therefore Nagle'ing is disabled).String
toString()
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 service configuration for the View service.
-
-
-
Field Detail
-
SSL_ENABLED
public static final boolean SSL_ENABLED
- See Also:
- Constant Field Values
-
SSL_HOSTNAME_VERIFICATION_ENABLED
public static final boolean SSL_HOSTNAME_VERIFICATION_ENABLED
- See Also:
- Constant Field Values
-
SSL_KEYSTORE_FILE
public static final String SSL_KEYSTORE_FILE
-
SSL_TRUSTSTORE_FILE
public static final String SSL_TRUSTSTORE_FILE
-
SSL_KEYSTORE_PASSWORD
public static final String SSL_KEYSTORE_PASSWORD
-
SSL_TRUSTSTORE_PASSWORD
public static final String SSL_TRUSTSTORE_PASSWORD
-
SSL_KEYSTORE
public static final KeyStore SSL_KEYSTORE
-
SSL_TRUSTSTORE
public static final KeyStore SSL_TRUSTSTORE
-
BOOTSTRAP_HTTP_ENABLED
public static final boolean BOOTSTRAP_HTTP_ENABLED
- See Also:
- Constant Field Values
-
BOOTSTRAP_CARRIER_ENABLED
public static final boolean BOOTSTRAP_CARRIER_ENABLED
- See Also:
- Constant Field Values
-
BOOTSTRAP_HTTP_DIRECT_PORT
public static final int BOOTSTRAP_HTTP_DIRECT_PORT
- See Also:
- Constant Field Values
-
BOOTSTRAP_HTTP_SSL_PORT
public static final int BOOTSTRAP_HTTP_SSL_PORT
- See Also:
- Constant Field Values
-
BOOTSTRAP_CARRIER_DIRECT_PORT
public static final int BOOTSTRAP_CARRIER_DIRECT_PORT
- See Also:
- Constant Field Values
-
BOOTSTRAP_CARRIER_SSL_PORT
public static final int BOOTSTRAP_CARRIER_SSL_PORT
- See Also:
- Constant Field Values
-
REQUEST_BUFFER_SIZE
public static final int REQUEST_BUFFER_SIZE
- See Also:
- Constant Field Values
-
RESPONSE_BUFFER_SIZE
public static final int RESPONSE_BUFFER_SIZE
- See Also:
- Constant Field Values
-
IO_POOL_SIZE
public static final int IO_POOL_SIZE
-
COMPUTATION_POOL_SIZE
public static final int COMPUTATION_POOL_SIZE
-
KEYVALUE_ENDPOINTS
public static final int KEYVALUE_ENDPOINTS
- See Also:
- Constant Field Values
-
VIEW_ENDPOINTS
public static final int VIEW_ENDPOINTS
- See Also:
- Constant Field Values
-
QUERY_ENDPOINTS
public static final int QUERY_ENDPOINTS
- See Also:
- Constant Field Values
-
SEARCH_ENDPOINTS
public static final int SEARCH_ENDPOINTS
- See Also:
- Constant Field Values
-
ANALYTICS_ENDPOINTS
public static final int ANALYTICS_ENDPOINTS
- See Also:
- Constant Field Values
-
OBSERVE_INTERVAL_DELAY
public static final Delay OBSERVE_INTERVAL_DELAY
-
RECONNECT_DELAY
public static final Delay RECONNECT_DELAY
-
RETRY_DELAY
public static final Delay RETRY_DELAY
-
RETRY_STRATEGY
public static final RetryStrategy RETRY_STRATEGY
-
MAX_REQUEST_LIFETIME
public static final long MAX_REQUEST_LIFETIME
-
KEEPALIVEINTERVAL
public static final long KEEPALIVEINTERVAL
-
CONTINUOUS_KEEPALIVE_ENABLED
public static final boolean CONTINUOUS_KEEPALIVE_ENABLED
- See Also:
- Constant Field Values
-
KEEPALIVE_ERROR_THRESHOLD
public static final long KEEPALIVE_ERROR_THRESHOLD
- See Also:
- Constant Field Values
-
KEEPALIVE_TIMEOUT
public static final long KEEPALIVE_TIMEOUT
- See Also:
- Constant Field Values
-
AUTORELEASE_AFTER
public static final long AUTORELEASE_AFTER
-
BUFFER_POOLING_ENABLED
public static final boolean BUFFER_POOLING_ENABLED
- See Also:
- Constant Field Values
-
TCP_NODELAY_ENALED
public static final boolean TCP_NODELAY_ENALED
- See Also:
- Constant Field Values
-
MUTATION_TOKENS_ENABLED
public static final boolean MUTATION_TOKENS_ENABLED
- See Also:
- Constant Field Values
-
SOCKET_CONNECT_TIMEOUT
public static final int SOCKET_CONNECT_TIMEOUT
- See Also:
- Constant Field Values
-
CALLBACKS_ON_IO_POOL
public static final boolean CALLBACKS_ON_IO_POOL
- See Also:
- Constant Field Values
-
DISCONNECT_TIMEOUT
public static final long DISCONNECT_TIMEOUT
-
MEMCACHED_HASHING_STRATEGY
public static final MemcachedHashingStrategy MEMCACHED_HASHING_STRATEGY
-
CONFIG_POLL_INTERVAL
public static final long CONFIG_POLL_INTERVAL
- See Also:
- Constant Field Values
-
CONFIG_POLL_FLOOR_INTERVAL
public static final long CONFIG_POLL_FLOOR_INTERVAL
- See Also:
- Constant Field Values
-
CERT_AUTH_ENABLED
public static final boolean CERT_AUTH_ENABLED
- See Also:
- Constant Field Values
-
FORCE_SASL_PLAIN
public static final boolean FORCE_SASL_PLAIN
- See Also:
- Constant Field Values
-
OPERATION_TRACING_ENABLED
public static final boolean OPERATION_TRACING_ENABLED
- See Also:
- Constant Field Values
-
OPERATION_TRACING_SERVER_DUR_ENABLED
public static final boolean OPERATION_TRACING_SERVER_DUR_ENABLED
- See Also:
- Constant Field Values
-
MIN_COMPRESSION_SIZE
public static final int MIN_COMPRESSION_SIZE
- See Also:
- Constant Field Values
-
MIN_COMPRESSION_RATIO
public static final double MIN_COMPRESSION_RATIO
- See Also:
- Constant Field Values
-
COMPRESSION_ENABLED
public static final boolean COMPRESSION_ENABLED
- See Also:
- Constant Field Values
-
ORPHAN_REPORTING_ENABLED
public static final boolean ORPHAN_REPORTING_ENABLED
- See Also:
- Constant Field Values
-
NETWORK_RESOLUTION
public static final NetworkResolution NETWORK_RESOLUTION
-
CORE_VERSION
public static String CORE_VERSION
-
CORE_GIT_VERSION
public static String CORE_GIT_VERSION
-
PACKAGE_NAME_AND_VERSION
public static String PACKAGE_NAME_AND_VERSION
-
USER_AGENT
public static String USER_AGENT
-
-
Constructor Detail
-
DefaultCoreEnvironment
protected DefaultCoreEnvironment(DefaultCoreEnvironment.Builder builder)
-
-
Method Detail
-
create
public static DefaultCoreEnvironment create()
-
builder
public static DefaultCoreEnvironment.Builder builder()
-
booleanPropertyOr
protected boolean booleanPropertyOr(String path, boolean def)
-
intPropertyOr
protected int intPropertyOr(String path, int def)
-
longPropertyOr
protected static long longPropertyOr(String path, long def)
-
doublePropertyOr
protected static double doublePropertyOr(String path, double def)
-
ioPool
public EventLoopGroup ioPool()
Description copied from interface:CoreEnvironment
Returns the IO pool for the underlying IO framework, used as the default pool if not overridden for the individual services.- Specified by:
ioPool
in interfaceCoreEnvironment
- Returns:
- the default IO pool, shared across resources.
-
shutdown
public boolean shutdown()
Description copied from interface:CoreEnvironment
Shutdown theCoreEnvironment
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 atCoreEnvironment.shutdownAsync()
.- Specified by:
shutdown
in interfaceCoreEnvironment
- Returns:
- returning a boolean, indicating the success of the shutdown.
-
shutdown
public boolean shutdown(long timeout, TimeUnit timeUnit)
Description copied from interface:CoreEnvironment
Shutdown theCoreEnvironment
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 atCoreEnvironment.shutdownAsync()
.- Specified by:
shutdown
in interfaceCoreEnvironment
- Returns:
- returning a boolean, indicating the success of the shutdown.
-
shutdownAsync
public rx.Observable<Boolean> shutdownAsync()
Description copied from interface:CoreEnvironment
Shutdown theCoreEnvironment
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.- Specified by:
shutdownAsync
in interfaceCoreEnvironment
- Returns:
- an
Observable
eventually returning a boolean, indicating the success of the shutdown.
-
scheduler
public rx.Scheduler scheduler()
Description copied from interface:CoreEnvironment
Returns the scheduler which should be used for all core actions that need to happen asynchronously.- Specified by:
scheduler
in interfaceCoreEnvironment
- Returns:
- the scheduler used for internal operations.
-
sslEnabled
public boolean sslEnabled()
Description copied from interface:SecureEnvironment
Identifies if SSL should be enabled.- Specified by:
sslEnabled
in interfaceSecureEnvironment
- Returns:
- true if SSL is enabled, false otherwise.
-
sslKeystoreFile
public String sslKeystoreFile()
Description copied from interface:SecureEnvironment
Identifies the filepath to the ssl keystore. If this method is used without also specifyingSecureEnvironment.sslTruststoreFile()
this keystore will be used to initialize both the key factory as well as the trust factory with java SSL. This needs to be the case for backwards compatibility, but if you do not need X.509 client cert authentication you might as well just useSecureEnvironment.sslTruststoreFile()
alone.- Specified by:
sslKeystoreFile
in interfaceSecureEnvironment
- Returns:
- the path to the keystore file.
-
sslKeystorePassword
public String sslKeystorePassword()
Description copied from interface:SecureEnvironment
The password which is used to protect the keystore. Only needed ifSecureEnvironment.sslKeystoreFile()
is used.- Specified by:
sslKeystorePassword
in interfaceSecureEnvironment
- Returns:
- the keystore password.
-
sslKeystore
public KeyStore sslKeystore()
Description copied from interface:SecureEnvironment
Allows to directly configure aKeyStore
. If this method is used without also specifyingSecureEnvironment.sslTruststore()
this keystore will be used to initialize both the key factory as well as the trust factory with java SSL. This needs to be the case for backwards compatibility, but if you do not need X.509 client cert authentication you might as well just useSecureEnvironment.sslTruststore()
alone.- Specified by:
sslKeystore
in interfaceSecureEnvironment
- Returns:
- the keystore to use.
-
sslTruststoreFile
public String sslTruststoreFile()
Description copied from interface:SecureEnvironment
Identifies the filepath to the ssl TrustManager keystore. If this method is used without also specifyingSecureEnvironment.sslKeystoreFile()
this keystore will be used to initialize both the key factory as well as the trust factory with java SSL. Prefer this method over theSecureEnvironment.sslKeystoreFile()
if you do not need X.509 client auth and just need server side certificate checking.- Specified by:
sslTruststoreFile
in interfaceSecureEnvironment
- Returns:
- the path to the truststore file.
-
sslTruststore
public KeyStore sslTruststore()
Description copied from interface:SecureEnvironment
Allows to directly configure aKeyStore
. If this method is used without also specifyingSecureEnvironment.sslKeystore()
this keystore will be used to initialize both the key factory as well as the trust factory with java SSL. Prefer this method over theSecureEnvironment.sslKeystore()
if you do not need X.509 client auth and just need server side certificate checking.- Specified by:
sslTruststore
in interfaceSecureEnvironment
- Returns:
- the keystore to use when initializing the factory/factories.
-
sslTruststorePassword
public String sslTruststorePassword()
Description copied from interface:SecureEnvironment
The password which is used to protect the TrustManager keystore. Only needed ifSecureEnvironment.sslTruststoreFile()
is used.- Specified by:
sslTruststorePassword
in interfaceSecureEnvironment
- Returns:
- the keystore password.
-
sslHostnameVerificationEnabled
public boolean sslHostnameVerificationEnabled()
Description copied from interface:SecureEnvironment
If set to true, hostname verification is enabled.- Specified by:
sslHostnameVerificationEnabled
in interfaceSecureEnvironment
- Returns:
- true if enabled.
-
bootstrapHttpEnabled
public boolean bootstrapHttpEnabled()
Description copied from interface:CoreEnvironment
If bootstrapping through HTTP is enabled.- Specified by:
bootstrapHttpEnabled
in interfaceCoreEnvironment
- Returns:
- true if enabled.
-
bootstrapCarrierEnabled
public boolean bootstrapCarrierEnabled()
Description copied from interface:CoreEnvironment
If bootstrapping through the advanced carrier publication is enabled.- Specified by:
bootstrapCarrierEnabled
in interfaceCoreEnvironment
- Returns:
- true if enabled.
-
bootstrapHttpDirectPort
public int bootstrapHttpDirectPort()
Description copied from interface:CoreEnvironment
The port to use when bootstrapping through HTTP without SSL.- Specified by:
bootstrapHttpDirectPort
in interfaceCoreEnvironment
- Returns:
- the direct http port.
-
bootstrapHttpSslPort
public int bootstrapHttpSslPort()
Description copied from interface:CoreEnvironment
The port to use when bootstrapping through HTTP with SSL.- Specified by:
bootstrapHttpSslPort
in interfaceCoreEnvironment
- Returns:
- the https port.
-
bootstrapCarrierDirectPort
public int bootstrapCarrierDirectPort()
Description copied from interface:CoreEnvironment
The port to use when bootstrapping through carrier publication without SSL.- Specified by:
bootstrapCarrierDirectPort
in interfaceCoreEnvironment
- Returns:
- the direct carrier publication port.
-
bootstrapCarrierSslPort
public int bootstrapCarrierSslPort()
Description copied from interface:CoreEnvironment
The port to use when bootstrapping through carrier publication with SSL.- Specified by:
bootstrapCarrierSslPort
in interfaceCoreEnvironment
- Returns:
- the ssl carrier publication port.
-
ioPoolSize
public int ioPoolSize()
Description copied from interface:CoreEnvironment
Returns the configured IO pool size.- Specified by:
ioPoolSize
in interfaceCoreEnvironment
- Returns:
- the pool size (number of threads to use).
-
computationPoolSize
public int computationPoolSize()
Description copied from interface:CoreEnvironment
Returns the pool size (number of threads) for all computation tasks.- Specified by:
computationPoolSize
in interfaceCoreEnvironment
- Returns:
- the pool size (number of threads to use).
-
requestBufferSize
public int requestBufferSize()
Description copied from interface:CoreEnvironment
Returns the size of the request ringbuffer.- Specified by:
requestBufferSize
in interfaceCoreEnvironment
- Returns:
- the size of the ringbuffer.
-
responseBufferSize
public int responseBufferSize()
Description copied from interface:CoreEnvironment
Returns the size of the response ringbuffer.- Specified by:
responseBufferSize
in interfaceCoreEnvironment
- Returns:
- the size of the ringbuffer.
-
kvEndpoints
public int kvEndpoints()
Description copied from interface:CoreEnvironment
The number of key/value service endpoints.- Specified by:
kvEndpoints
in interfaceCoreEnvironment
- Returns:
- amount of endpoints per service.
-
viewEndpoints
public int viewEndpoints()
Description copied from interface:CoreEnvironment
The number of view service endpoints.- Specified by:
viewEndpoints
in interfaceCoreEnvironment
- Returns:
- amount of endpoints per service.
-
queryEndpoints
public int queryEndpoints()
Description copied from interface:CoreEnvironment
The number of query service endpoints.- Specified by:
queryEndpoints
in interfaceCoreEnvironment
- Returns:
- amount of endpoints per service.
-
searchEndpoints
public int searchEndpoints()
Description copied from interface:CoreEnvironment
The number of search service endpoints.- Specified by:
searchEndpoints
in interfaceCoreEnvironment
- Returns:
- amount of endpoints per service.
-
coreVersion
public String coreVersion()
Description copied from interface:CoreEnvironment
Returns version information on the core. Version number is in the form MAJOR.MINOR.PATCH, and is the one for the core-io layer.- Specified by:
coreVersion
in interfaceCoreEnvironment
- Returns:
- the version string for the core.
- See Also:
for a more specific build information (relevant for tracking the exact version of the code the core was built from)
-
coreBuild
public String coreBuild()
Description copied from interface:CoreEnvironment
Returns build information on the Couchbase Java SDK core. This has a better granularity thanCoreEnvironment.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...- Specified by:
coreBuild
in interfaceCoreEnvironment
- Returns:
- the build string for the core.
- See Also:
for more generic version information.
-
userAgent
public String userAgent()
Description copied from interface:CoreEnvironment
Library identification string, which can be used as User-Agent header in HTTP requests.- Specified by:
userAgent
in interfaceCoreEnvironment
- Returns:
- identification string
-
packageNameAndVersion
public String packageNameAndVersion()
Description copied from interface:CoreEnvironment
Returns name and the version of the package. This method used to by @{link userAgent()}.- Specified by:
packageNameAndVersion
in interfaceCoreEnvironment
- Returns:
- string containing package name and version
-
observeIntervalDelay
public Delay observeIntervalDelay()
Description copied from interface:CoreEnvironment
- Specified by:
observeIntervalDelay
in interfaceCoreEnvironment
- Returns:
- the observe interval delay.
-
reconnectDelay
public Delay reconnectDelay()
Description copied from interface:CoreEnvironment
Returns theDelay
for node reconnects.- Specified by:
reconnectDelay
in interfaceCoreEnvironment
- Returns:
- the node reconnect delay.
-
retryDelay
public Delay retryDelay()
Description copied from interface:CoreEnvironment
Returns theDelay
for request retries.- Specified by:
retryDelay
in interfaceCoreEnvironment
- Returns:
- the request retry delay.
-
retryStrategy
public RetryStrategy retryStrategy()
Description copied from interface:CoreEnvironment
The retry strategy on how to dispatch requests in the failure case.- Specified by:
retryStrategy
in interfaceCoreEnvironment
- Returns:
- the retry strategy.
-
maxRequestLifetime
public long maxRequestLifetime()
Description copied from interface:CoreEnvironment
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.- Specified by:
maxRequestLifetime
in interfaceCoreEnvironment
- Returns:
- the maximum request lifetime.
-
keepAliveInterval
public long keepAliveInterval()
Description copied from interface:CoreEnvironment
The time in milliseconds after which some service will issue a form of keep-alive request.- Specified by:
keepAliveInterval
in interfaceCoreEnvironment
- Returns:
- the interval of idle time in milliseconds after which a keep-alive is triggered.
-
eventBus
public EventBus eventBus()
Description copied from interface:CoreEnvironment
Returns the event bus where events are broadcasted on and can be published to.- Specified by:
eventBus
in interfaceCoreEnvironment
- Returns:
- the configured event bus.
-
autoreleaseAfter
public long autoreleaseAfter()
Description copied from interface:CoreEnvironment
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.- Specified by:
autoreleaseAfter
in interfaceCoreEnvironment
- Returns:
- the time after which the buffers are released if not subscribed.
-
bufferPoolingEnabled
public boolean bufferPoolingEnabled()
Description copied from interface:CoreEnvironment
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.- Specified by:
bufferPoolingEnabled
in interfaceCoreEnvironment
- Returns:
- true if enabled, false otherwise.
-
tcpNodelayEnabled
public boolean tcpNodelayEnabled()
Description copied from interface:CoreEnvironment
Returns true if TCP_NODELAY is enabled (therefore Nagle'ing is disabled).- Specified by:
tcpNodelayEnabled
in interfaceCoreEnvironment
- Returns:
- true if enabled.
-
mutationTokensEnabled
public boolean mutationTokensEnabled()
Description copied from interface:CoreEnvironment
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).- Specified by:
mutationTokensEnabled
in interfaceCoreEnvironment
- Returns:
- true if enabled on the client side.
-
runtimeMetricsCollector
public MetricsCollector runtimeMetricsCollector()
Description copied from interface:CoreEnvironment
Returns the collector responsible for aggregating and publishing runtime information like gc and memory.- Specified by:
runtimeMetricsCollector
in interfaceCoreEnvironment
- Returns:
- the collector.
-
networkLatencyMetricsCollector
public NetworkLatencyMetricsCollector networkLatencyMetricsCollector()
Description copied from interface:CoreEnvironment
Returns the collector responsible for aggregating and publishing network latency information.- Specified by:
networkLatencyMetricsCollector
in interfaceCoreEnvironment
- Returns:
- the collector.
-
socketConnectTimeout
public int socketConnectTimeout()
Description copied from interface:CoreEnvironment
Returns the amount of time the SDK will wait on the socket connect until an error is raised and handled.- Specified by:
socketConnectTimeout
in interfaceCoreEnvironment
- Returns:
- the socket connect timeout in milliseconds.
-
callbacksOnIoPool
public boolean callbacksOnIoPool()
Description copied from interface:CoreEnvironment
Returns true if theObservable
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.- Specified by:
callbacksOnIoPool
in interfaceCoreEnvironment
- Returns:
- true if callbacks are scheduled on the IO event loops.
-
disconnectTimeout
public long disconnectTimeout()
Description copied from interface:CoreEnvironment
The default timeout for disconnect operations, set toDISCONNECT_TIMEOUT
.- Specified by:
disconnectTimeout
in interfaceCoreEnvironment
- Returns:
- the default disconnect timeout.
-
requestBufferWaitStrategy
public WaitStrategyFactory requestBufferWaitStrategy()
Description copied from interface:CoreEnvironment
Waiting strategy used by requestEventProcessor
s to wait for data fromRingBuffer
- Specified by:
requestBufferWaitStrategy
in interfaceCoreEnvironment
- Returns:
- waiting strategy
-
memcachedHashingStrategy
public MemcachedHashingStrategy memcachedHashingStrategy()
Description copied from interface:ConfigParserEnvironment
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 theLegacyMemcachedHashingStrategy
instead.- Specified by:
memcachedHashingStrategy
in interfaceConfigParserEnvironment
- Returns:
- the memcached hashing strategy.
-
kvIoPool
public EventLoopGroup kvIoPool()
Description copied from interface:CoreEnvironment
If set returns the IO Pool for the KV service, if not returns null.- Specified by:
kvIoPool
in interfaceCoreEnvironment
- Returns:
- the KV IO pool if set, null otherwise.
-
viewIoPool
public EventLoopGroup viewIoPool()
Description copied from interface:CoreEnvironment
If set returns the IO Pool for the View service, if not returns null.- Specified by:
viewIoPool
in interfaceCoreEnvironment
- Returns:
- the view IO pool if set, null otherwise.
-
queryIoPool
public EventLoopGroup queryIoPool()
Description copied from interface:CoreEnvironment
If set returns the IO Pool for the query service, if not returns null.- Specified by:
queryIoPool
in interfaceCoreEnvironment
- Returns:
- the query IO pool if set, null otherwise.
-
searchIoPool
public EventLoopGroup searchIoPool()
Description copied from interface:CoreEnvironment
If set returns the IO Pool for the search service, if not returns null.- Specified by:
searchIoPool
in interfaceCoreEnvironment
- Returns:
- the search IO pool if set, null otherwise.
-
analyticsIoPool
public EventLoopGroup analyticsIoPool()
Description copied from interface:CoreEnvironment
If set returns the IO Pool for the analytics service, if not returns null.- Specified by:
analyticsIoPool
in interfaceCoreEnvironment
- Returns:
- the analytics IO pool if set, null otherwise.
-
instanceCounter
public static int instanceCounter()
-
kvServiceConfig
public KeyValueServiceConfig kvServiceConfig()
Description copied from interface:CoreEnvironment
Returns the current service configuration for the KV service. This configuration contains the number of endpoints per node that are to be established by the client. Note that the KV service config is a little less configurable than the HTTP based services since it has different runtime properties in terms of resource utilization and when establishing connections.- Specified by:
kvServiceConfig
in interfaceCoreEnvironment
- Returns:
- the current config for the kv service.
-
queryServiceConfig
public QueryServiceConfig queryServiceConfig()
Description copied from interface:CoreEnvironment
Returns the current service configuration for the Query service. This configuration contains settings around minimum and maximum number of endpoints (sockets) per node as well as the idle time until an inactive endpoint is closed.- Specified by:
queryServiceConfig
in interfaceCoreEnvironment
- Returns:
- the current config for the query service.
-
viewServiceConfig
public ViewServiceConfig viewServiceConfig()
Description copied from interface:CoreEnvironment
Returns the current service configuration for the View service. This configuration contains settings around minimum and maximum number of endpoints (sockets) per node as well as the idle time until an inactive endpoint is closed.- Specified by:
viewServiceConfig
in interfaceCoreEnvironment
- Returns:
- the current config for the view service.
-
searchServiceConfig
public SearchServiceConfig searchServiceConfig()
Description copied from interface:CoreEnvironment
Returns the current service configuration for the Search service. This configuration contains settings around minimum and maximum number of endpoints (sockets) per node as well as the idle time until an inactive endpoint is closed.- Specified by:
searchServiceConfig
in interfaceCoreEnvironment
- Returns:
- the current config for the search service.
-
analyticsServiceConfig
public AnalyticsServiceConfig analyticsServiceConfig()
Description copied from interface:CoreEnvironment
Returns the current service configuration for the Analytics service. This configuration contains settings around minimum and maximum number of endpoints (sockets) per node as well as the idle time until an inactive endpoint is closed.- Specified by:
analyticsServiceConfig
in interfaceCoreEnvironment
- Returns:
- the current config for the analytics service.
-
configPollInterval
@Committed @Public public long configPollInterval()
Description copied from interface:CoreEnvironment
Returns the proactive polling interval for cluster configurations.- Specified by:
configPollInterval
in interfaceCoreEnvironment
- Returns:
- the polling interval in milliseconds.
-
configPollFloorInterval
@Committed @Public public long configPollFloorInterval()
Description copied from interface:CoreEnvironment
Returns the minimum polling interval allowed.- Specified by:
configPollFloorInterval
in interfaceCoreEnvironment
- Returns:
- the minimum polling interval.
-
certAuthEnabled
public boolean certAuthEnabled()
Description copied from interface:CoreEnvironment
True if X.509 client certificate authentication is enabled.- Specified by:
certAuthEnabled
in interfaceCoreEnvironment
-
continuousKeepAliveEnabled
public boolean continuousKeepAliveEnabled()
Description copied from interface:CoreEnvironment
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.- Specified by:
continuousKeepAliveEnabled
in interfaceCoreEnvironment
- Returns:
- true if enabled, false otherwise.
-
keepAliveErrorThreshold
public long keepAliveErrorThreshold()
Description copied from interface:CoreEnvironment
Specifies the number of times a KeepAlive message on a socket can fail before the connection is recycled.- Specified by:
keepAliveErrorThreshold
in interfaceCoreEnvironment
- Returns:
- the number of keepalive errors allowed to happen before the socket is reopened.
-
keepAliveTimeout
public long keepAliveTimeout()
Description copied from interface:CoreEnvironment
Specifies the timeout of a keepalive operation on the socket in milliseconds.- Specified by:
keepAliveTimeout
in interfaceCoreEnvironment
- Returns:
-
couchbaseCoreSendHook
public CouchbaseCoreSendHook couchbaseCoreSendHook()
Description copied from interface:CoreEnvironment
Returns theCouchbaseCoreSendHook
if set, null otherwise.- Specified by:
couchbaseCoreSendHook
in interfaceCoreEnvironment
-
forceSaslPlain
public boolean forceSaslPlain()
Description copied from interface:CoreEnvironment
Forces the KeyValue SASL Authentication method to PLAIN if set to true, specifically allowing LDAP-based users to authenticate.- Specified by:
forceSaslPlain
in interfaceCoreEnvironment
- Returns:
- true if plain should be forced, false otherwise (default).
-
operationTracingEnabled
public boolean operationTracingEnabled()
Description copied from interface:CoreEnvironment
True if tracing is enabled on the environment.- Specified by:
operationTracingEnabled
in interfaceCoreEnvironment
-
operationTracingServerDurationEnabled
public boolean operationTracingServerDurationEnabled()
Description copied from interface:CoreEnvironment
True if additional server duration tracing is enabled.- Specified by:
operationTracingServerDurationEnabled
in interfaceCoreEnvironment
-
tracer
public io.opentracing.Tracer tracer()
Description copied from interface:CoreEnvironment
If tracing is enabled, contains the current tracer that should be used.- Specified by:
tracer
in interfaceCoreEnvironment
- Returns:
- the tracer to be used.
-
compressionMinSize
public int compressionMinSize()
Description copied from interface:CoreEnvironment
Returns the minimum size of a document to be considered for compression in the first place.- Specified by:
compressionMinSize
in interfaceCoreEnvironment
- Returns:
- the minimum size to be considered for compression, in bytes.
-
compressionMinRatio
public double compressionMinRatio()
Description copied from interface:CoreEnvironment
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.- Specified by:
compressionMinRatio
in interfaceCoreEnvironment
- Returns:
- the minimum compression ratio for compression
-
compressionEnabled
public boolean compressionEnabled()
Description copied from interface:CoreEnvironment
If true, compression is enabled and will be used if the min size and other thresholds match as well. If false, it won't even be negotiated with the server.- Specified by:
compressionEnabled
in interfaceCoreEnvironment
- Returns:
- true if enabled, false otherwise.
-
orphanResponseReportingEnabled
public boolean orphanResponseReportingEnabled()
Description copied from interface:CoreEnvironment
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.- Specified by:
orphanResponseReportingEnabled
in interfaceCoreEnvironment
- Returns:
- true if enabled.
-
orphanResponseReporter
public OrphanResponseReporter orphanResponseReporter()
Description copied from interface:CoreEnvironment
Returns the current orphan response reporter implementation.- Specified by:
orphanResponseReporter
in interfaceCoreEnvironment
-
networkResolution
public NetworkResolution networkResolution()
Description copied from interface:CoreEnvironment
Allows to configure the network resolution, default being automatic.- Specified by:
networkResolution
in interfaceCoreEnvironment
-
maxAllowedInstances
public static int maxAllowedInstances()
Returns the number of maximal allowed instances before warning log will be emitted.
-
maxAllowedInstances
public static void maxAllowedInstances(int max)
Allows to set the maximum allowed instances to higher than 1 to silence warning logs in environments where it can be disregarded.- Parameters:
max
- the number of envs to allow.
-
dumpParameters
protected StringBuilder dumpParameters(StringBuilder sb)
Dumps the environment parameters known to this implementation into aStringBuilder
, which is returned for method chaining.- Parameters:
sb
- the StringBuilder in which to dump parameters.- Returns:
- the same StringBuilder for method chaining.
-
-