Class DefaultCoreEnvironment

    • Field Detail

      • 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
      • IO_POOL_SIZE

        public static final int IO_POOL_SIZE
      • COMPUTATION_POOL_SIZE

        public static final int COMPUTATION_POOL_SIZE
      • 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
      • AUTORELEASE_AFTER

        public static final long AUTORELEASE_AFTER
      • BUFFER_POOLING_ENABLED

        public static final boolean BUFFER_POOLING_ENABLED
        See Also:
        Constant Field Values
      • MUTATION_TOKENS_ENABLED

        public static final boolean MUTATION_TOKENS_ENABLED
        See Also:
        Constant Field Values
      • DISCONNECT_TIMEOUT

        public static final long DISCONNECT_TIMEOUT
      • CONFIG_POLL_FLOOR_INTERVAL

        public static final long CONFIG_POLL_FLOOR_INTERVAL
        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_RATIO

        public static final double MIN_COMPRESSION_RATIO
        See Also:
        Constant Field Values
      • ORPHAN_REPORTING_ENABLED

        public static final boolean ORPHAN_REPORTING_ENABLED
        See Also:
        Constant Field Values
      • 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
    • Method Detail

      • 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 interface CoreEnvironment
        Returns:
        the default IO pool, shared across resources.
      • shutdown

        public boolean shutdown()
        Description copied from interface: CoreEnvironment
        Shutdown the CoreEnvironment with the default timeout. Note: If this Environment has been created by the user, it is very important to properly close it, but only after all the related cluster and bucket resources need to be closed! Once an environment is shut down, all its contained resources cannot be used any longer! This method has been converted (after a deprecation phase) from an async method into a synchronous one. The async version can still be found at CoreEnvironment.shutdownAsync().
        Specified by:
        shutdown in interface CoreEnvironment
        Returns:
        returning a boolean, indicating the success of the shutdown.
      • shutdown

        public boolean shutdown​(long timeout,
                                TimeUnit timeUnit)
        Description copied from interface: CoreEnvironment
        Shutdown the CoreEnvironment with a custom timeout. Note: If this Environment has been created by the user, it is very important to properly close it, but only after all the related cluster and bucket resources need to be closed! Once an environment is shut down, all its contained resources cannot be used any longer! This method has been converted (after a deprecation phase) from an async method into a synchronous one. The async version can still be found at CoreEnvironment.shutdownAsync().
        Specified by:
        shutdown in interface CoreEnvironment
        Returns:
        returning a boolean, indicating the success of the shutdown.
      • shutdownAsync

        public rx.Observable<Boolean> shutdownAsync()
        Description copied from interface: CoreEnvironment
        Shutdown the CoreEnvironment in an asynchronous fashion. Note: If this Environment has been created by the user, it is very important to properly close it, but only after all the related cluster and bucket resources need to be closed! Once an environment is shut down, all its contained resources cannot be used any longer! Since this method is asynchronous and cold, it is important to subscribe to the observable to actually initiate the shutdown process.
        Specified by:
        shutdownAsync in interface CoreEnvironment
        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 interface CoreEnvironment
        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 interface SecureEnvironment
        Returns:
        true if SSL is enabled, false otherwise.
      • bootstrapCarrierEnabled

        public boolean bootstrapCarrierEnabled()
        Description copied from interface: CoreEnvironment
        If bootstrapping through the advanced carrier publication is enabled.
        Specified by:
        bootstrapCarrierEnabled in interface CoreEnvironment
        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 interface CoreEnvironment
        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 interface CoreEnvironment
        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 interface CoreEnvironment
        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 interface CoreEnvironment
        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 interface CoreEnvironment
        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 interface CoreEnvironment
        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 interface CoreEnvironment
        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 interface CoreEnvironment
        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 interface CoreEnvironment
        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 interface CoreEnvironment
        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 interface CoreEnvironment
        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 interface CoreEnvironment
        Returns:
        amount of endpoints per service.
      • 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 interface CoreEnvironment
        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 interface CoreEnvironment
        Returns:
        string containing package name and version
      • 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 interface CoreEnvironment
        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 interface CoreEnvironment
        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 interface CoreEnvironment
        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 interface CoreEnvironment
        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 interface CoreEnvironment
        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 interface CoreEnvironment
        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 interface CoreEnvironment
        Returns:
        true if enabled on the client side.
      • 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 interface CoreEnvironment
        Returns:
        the socket connect timeout in milliseconds.
      • callbacksOnIoPool

        public boolean callbacksOnIoPool()
        Description copied from interface: CoreEnvironment
        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.
        Specified by:
        callbacksOnIoPool in interface CoreEnvironment
        Returns:
        true if callbacks are scheduled on the IO event loops.
      • 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 interface CoreEnvironment
        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 interface CoreEnvironment
        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 interface CoreEnvironment
        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 interface CoreEnvironment
        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 interface CoreEnvironment
        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 interface CoreEnvironment
        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 interface CoreEnvironment
        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 interface CoreEnvironment
        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 interface CoreEnvironment
        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 interface CoreEnvironment
        Returns:
        the current config for the analytics service.
      • certAuthEnabled

        public boolean certAuthEnabled()
        Description copied from interface: CoreEnvironment
        True if X.509 client certificate authentication is enabled.
        Specified by:
        certAuthEnabled in interface CoreEnvironment
      • 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 interface CoreEnvironment
        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 interface CoreEnvironment
        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 interface CoreEnvironment
        Returns:
      • 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 interface CoreEnvironment
        Returns:
        true if plain should be forced, false otherwise (default).
      • 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 interface CoreEnvironment
        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 interface CoreEnvironment
        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 interface CoreEnvironment
        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 interface CoreEnvironment
        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 interface CoreEnvironment
        Returns:
        true if enabled.
      • 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 a StringBuilder, which is returned for method chaining.
        Parameters:
        sb - the StringBuilder in which to dump parameters.
        Returns:
        the same StringBuilder for method chaining.