public class DefaultCoreEnvironment extends Object implements CoreEnvironment
Modifier and Type | Class and Description |
---|---|
static class |
DefaultCoreEnvironment.Builder<SELF extends DefaultCoreEnvironment.Builder<SELF>> |
Modifier | Constructor and Description |
---|---|
protected |
DefaultCoreEnvironment(DefaultCoreEnvironment.Builder builder) |
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 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 the
Observable 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 the
CouchbaseCoreSendHook if set, null otherwise. |
static DefaultCoreEnvironment |
create() |
long |
disconnectTimeout()
The default timeout for disconnect operations, set to
DISCONNECT_TIMEOUT . |
protected static double |
doublePropertyOr(String path,
double def) |
protected StringBuilder |
dumpParameters(StringBuilder sb)
Dumps the environment parameters known to this implementation into a
StringBuilder ,
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 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 service configuration for the Search service.
|
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 |
sslEnabled()
Identifies if SSL should be enabled.
|
boolean |
sslHostnameVerificationEnabled()
If set to true, hostname verification is enabled.
|
KeyStore |
sslKeystore()
Allows to directly configure a
KeyStore . |
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 a
KeyStore . |
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.
|
public static final boolean SSL_ENABLED
public static final boolean SSL_HOSTNAME_VERIFICATION_ENABLED
public static final String SSL_KEYSTORE_FILE
public static final String SSL_TRUSTSTORE_FILE
public static final String SSL_KEYSTORE_PASSWORD
public static final String SSL_TRUSTSTORE_PASSWORD
public static final KeyStore SSL_KEYSTORE
public static final KeyStore SSL_TRUSTSTORE
public static final boolean BOOTSTRAP_HTTP_ENABLED
public static final boolean BOOTSTRAP_CARRIER_ENABLED
public static final int BOOTSTRAP_HTTP_DIRECT_PORT
public static final int BOOTSTRAP_HTTP_SSL_PORT
public static final int BOOTSTRAP_CARRIER_DIRECT_PORT
public static final int BOOTSTRAP_CARRIER_SSL_PORT
public static final int REQUEST_BUFFER_SIZE
public static final int RESPONSE_BUFFER_SIZE
public static final int IO_POOL_SIZE
public static final int COMPUTATION_POOL_SIZE
public static final int KEYVALUE_ENDPOINTS
public static final int VIEW_ENDPOINTS
public static final int QUERY_ENDPOINTS
public static final int SEARCH_ENDPOINTS
public static final int ANALYTICS_ENDPOINTS
public static final Delay OBSERVE_INTERVAL_DELAY
public static final Delay RECONNECT_DELAY
public static final Delay RETRY_DELAY
public static final RetryStrategy RETRY_STRATEGY
public static final long MAX_REQUEST_LIFETIME
public static final long KEEPALIVEINTERVAL
public static final boolean CONTINUOUS_KEEPALIVE_ENABLED
public static final long KEEPALIVE_ERROR_THRESHOLD
public static final long KEEPALIVE_TIMEOUT
public static final long AUTORELEASE_AFTER
public static final boolean BUFFER_POOLING_ENABLED
public static final boolean TCP_NODELAY_ENALED
public static final boolean MUTATION_TOKENS_ENABLED
public static final int SOCKET_CONNECT_TIMEOUT
public static final boolean CALLBACKS_ON_IO_POOL
public static final long DISCONNECT_TIMEOUT
public static final MemcachedHashingStrategy MEMCACHED_HASHING_STRATEGY
public static final long CONFIG_POLL_INTERVAL
public static final long CONFIG_POLL_FLOOR_INTERVAL
public static final boolean CERT_AUTH_ENABLED
public static final boolean FORCE_SASL_PLAIN
public static final boolean OPERATION_TRACING_ENABLED
public static final boolean OPERATION_TRACING_SERVER_DUR_ENABLED
public static final int MIN_COMPRESSION_SIZE
public static final double MIN_COMPRESSION_RATIO
public static final boolean COMPRESSION_ENABLED
public static final boolean ORPHAN_REPORTING_ENABLED
public static final NetworkResolution NETWORK_RESOLUTION
public static String CORE_VERSION
public static String CORE_GIT_VERSION
public static String PACKAGE_NAME_AND_VERSION
public static String USER_AGENT
protected DefaultCoreEnvironment(DefaultCoreEnvironment.Builder builder)
public static DefaultCoreEnvironment create()
public static DefaultCoreEnvironment.Builder builder()
protected boolean booleanPropertyOr(String path, boolean def)
protected int intPropertyOr(String path, int def)
protected static long longPropertyOr(String path, long def)
protected static double doublePropertyOr(String path, double def)
public EventLoopGroup ioPool()
CoreEnvironment
ioPool
in interface CoreEnvironment
public boolean shutdown()
CoreEnvironment
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 CoreEnvironment.shutdownAsync()
.shutdown
in interface CoreEnvironment
public boolean shutdown(long timeout, TimeUnit timeUnit)
CoreEnvironment
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 CoreEnvironment.shutdownAsync()
.shutdown
in interface CoreEnvironment
public rx.Observable<Boolean> shutdownAsync()
CoreEnvironment
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.shutdownAsync
in interface CoreEnvironment
Observable
eventually returning a boolean, indicating the success of the shutdown.public rx.Scheduler scheduler()
CoreEnvironment
scheduler
in interface CoreEnvironment
public boolean sslEnabled()
SecureEnvironment
sslEnabled
in interface SecureEnvironment
public String sslKeystoreFile()
SecureEnvironment
SecureEnvironment.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 use SecureEnvironment.sslTruststoreFile()
alone.sslKeystoreFile
in interface SecureEnvironment
public String sslKeystorePassword()
SecureEnvironment
SecureEnvironment.sslKeystoreFile()
is used.sslKeystorePassword
in interface SecureEnvironment
public KeyStore sslKeystore()
SecureEnvironment
KeyStore
.
If this method is used without also specifying
SecureEnvironment.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 use SecureEnvironment.sslTruststore()
alone.sslKeystore
in interface SecureEnvironment
public String sslTruststoreFile()
SecureEnvironment
SecureEnvironment.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 the SecureEnvironment.sslKeystoreFile()
if you do not need
X.509 client auth and just need server side certificate checking.sslTruststoreFile
in interface SecureEnvironment
public KeyStore sslTruststore()
SecureEnvironment
KeyStore
.
If this method is used without also specifying
SecureEnvironment.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 the SecureEnvironment.sslKeystore()
if you do not need
X.509 client auth and just need server side certificate checking.sslTruststore
in interface SecureEnvironment
public String sslTruststorePassword()
SecureEnvironment
SecureEnvironment.sslTruststoreFile()
is used.sslTruststorePassword
in interface SecureEnvironment
public boolean sslHostnameVerificationEnabled()
SecureEnvironment
sslHostnameVerificationEnabled
in interface SecureEnvironment
public boolean bootstrapHttpEnabled()
CoreEnvironment
bootstrapHttpEnabled
in interface CoreEnvironment
public boolean bootstrapCarrierEnabled()
CoreEnvironment
bootstrapCarrierEnabled
in interface CoreEnvironment
public int bootstrapHttpDirectPort()
CoreEnvironment
bootstrapHttpDirectPort
in interface CoreEnvironment
public int bootstrapHttpSslPort()
CoreEnvironment
bootstrapHttpSslPort
in interface CoreEnvironment
public int bootstrapCarrierDirectPort()
CoreEnvironment
bootstrapCarrierDirectPort
in interface CoreEnvironment
public int bootstrapCarrierSslPort()
CoreEnvironment
bootstrapCarrierSslPort
in interface CoreEnvironment
public int ioPoolSize()
CoreEnvironment
ioPoolSize
in interface CoreEnvironment
public int computationPoolSize()
CoreEnvironment
computationPoolSize
in interface CoreEnvironment
public int requestBufferSize()
CoreEnvironment
requestBufferSize
in interface CoreEnvironment
public int responseBufferSize()
CoreEnvironment
responseBufferSize
in interface CoreEnvironment
public int kvEndpoints()
CoreEnvironment
kvEndpoints
in interface CoreEnvironment
public int viewEndpoints()
CoreEnvironment
viewEndpoints
in interface CoreEnvironment
public int queryEndpoints()
CoreEnvironment
queryEndpoints
in interface CoreEnvironment
public int searchEndpoints()
CoreEnvironment
searchEndpoints
in interface CoreEnvironment
public String coreVersion()
CoreEnvironment
coreVersion
in interface CoreEnvironment
for a more specific build information (relevant for tracking
the exact version of the code the core was built from)
public String coreBuild()
CoreEnvironment
CoreEnvironment.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...coreBuild
in interface CoreEnvironment
for more generic version information.
public String userAgent()
CoreEnvironment
userAgent
in interface CoreEnvironment
public String packageNameAndVersion()
CoreEnvironment
packageNameAndVersion
in interface CoreEnvironment
public Delay observeIntervalDelay()
CoreEnvironment
observeIntervalDelay
in interface CoreEnvironment
public Delay reconnectDelay()
CoreEnvironment
Delay
for node reconnects.reconnectDelay
in interface CoreEnvironment
public Delay retryDelay()
CoreEnvironment
Delay
for request retries.retryDelay
in interface CoreEnvironment
public RetryStrategy retryStrategy()
CoreEnvironment
retryStrategy
in interface CoreEnvironment
public long maxRequestLifetime()
CoreEnvironment
maxRequestLifetime
in interface CoreEnvironment
public long keepAliveInterval()
CoreEnvironment
keepAliveInterval
in interface CoreEnvironment
public EventBus eventBus()
CoreEnvironment
eventBus
in interface CoreEnvironment
public long autoreleaseAfter()
CoreEnvironment
autoreleaseAfter
in interface CoreEnvironment
public boolean bufferPoolingEnabled()
CoreEnvironment
bufferPoolingEnabled
in interface CoreEnvironment
public boolean tcpNodelayEnabled()
CoreEnvironment
tcpNodelayEnabled
in interface CoreEnvironment
public boolean mutationTokensEnabled()
CoreEnvironment
mutationTokensEnabled
in interface CoreEnvironment
public MetricsCollector runtimeMetricsCollector()
CoreEnvironment
runtimeMetricsCollector
in interface CoreEnvironment
public NetworkLatencyMetricsCollector networkLatencyMetricsCollector()
CoreEnvironment
networkLatencyMetricsCollector
in interface CoreEnvironment
public int socketConnectTimeout()
CoreEnvironment
socketConnectTimeout
in interface CoreEnvironment
public boolean callbacksOnIoPool()
CoreEnvironment
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.callbacksOnIoPool
in interface CoreEnvironment
public long disconnectTimeout()
CoreEnvironment
DISCONNECT_TIMEOUT
.disconnectTimeout
in interface CoreEnvironment
public WaitStrategyFactory requestBufferWaitStrategy()
CoreEnvironment
EventProcessor
s to wait for data from
RingBuffer
requestBufferWaitStrategy
in interface CoreEnvironment
public MemcachedHashingStrategy memcachedHashingStrategy()
ConfigParserEnvironment
LegacyMemcachedHashingStrategy
instead.memcachedHashingStrategy
in interface ConfigParserEnvironment
public EventLoopGroup kvIoPool()
CoreEnvironment
kvIoPool
in interface CoreEnvironment
public EventLoopGroup viewIoPool()
CoreEnvironment
viewIoPool
in interface CoreEnvironment
public EventLoopGroup queryIoPool()
CoreEnvironment
queryIoPool
in interface CoreEnvironment
public EventLoopGroup searchIoPool()
CoreEnvironment
searchIoPool
in interface CoreEnvironment
public EventLoopGroup analyticsIoPool()
CoreEnvironment
analyticsIoPool
in interface CoreEnvironment
public static int instanceCounter()
public KeyValueServiceConfig kvServiceConfig()
CoreEnvironment
kvServiceConfig
in interface CoreEnvironment
public QueryServiceConfig queryServiceConfig()
CoreEnvironment
queryServiceConfig
in interface CoreEnvironment
public ViewServiceConfig viewServiceConfig()
CoreEnvironment
viewServiceConfig
in interface CoreEnvironment
public SearchServiceConfig searchServiceConfig()
CoreEnvironment
searchServiceConfig
in interface CoreEnvironment
public AnalyticsServiceConfig analyticsServiceConfig()
CoreEnvironment
analyticsServiceConfig
in interface CoreEnvironment
@InterfaceStability.Committed @InterfaceAudience.Public public long configPollInterval()
CoreEnvironment
configPollInterval
in interface CoreEnvironment
@InterfaceStability.Committed @InterfaceAudience.Public public long configPollFloorInterval()
CoreEnvironment
configPollFloorInterval
in interface CoreEnvironment
public boolean certAuthEnabled()
CoreEnvironment
certAuthEnabled
in interface CoreEnvironment
public boolean continuousKeepAliveEnabled()
CoreEnvironment
continuousKeepAliveEnabled
in interface CoreEnvironment
public long keepAliveErrorThreshold()
CoreEnvironment
keepAliveErrorThreshold
in interface CoreEnvironment
public long keepAliveTimeout()
CoreEnvironment
keepAliveTimeout
in interface CoreEnvironment
public CouchbaseCoreSendHook couchbaseCoreSendHook()
CoreEnvironment
CouchbaseCoreSendHook
if set, null otherwise.couchbaseCoreSendHook
in interface CoreEnvironment
public boolean forceSaslPlain()
CoreEnvironment
forceSaslPlain
in interface CoreEnvironment
public boolean operationTracingEnabled()
CoreEnvironment
operationTracingEnabled
in interface CoreEnvironment
public boolean operationTracingServerDurationEnabled()
CoreEnvironment
operationTracingServerDurationEnabled
in interface CoreEnvironment
public io.opentracing.Tracer tracer()
CoreEnvironment
tracer
in interface CoreEnvironment
public int compressionMinSize()
CoreEnvironment
compressionMinSize
in interface CoreEnvironment
public double compressionMinRatio()
CoreEnvironment
compressionMinRatio
in interface CoreEnvironment
public boolean compressionEnabled()
CoreEnvironment
compressionEnabled
in interface CoreEnvironment
public boolean orphanResponseReportingEnabled()
CoreEnvironment
orphanResponseReportingEnabled
in interface CoreEnvironment
public OrphanResponseReporter orphanResponseReporter()
CoreEnvironment
orphanResponseReporter
in interface CoreEnvironment
public NetworkResolution networkResolution()
CoreEnvironment
networkResolution
in interface CoreEnvironment
public static int maxAllowedInstances()
public static void maxAllowedInstances(int max)
max
- the number of envs to allow.protected StringBuilder dumpParameters(StringBuilder sb)
StringBuilder
,
which is returned for method chaining.sb
- the StringBuilder in which to dump parameters.Copyright © 2021 Couchbase, Inc.. All rights reserved.