Class CoreEnvironment

java.lang.Object
com.couchbase.client.core.env.CoreEnvironment
All Implemented Interfaces:
AutoCloseable

public class CoreEnvironment extends Object implements AutoCloseable
The Environment is the main place in the SDK where configuration and state lives (i.e. I/O pools).

Note that unless you are using the core directly, you want to consider the child implementations for each language binding (i.e. the ClusterEnvironment for the java client).

  • Field Details

    • DEFAULT_MAX_NUM_REQUESTS_IN_RETRY

      public static final long DEFAULT_MAX_NUM_REQUESTS_IN_RETRY
      Default maximum requests being queued in retry before performing backpressure cancellations.
      See Also:
  • Constructor Details

  • Method Details

    • create

      public static CoreEnvironment create()
    • builder

      public static CoreEnvironment.Builder builder()
    • defaultAgentTitle

      protected String defaultAgentTitle()
      Returns the default user agent name that is used as part of the resulting string.
    • clientHash

      public Optional<String> clientHash()
      If present, returns the git hash for the client at build time.
    • coreHash

      public Optional<String> coreHash()
      If present, returns the git hash for the core at build time.
    • clientVersion

      public Optional<String> clientVersion()
      If present, returns the client version at build time.
    • coreVersion

      public Optional<String> coreVersion()
      If present, returns the core version at build time.
    • userAgent

      public UserAgent userAgent()
      User agent used to identify this client against the server.
    • eventBus

      public EventBus eventBus()
      The central event bus which manages all kinds of messages flowing throughout the client.
      Returns:
      the event bus currently in use.
    • ioEnvironment

      public IoEnvironment ioEnvironment()
      Holds the environmental configuration/state that is tied to the IO layer.
    • ioConfig

      public IoConfig ioConfig()
      Returns the current configuration for all I/O-related settings.
    • timeoutConfig

      public TimeoutConfig timeoutConfig()
      Returns the configuration for all default timeouts.
    • securityConfig

      public SecurityConfig securityConfig()
      Returns the current security configuration (TLS etc.).
    • compressionConfig

      public CompressionConfig compressionConfig()
      Returns the current compression configuration.
    • loggerConfig

      public LoggerConfig loggerConfig()
      Returns the current logger configuration.
    • scheduler

      public Scheduler scheduler()
      Returns the scheduler used to schedule reactive, async tasks across the SDK.
    • executor

      @Internal public Executor executor()
      Returns the executor used to schedule non-reactive async tasks across the SDK.
    • requestTracer

      @Volatile public RequestTracer requestTracer()
      Returns the request tracer for response time observability.

      Note that this right now is unsupported, volatile API and subject to change!

    • meter

      @Volatile public Meter meter()
    • requestCallbacks

      @Internal public List<RequestCallback> requestCallbacks()
    • timer

      public Timer timer()
      Returns the timer used to schedule timeouts and retries amongst other tasks.
    • retryStrategy

      public RetryStrategy retryStrategy()
      Returns the retry strategy on this environment.
    • orphanReporter

      public OrphanReporter orphanReporter()
      Returns the orphan reporter on this environment.
    • maxNumRequestsInRetry

      public long maxNumRequestsInRetry()
      Returns the maximum number of requests allowed in retry, before no more ops are allowed and canceled.
    • transactionsConfig

      @Volatile public CoreTransactionsConfig transactionsConfig()
    • transactionsSchedulers

      @Volatile public CoreTransactionsSchedulers transactionsSchedulers()
      The schedulers used for any transactional operations.
    • shutdownAsync

      public CompletableFuture<Void> shutdownAsync()
      Shuts down this Environment with the default disconnect timeout.

      Note that once shutdown, the environment cannot be restarted so it is advised to perform this operation at the very last operation in the SDK shutdown process.

    • shutdownAsync

      public CompletableFuture<Void> shutdownAsync(Duration timeout)
      Shuts down this Environment with a custom timeout.

      Note that once shutdown, the environment cannot be restarted so it is advised to perform this operation at the very last operation in the SDK shutdown process.

      Parameters:
      timeout - the timeout to wait maximum.
    • shutdownReactive

      public Mono<Void> shutdownReactive()
      Shuts down this Environment with the default disconnect timeout.

      Note that once shutdown, the environment cannot be restarted so it is advised to perform this operation at the very last operation in the SDK shutdown process.

    • shutdownReactive

      public Mono<Void> shutdownReactive(Duration timeout)
      Shuts down this Environment with a custom timeout.

      Note that once shutdown, the environment cannot be restarted so it is advised to perform this operation at the very last operation in the SDK shutdown process.

      Parameters:
      timeout - the timeout to wait maximum.
    • shutdown

      public void shutdown(Duration timeout)
      Shuts down this Environment with a custom timeout.

      Note that once shutdown, the environment cannot be restarted so it is advised to perform this operation at the very last operation in the SDK shutdown process.

      Parameters:
      timeout - the timeout to wait maximum.
    • shutdown

      public void shutdown()
      Shuts down this Environment with the default disconnect timeout.

      Note that once shutdown, the environment cannot be restarted so it is advised to perform this operation at the very last operation in the SDK shutdown process.

    • exportAsString

      public String exportAsString(Context.ExportFormat format)
      Export this environment into the specified format.
      Parameters:
      format - the format to export into.
      Returns:
      the exported format as a string representation.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable