Package com.couchbase.client.core.env
Class CoreEnvironment
- java.lang.Object
-
- com.couchbase.client.core.env.CoreEnvironment
-
public class CoreEnvironment extends Object
TheCoreEnvironment
is an extendable, configurable and stateful config designed to be passed into a core instance.- Since:
- 1.0.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CoreEnvironment.Builder<SELF extends CoreEnvironment.Builder<SELF>>
-
Field Summary
Fields Modifier and Type Field Description static RetryStrategy
DEFAULT_RETRY_STRATEGY
The default retry strategy used for all ops if not overridden.static Set<SeedNode>
DEFAULT_SEED_NODES
Holds the default seed nodes (going to localhost) with default ports.
-
Constructor Summary
Constructors Modifier Constructor Description protected
CoreEnvironment(CoreEnvironment.Builder builder)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Package
agentPackage()
Make sure to override this in client implementations so it picks up the right manifest.static CoreEnvironment.Builder
builder(Credentials credentials)
static CoreEnvironment.Builder
builder(String connectionString, Credentials credentials)
static CoreEnvironment.Builder
builder(String username, String password)
static CoreEnvironment.Builder
builder(String connectionString, String username, String password)
CompressionConfig
compressionConfig()
static CoreEnvironment
create(Credentials credentials)
static CoreEnvironment
create(String connectionString, Credentials credentials)
static CoreEnvironment
create(String username, String password)
static CoreEnvironment
create(String connectionString, String username, String password)
Credentials
credentials()
Returns theCredentials
attached to this environment.protected String
defaultAgentTitle()
Returns the default user agent name that is used as part of the resulting string.EventBus
eventBus()
The central event bus which manages all kinds of messages flowing throughout the client.IoConfig
ioConfig()
IoEnvironment
ioEnvironment()
Holds the environmental configuration/state that is tied to the IO layer.LoggerConfig
loggerConfig()
boolean
operationTracingEnabled()
RetryStrategy
retryStrategy()
Scheduler
scheduler()
SecurityConfig
securityConfig()
Set<SeedNode>
seedNodes()
ServiceConfig
serviceConfig()
void
shutdown()
void
shutdown(Duration timeout)
Shuts down this Environment.TimeoutConfig
timeoutConfig()
Timer
timer()
Holds the timer which is used to schedule tasks and trigger their callback, for example to time out requests.io.opentracing.Tracer
tracer()
UserAgent
userAgent()
User agent used to identify this client against the server.
-
-
-
Field Detail
-
DEFAULT_SEED_NODES
public static final Set<SeedNode> DEFAULT_SEED_NODES
Holds the default seed nodes (going to localhost) with default ports.
-
DEFAULT_RETRY_STRATEGY
public static final RetryStrategy DEFAULT_RETRY_STRATEGY
The default retry strategy used for all ops if not overridden.
-
-
Constructor Detail
-
CoreEnvironment
protected CoreEnvironment(CoreEnvironment.Builder builder)
-
-
Method Detail
-
create
public static CoreEnvironment create(String username, String password)
-
create
public static CoreEnvironment create(Credentials credentials)
-
create
public static CoreEnvironment create(String connectionString, String username, String password)
-
create
public static CoreEnvironment create(String connectionString, Credentials credentials)
-
builder
public static CoreEnvironment.Builder builder(String username, String password)
-
builder
public static CoreEnvironment.Builder builder(Credentials credentials)
-
builder
public static CoreEnvironment.Builder builder(String connectionString, String username, String password)
-
builder
public static CoreEnvironment.Builder builder(String connectionString, Credentials credentials)
-
agentPackage
protected Package agentPackage()
Make sure to override this in client implementations so it picks up the right manifest.This method should be overridden by client implementations to make sure their version is included instead.
- Returns:
- the package of the target application to extract properties.
-
defaultAgentTitle
protected String defaultAgentTitle()
Returns the default user agent name that is used as part of the resulting string.
-
credentials
public Credentials credentials()
Returns theCredentials
attached to this environment.
-
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()
-
timeoutConfig
public TimeoutConfig timeoutConfig()
-
securityConfig
public SecurityConfig securityConfig()
-
serviceConfig
public ServiceConfig serviceConfig()
-
compressionConfig
public CompressionConfig compressionConfig()
-
loggerConfig
public LoggerConfig loggerConfig()
-
scheduler
public Scheduler scheduler()
-
tracer
public io.opentracing.Tracer tracer()
-
operationTracingEnabled
public boolean operationTracingEnabled()
-
timer
public Timer timer()
Holds the timer which is used to schedule tasks and trigger their callback, for example to time out requests.- Returns:
- the timer used.
-
retryStrategy
public RetryStrategy retryStrategy()
-
shutdown
public void shutdown(Duration timeout)
Shuts down this Environment.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()
-
-