public class DefaultCoreEnvironment extends Object implements CoreEnvironment
| Modifier and Type | Class and Description |
|---|---|
static class |
DefaultCoreEnvironment.Builder |
| Modifier | Constructor and Description |
|---|---|
protected |
DefaultCoreEnvironment(DefaultCoreEnvironment.Builder builder) |
| Modifier and Type | Method and Description |
|---|---|
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. |
int |
computationPoolSize()
Returns the pool size (number of threads) for all computation tasks.
|
long |
configPollInterval()
Returns the proactive polling interval for cluster configurations.
|
String |
coreBuild()
Returns build information on the Couchbase Java SDK core.
|
String |
coreVersion()
Returns version information on the core.
|
static DefaultCoreEnvironment |
create() |
double |
dcpConnectionBufferAckThreshold()
When a DCP connection read bytes reaches this percentage of the
CoreEnvironment.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
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.
|
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 |
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.
|
EventLoopGroup |
kvIoPool()
If set returns the IO Pool for the KV service, if not returns null.
|
KeyValueServiceConfig |
kvServiceConfig()
Returns the current
KeyValueService configuration. |
protected static long |
longPropertyOr(String path,
long def) |
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.
|
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
EventProcessors 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 |
sslEnabled()
Identifies if SSL should be 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.
|
protected String |
stringPropertyOr(String path,
String def) |
boolean |
tcpNodelayEnabled()
Returns true if TCP_NODELAY is enabled (therefore Nagle’ing is disabled).
|
String |
toString() |
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. |
public static final boolean DCP_ENABLED
public static final boolean SSL_ENABLED
public static final String SSL_KEYSTORE_FILE
public static final String SSL_KEYSTORE_PASSWORD
public static final KeyStore SSL_KEYSTORE
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 DCP_CONNECTION_BUFFER_SIZE
public static final double DCP_CONNECTION_BUFFER_ACK_THRESHOLD
public static final String DCP_CONNECTION_NAME
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 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 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 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()
CoreEnvironmentReturns the IO pool for the underlying IO framework, used as the default pool if not overridden for the individual services.
ioPool in interface CoreEnvironmentpublic boolean shutdown()
CoreEnvironmentShutdown 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 CoreEnvironment.shutdownAsync().
shutdown in interface CoreEnvironmentpublic boolean shutdown(long timeout,
TimeUnit timeUnit)
CoreEnvironmentShutdown 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 CoreEnvironment.shutdownAsync().
shutdown in interface CoreEnvironmentpublic rx.Observable<Boolean> shutdownAsync()
CoreEnvironmentShutdown 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.
shutdownAsync in interface CoreEnvironmentObservable eventually returning a boolean, indicating the success of the shutdown.public rx.Scheduler scheduler()
CoreEnvironmentReturns the scheduler which should be used for all core actions that need to happen asynchronously.
scheduler in interface CoreEnvironmentpublic boolean sslEnabled()
SecureEnvironmentIdentifies if SSL should be enabled.
sslEnabled in interface SecureEnvironmentpublic boolean dcpEnabled()
CoreEnvironmentIdentifies if DCP should be enabled.
dcpEnabled in interface CoreEnvironmentpublic String sslKeystoreFile()
SecureEnvironmentIdentifies the filepath to the ssl keystore.
sslKeystoreFile in interface SecureEnvironmentpublic String sslKeystorePassword()
SecureEnvironmentThe password which is used to protect the keystore.
sslKeystorePassword in interface SecureEnvironmentpublic KeyStore sslKeystore()
SecureEnvironmentAllows to directly configure a KeyStore.
sslKeystore in interface SecureEnvironmentpublic boolean bootstrapHttpEnabled()
CoreEnvironmentIf bootstrapping through HTTP is enabled.
bootstrapHttpEnabled in interface CoreEnvironmentpublic boolean bootstrapCarrierEnabled()
CoreEnvironmentIf bootstrapping through the advanced carrier publication is enabled.
bootstrapCarrierEnabled in interface CoreEnvironmentpublic int bootstrapHttpDirectPort()
CoreEnvironmentThe port to use when bootstrapping through HTTP without SSL.
bootstrapHttpDirectPort in interface CoreEnvironmentpublic int bootstrapHttpSslPort()
CoreEnvironmentThe port to use when bootstrapping through HTTP with SSL.
bootstrapHttpSslPort in interface CoreEnvironmentpublic int bootstrapCarrierDirectPort()
CoreEnvironmentThe port to use when bootstrapping through carrier publication without SSL.
bootstrapCarrierDirectPort in interface CoreEnvironmentpublic int bootstrapCarrierSslPort()
CoreEnvironmentThe port to use when bootstrapping through carrier publication with SSL.
bootstrapCarrierSslPort in interface CoreEnvironmentpublic int ioPoolSize()
CoreEnvironmentReturns the configured IO pool size.
ioPoolSize in interface CoreEnvironmentpublic int computationPoolSize()
CoreEnvironmentReturns the pool size (number of threads) for all computation tasks.
computationPoolSize in interface CoreEnvironmentpublic int requestBufferSize()
CoreEnvironmentReturns the size of the request ringbuffer.
requestBufferSize in interface CoreEnvironmentpublic int responseBufferSize()
CoreEnvironmentReturns the size of the response ringbuffer.
responseBufferSize in interface CoreEnvironmentpublic int dcpConnectionBufferSize()
CoreEnvironmentSize of the buffer to control speed of DCP producer.
dcpConnectionBufferSize in interface CoreEnvironmentpublic double dcpConnectionBufferAckThreshold()
CoreEnvironmentWhen a DCP connection read bytes reaches this percentage of the CoreEnvironment.dcpConnectionBufferSize(), a DCP Buffer Acknowledge message is sent to the server
dcpConnectionBufferAckThreshold in interface CoreEnvironment@InterfaceStability.Experimental @InterfaceAudience.Public public String dcpConnectionName()
dcpConnectionName in interface CoreEnvironmentpublic int kvEndpoints()
CoreEnvironmentThe number of key/value service endpoints.
kvEndpoints in interface CoreEnvironmentpublic int viewEndpoints()
CoreEnvironmentThe number of view service endpoints.
viewEndpoints in interface CoreEnvironmentpublic int queryEndpoints()
CoreEnvironmentThe number of query service endpoints.
queryEndpoints in interface CoreEnvironmentpublic int searchEndpoints()
CoreEnvironmentThe number of search service endpoints.
searchEndpoints in interface CoreEnvironmentpublic String coreVersion()
CoreEnvironmentReturns version information on the core. Version number is in the form MAJOR.MINOR.PATCH, and is the one for the core-io layer.
coreVersion in interface CoreEnvironmentfor a more specific build information (relevant for tracking
the exact version of the code the core was built from)public String coreBuild()
CoreEnvironmentReturns build information on the Couchbase Java SDK core. This has a better granularity than 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 CoreEnvironmentfor more generic version information.public String userAgent()
CoreEnvironmentLibrary identification string, which can be used as User-Agent header in HTTP requests.
userAgent in interface CoreEnvironmentpublic String packageNameAndVersion()
CoreEnvironmentReturns name and the version of the package. This method used to by @{link userAgent()}.
packageNameAndVersion in interface CoreEnvironmentpublic Delay observeIntervalDelay()
CoreEnvironmentobserveIntervalDelay in interface CoreEnvironmentpublic Delay reconnectDelay()
CoreEnvironmentReturns the Delay for node reconnects.
reconnectDelay in interface CoreEnvironmentpublic Delay retryDelay()
CoreEnvironmentReturns the Delay for request retries.
retryDelay in interface CoreEnvironmentpublic RetryStrategy retryStrategy()
CoreEnvironmentThe retry strategy on how to dispatch requests in the failure case.
retryStrategy in interface CoreEnvironmentpublic long maxRequestLifetime()
CoreEnvironmentReturns 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.
maxRequestLifetime in interface CoreEnvironmentpublic long keepAliveInterval()
CoreEnvironmentThe time in milliseconds after which some service will issue a form of keep-alive request.
keepAliveInterval in interface CoreEnvironmentpublic EventBus eventBus()
CoreEnvironmentReturns the event bus where events are broadcasted on and can be published to.
eventBus in interface CoreEnvironmentpublic long autoreleaseAfter()
CoreEnvironmentThe 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.
autoreleaseAfter in interface CoreEnvironmentpublic boolean bufferPoolingEnabled()
CoreEnvironmentReturns 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.
bufferPoolingEnabled in interface CoreEnvironmentpublic boolean tcpNodelayEnabled()
CoreEnvironmentReturns true if TCP_NODELAY is enabled (therefore Nagle’ing is disabled).
tcpNodelayEnabled in interface CoreEnvironmentpublic boolean mutationTokensEnabled()
CoreEnvironmentReturns 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).
mutationTokensEnabled in interface CoreEnvironmentpublic MetricsCollector runtimeMetricsCollector()
CoreEnvironmentReturns the collector responsible for aggregating and publishing runtime information like gc and memory.
runtimeMetricsCollector in interface CoreEnvironmentpublic NetworkLatencyMetricsCollector networkLatencyMetricsCollector()
CoreEnvironmentReturns the collector responsible for aggregating and publishing network latency information.
networkLatencyMetricsCollector in interface CoreEnvironmentpublic int socketConnectTimeout()
CoreEnvironmentReturns the amount of time the SDK will wait on the socket connect until an error is raised and handled.
socketConnectTimeout in interface CoreEnvironmentpublic boolean callbacksOnIoPool()
CoreEnvironmentReturns 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.
callbacksOnIoPool in interface CoreEnvironmentpublic long disconnectTimeout()
CoreEnvironmentThe default timeout for disconnect operations, set to DISCONNECT_TIMEOUT.
disconnectTimeout in interface CoreEnvironmentpublic WaitStrategyFactory requestBufferWaitStrategy()
CoreEnvironmentWaiting strategy used by request EventProcessors to wait for data from RingBuffer
requestBufferWaitStrategy in interface CoreEnvironmentpublic MemcachedHashingStrategy memcachedHashingStrategy()
ConfigParserEnvironmentAllows 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.
memcachedHashingStrategy in interface ConfigParserEnvironmentpublic EventLoopGroup kvIoPool()
CoreEnvironmentIf set returns the IO Pool for the KV service, if not returns null.
kvIoPool in interface CoreEnvironmentpublic EventLoopGroup viewIoPool()
CoreEnvironmentIf set returns the IO Pool for the View service, if not returns null.
viewIoPool in interface CoreEnvironmentpublic EventLoopGroup queryIoPool()
CoreEnvironmentIf set returns the IO Pool for the query service, if not returns null.
queryIoPool in interface CoreEnvironmentpublic EventLoopGroup searchIoPool()
CoreEnvironmentIf set returns the IO Pool for the search service, if not returns null.
searchIoPool in interface CoreEnvironmentpublic static int instanceCounter()
public KeyValueServiceConfig kvServiceConfig()
CoreEnvironmentReturns the current KeyValueService configuration.
kvServiceConfig in interface CoreEnvironmentpublic QueryServiceConfig queryServiceConfig()
CoreEnvironmentReturns the current QueryService configuration.
queryServiceConfig in interface CoreEnvironmentpublic ViewServiceConfig viewServiceConfig()
CoreEnvironmentReturns the current ViewService configuration.
viewServiceConfig in interface CoreEnvironmentpublic SearchServiceConfig searchServiceConfig()
CoreEnvironmentReturns the current SearchService configuration.
searchServiceConfig in interface CoreEnvironment@InterfaceStability.Experimental @InterfaceAudience.Public public long configPollInterval()
CoreEnvironmentReturns the proactive polling interval for cluster configurations.
configPollInterval in interface CoreEnvironmentprotected StringBuilder dumpParameters(StringBuilder sb)
Dumps the environment parameters known to this implementation into a StringBuilder, which is returned for method chaining.
sb - the StringBuilder in which to dump parameters.Copyright © 2017 Couchbase, Inc.. All rights reserved.