public static class DefaultCoreEnvironment.Builder extends Object implements CoreEnvironment
Modifier | Constructor and Description |
---|---|
protected |
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.
|
DefaultCoreEnvironment.Builder |
autoreleaseAfter(long autoreleaseAfter)
Sets the time after which any non-consumed buffers will be automatically released.
|
int |
bootstrapCarrierDirectPort()
The port to use when bootstrapping through carrier publication without SSL.
|
DefaultCoreEnvironment.Builder |
bootstrapCarrierDirectPort(int bootstrapCarrierDirectPort)
If carrier publication bootstrap is enabled and not SSL, sets the port to use (default value ).
|
boolean |
bootstrapCarrierEnabled() |
DefaultCoreEnvironment.Builder |
bootstrapCarrierEnabled(boolean bootstrapCarrierEnabled)
Toggles bootstrap via carrier publication (default value ).
|
int |
bootstrapCarrierSslPort()
The port to use when bootstrapping through carrier publication with SSL.
|
DefaultCoreEnvironment.Builder |
bootstrapCarrierSslPort(int bootstrapCarrierSslPort)
If carrier publication bootstrap and SSL are enabled, sets the port to use (default value ).
|
int |
bootstrapHttpDirectPort()
The port to use when bootstrapping through HTTP without SSL.
|
DefaultCoreEnvironment.Builder |
bootstrapHttpDirectPort(int bootstrapHttpDirectPort)
If Http bootstrap is enabled and not SSL, sets the port to use (default value ).
|
boolean |
bootstrapHttpEnabled() |
DefaultCoreEnvironment.Builder |
bootstrapHttpEnabled(boolean bootstrapHttpEnabled)
Toggles bootstrap via Http (default value ).
|
int |
bootstrapHttpSslPort()
The port to use when bootstrapping through HTTP with SSL.
|
DefaultCoreEnvironment.Builder |
bootstrapHttpSslPort(int bootstrapHttpSslPort)
If Http bootstrap and SSL are enabled, sets the port to use (default value ).
|
boolean |
bufferPoolingEnabled()
Returns if buffer pooling is enabled for greater GC efficiency.
|
DefaultCoreEnvironment.Builder |
bufferPoolingEnabled(boolean bufferPoolingEnabled)
Forcefully disable buffer pooling by setting the value to false.
|
DefaultCoreEnvironment |
build() |
int |
computationPoolSize() |
DefaultCoreEnvironment.Builder |
computationPoolSize(int computationPoolSize)
Sets the pool size (number of threads to use) for all non blocking operations in the core and clients (default value is the number of CPUs).
|
boolean |
dcpEnabled()
Identifies if DCP should be enabled.
|
DefaultCoreEnvironment.Builder |
dcpEnabled(boolean dcpEnabled)
Set if DCP should be enabled (only makes sense with server versions >= 3.0.0, default ).
|
EventBus |
eventBus()
Returns the event bus where events are broadcasted on and can be published to.
|
DefaultCoreEnvironment.Builder |
eventBus(EventBus eventBus)
Sets the event bus to an alternative implementation.
|
EventLoopGroup |
ioPool()
Returns the IO pool for the underlying IO framework.
|
DefaultCoreEnvironment.Builder |
ioPool(EventLoopGroup group)
Sets the I/O Pool implementation for the underlying IO framework.
|
int |
ioPoolSize()
Returns the configured IO pool size.
|
DefaultCoreEnvironment.Builder |
ioPoolSize(int ioPoolSize)
Sets the pool size (number of threads to use) for I/O operations (default value is the number of CPUs).
|
long |
keepAliveInterval()
The time in milliseconds after which some service will issue a form of keep-alive request.
|
DefaultCoreEnvironment.Builder |
keepAliveInterval(long keepAliveIntervalMilliseconds)
Sets the time of inactivity, in milliseconds, after which some services will issue a form of keep-alive request to their corresponding server/nodes (default is 30s, values <= 0 deactivate the idle check).
|
int |
kvEndpoints()
The number of key/value service endpoints.
|
DefaultCoreEnvironment.Builder |
kvEndpoints(int kvServiceEndpoints)
Sets the number of Key/Value endpoints to open per nodes in the cluster (default value ).
|
long |
maxRequestLifetime()
Returns the maximum time in milliseconds a request is allowed to life.
|
DefaultCoreEnvironment.Builder |
maxRequestLifetime(long maxRequestLifetime)
Sets the maximum time in milliseconds a request is allowed to live.
|
Delay |
observeIntervalDelay()
|
DefaultCoreEnvironment.Builder |
observeIntervalDelay(Delay observeIntervalDelay)
|
String |
packageNameAndVersion()
Returns name and the version of the package.
|
DefaultCoreEnvironment.Builder |
packageNameAndVersion(String packageNameAndVersion)
Sets the String to be used as identifier for the library namespace and version.
|
boolean |
queryEnabled() |
DefaultCoreEnvironment.Builder |
queryEnabled(boolean queryEnabled)
Toggles the N1QL Query feature (default value ).
|
int |
queryEndpoints()
The number of query service endpoints.
|
DefaultCoreEnvironment.Builder |
queryEndpoints(int queryServiceEndpoints)
Sets the number of Query (N1QL) endpoints to open per node in the cluster (default value ).
|
int |
queryPort() |
DefaultCoreEnvironment.Builder |
queryPort(int queryPort)
Defines the port for N1QL Query (default value ).
|
Delay |
reconnectDelay()
Returns the
Delay for node reconnects. |
DefaultCoreEnvironment.Builder |
reconnectDelay(Delay reconnectDelay)
Sets the
Delay for node reconnects (default value is a delay growing exponentially between 32ms and 4096ms). |
int |
requestBufferSize()
Returns the size of the request ringbuffer.
|
DefaultCoreEnvironment.Builder |
requestBufferSize(int requestBufferSize)
Sets the size of the RingBuffer structure that queues requests (default value ).
|
int |
responseBufferSize()
Returns the size of the response ringbuffer.
|
DefaultCoreEnvironment.Builder |
responseBufferSize(int responseBufferSize)
Sets the size of the RingBuffer structure that queues responses (default value ).
|
Delay |
retryDelay()
Returns the
Delay for request retries. |
DefaultCoreEnvironment.Builder |
retryDelay(Delay retryDelay)
Sets the for retries of requests (default value is a delay growing exponentially between 100us and 100ms).
|
RetryStrategy |
retryStrategy()
The retry strategy on how to dispatch requests in the failure case.
|
DefaultCoreEnvironment.Builder |
retryStrategy(RetryStrategy retryStrategy)
Sets the
RetryStrategy to be used during request retries (default value is a BestEffortRetryStrategy ). |
Scheduler |
scheduler()
Returns the scheduler which should be used for all core actions that need to happen asynchronously.
|
DefaultCoreEnvironment.Builder |
scheduler(Scheduler scheduler)
Sets the Scheduler implementation for the underlying computation framework.
|
Observable<Boolean> |
shutdown()
This operation doesn’t make sense on the Builder and will throw an
UnsupportedOperationException . |
boolean |
sslEnabled()
Identifies if SSL should be enabled.
|
DefaultCoreEnvironment.Builder |
sslEnabled(boolean sslEnabled)
Set if SSL should be enabled (default value ).
|
String |
sslKeystoreFile() |
DefaultCoreEnvironment.Builder |
sslKeystoreFile(String sslKeystoreFile)
Defines the location of the SSL Keystore file (default value null, none).
|
String |
sslKeystorePassword() |
DefaultCoreEnvironment.Builder |
sslKeystorePassword(String sslKeystorePassword)
Sets the SSL Keystore password to be used with the Keystore file (default value null, none).
|
String |
userAgent()
Library identification string, which can be used as User-Agent header in HTTP requests.
|
DefaultCoreEnvironment.Builder |
userAgent(String userAgent)
Sets the USER-AGENT String to be sent in HTTP requests headers (should usually not be tweaked, default value is computed from the SDK
packageNameAndVersion() ). |
int |
viewEndpoints()
The number of view service endpoints.
|
DefaultCoreEnvironment.Builder |
viewEndpoints(int viewServiceEndpoints)
Sets the number of View endpoints to open per node in the cluster (default value ).
|
public boolean dcpEnabled()
CoreEnvironment
Identifies if DCP should be enabled.
dcpEnabled
in interface CoreEnvironment
public DefaultCoreEnvironment.Builder dcpEnabled(boolean dcpEnabled)
Set if DCP should be enabled (only makes sense with server versions >= 3.0.0, default ).
public boolean sslEnabled()
CoreEnvironment
Identifies if SSL should be enabled.
sslEnabled
in interface CoreEnvironment
public DefaultCoreEnvironment.Builder sslEnabled(boolean sslEnabled)
Set if SSL should be enabled (default value ). If true, also set sslKeystoreFile(String)
and sslKeystorePassword(String)
.
public String sslKeystoreFile()
sslKeystoreFile
in interface CoreEnvironment
public DefaultCoreEnvironment.Builder sslKeystoreFile(String sslKeystoreFile)
Defines the location of the SSL Keystore file (default value null, none).
public String sslKeystorePassword()
sslKeystorePassword
in interface CoreEnvironment
public DefaultCoreEnvironment.Builder sslKeystorePassword(String sslKeystorePassword)
Sets the SSL Keystore password to be used with the Keystore file (default value null, none).
sslKeystoreFile(String)
public boolean queryEnabled()
queryEnabled
in interface CoreEnvironment
public DefaultCoreEnvironment.Builder queryEnabled(boolean queryEnabled)
Toggles the N1QL Query feature (default value ). This parameter will be deprecated once N1QL is in General Availability and shipped with the server.
If not bundled with the server, the N1QL service must run on all the cluster’s nodes.
public int queryPort()
queryPort
in interface CoreEnvironment
public DefaultCoreEnvironment.Builder queryPort(int queryPort)
Defines the port for N1QL Query (default value ). This parameter will be deprecated once N1QL is in General Availability and shipped with the server.
If not bundled with the server, the N1QL service must run on all the cluster’s nodes.
public boolean bootstrapHttpEnabled()
bootstrapHttpEnabled
in interface CoreEnvironment
public DefaultCoreEnvironment.Builder bootstrapHttpEnabled(boolean bootstrapHttpEnabled)
Toggles bootstrap via Http (default value ).
public boolean bootstrapCarrierEnabled()
bootstrapCarrierEnabled
in interface CoreEnvironment
public DefaultCoreEnvironment.Builder bootstrapCarrierEnabled(boolean bootstrapCarrierEnabled)
Toggles bootstrap via carrier publication (default value ).
public int bootstrapHttpDirectPort()
CoreEnvironment
The port to use when bootstrapping through HTTP without SSL.
bootstrapHttpDirectPort
in interface CoreEnvironment
public DefaultCoreEnvironment.Builder bootstrapHttpDirectPort(int bootstrapHttpDirectPort)
If Http bootstrap is enabled and not SSL, sets the port to use (default value ).
public int bootstrapHttpSslPort()
CoreEnvironment
The port to use when bootstrapping through HTTP with SSL.
bootstrapHttpSslPort
in interface CoreEnvironment
public DefaultCoreEnvironment.Builder bootstrapHttpSslPort(int bootstrapHttpSslPort)
If Http bootstrap and SSL are enabled, sets the port to use (default value ).
public int bootstrapCarrierDirectPort()
CoreEnvironment
The port to use when bootstrapping through carrier publication without SSL.
bootstrapCarrierDirectPort
in interface CoreEnvironment
public DefaultCoreEnvironment.Builder bootstrapCarrierDirectPort(int bootstrapCarrierDirectPort)
If carrier publication bootstrap is enabled and not SSL, sets the port to use (default value ).
public int bootstrapCarrierSslPort()
CoreEnvironment
The port to use when bootstrapping through carrier publication with SSL.
bootstrapCarrierSslPort
in interface CoreEnvironment
public DefaultCoreEnvironment.Builder bootstrapCarrierSslPort(int bootstrapCarrierSslPort)
If carrier publication bootstrap and SSL are enabled, sets the port to use (default value ).
public int ioPoolSize()
CoreEnvironment
Returns the configured IO pool size.
ioPoolSize
in interface CoreEnvironment
public DefaultCoreEnvironment.Builder ioPoolSize(int ioPoolSize)
Sets the pool size (number of threads to use) for I/O operations (default value is the number of CPUs).
If there is more nodes in the cluster than the defined ioPoolSize, multiplexing will automatically happen.
public int computationPoolSize()
computationPoolSize
in interface CoreEnvironment
public DefaultCoreEnvironment.Builder computationPoolSize(int computationPoolSize)
Sets the pool size (number of threads to use) for all non blocking operations in the core and clients (default value is the number of CPUs).
Don’t size it too small since it would significantly impact performance.
public int requestBufferSize()
CoreEnvironment
Returns the size of the request ringbuffer.
requestBufferSize
in interface CoreEnvironment
public DefaultCoreEnvironment.Builder requestBufferSize(int requestBufferSize)
Sets the size of the RingBuffer structure that queues requests (default value ). This is an advanced parameter that usually shouldn’t need to be changed.
public int responseBufferSize()
CoreEnvironment
Returns the size of the response ringbuffer.
responseBufferSize
in interface CoreEnvironment
public DefaultCoreEnvironment.Builder responseBufferSize(int responseBufferSize)
Sets the size of the RingBuffer structure that queues responses (default value ). This is an advanced parameter that usually shouldn’t need to be changed
public int kvEndpoints()
CoreEnvironment
The number of key/value service endpoints.
kvEndpoints
in interface CoreEnvironment
public DefaultCoreEnvironment.Builder kvEndpoints(int kvServiceEndpoints)
Sets the number of Key/Value endpoints to open per nodes in the cluster (default value ).
Only tune to more if IO has been identified as the most probable bottleneck, since it can reduce batching on the tcp/network level.
public int viewEndpoints()
CoreEnvironment
The number of view service endpoints.
viewEndpoints
in interface CoreEnvironment
public DefaultCoreEnvironment.Builder viewEndpoints(int viewServiceEndpoints)
Sets the number of View endpoints to open per node in the cluster (default value ).
Setting this to a higher number is advised in heavy view workloads.
public int queryEndpoints()
CoreEnvironment
The number of query service endpoints.
queryEndpoints
in interface CoreEnvironment
public DefaultCoreEnvironment.Builder queryEndpoints(int queryServiceEndpoints)
Sets the number of Query (N1QL) endpoints to open per node in the cluster (default value ).
Setting this to a higher number is advised in heavy query workloads.
public String userAgent()
CoreEnvironment
Library identification string, which can be used as User-Agent header in HTTP requests.
userAgent
in interface CoreEnvironment
public DefaultCoreEnvironment.Builder userAgent(String userAgent)
Sets the USER-AGENT String to be sent in HTTP requests headers (should usually not be tweaked, default value is computed from the SDK packageNameAndVersion()
).
public String packageNameAndVersion()
CoreEnvironment
Returns name and the version of the package. This method used to by @{link userAgent()}.
packageNameAndVersion
in interface CoreEnvironment
public DefaultCoreEnvironment.Builder packageNameAndVersion(String packageNameAndVersion)
Sets the String to be used as identifier for the library namespace and version. (should usually not be tweaked, default value is computed at build time from VCS tags/commits).
This is used in userAgent()
notably.
public Delay observeIntervalDelay()
CoreEnvironment
observeIntervalDelay
in interface CoreEnvironment
public DefaultCoreEnvironment.Builder observeIntervalDelay(Delay observeIntervalDelay)
public Delay reconnectDelay()
CoreEnvironment
Returns the Delay
for node reconnects.
reconnectDelay
in interface CoreEnvironment
public DefaultCoreEnvironment.Builder reconnectDelay(Delay reconnectDelay)
Sets the Delay
for node reconnects (default value is a delay growing exponentially between 32ms and 4096ms).
public Delay retryDelay()
CoreEnvironment
Returns the Delay
for request retries.
retryDelay
in interface CoreEnvironment
public DefaultCoreEnvironment.Builder retryDelay(Delay retryDelay)
Sets the for retries of requests (default value is a delay growing exponentially between 100us and 100ms).
public Observable<Boolean> shutdown()
This operation doesn’t make sense on the Builder and will throw an UnsupportedOperationException
.
shutdown
in interface CoreEnvironment
UnsupportedOperationException
- when invoked.public EventLoopGroup ioPool()
CoreEnvironment
Returns the IO pool for the underlying IO framework.
ioPool
in interface CoreEnvironment
public DefaultCoreEnvironment.Builder ioPool(EventLoopGroup group)
Sets the I/O Pool implementation for the underlying IO framework. This is an advanced configuration that should only be used if you know what you are doing.
public Scheduler scheduler()
CoreEnvironment
Returns the scheduler which should be used for all core actions that need to happen asynchronously.
scheduler
in interface CoreEnvironment
public DefaultCoreEnvironment.Builder scheduler(Scheduler scheduler)
Sets the Scheduler implementation for the underlying computation framework. This is an advanced configuration that should only be used if you know what you are doing.
public RetryStrategy retryStrategy()
CoreEnvironment
The retry strategy on how to dispatch requests in the failure case.
retryStrategy
in interface CoreEnvironment
public DefaultCoreEnvironment.Builder retryStrategy(RetryStrategy retryStrategy)
Sets the RetryStrategy
to be used during request retries (default value is a BestEffortRetryStrategy
).
public long maxRequestLifetime()
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.
maxRequestLifetime
in interface CoreEnvironment
public DefaultCoreEnvironment.Builder maxRequestLifetime(long maxRequestLifetime)
Sets the maximum time in milliseconds a request is allowed to live.
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.
Default is 75s.
public long keepAliveInterval()
CoreEnvironment
The time in milliseconds after which some service will issue a form of keep-alive request.
keepAliveInterval
in interface CoreEnvironment
public DefaultCoreEnvironment.Builder keepAliveInterval(long keepAliveIntervalMilliseconds)
Sets the time of inactivity, in milliseconds, after which some services will issue a form of keep-alive request to their corresponding server/nodes (default is 30s, values <= 0 deactivate the idle check).
public long autoreleaseAfter()
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.
autoreleaseAfter
in interface CoreEnvironment
public DefaultCoreEnvironment.Builder autoreleaseAfter(long autoreleaseAfter)
Sets the time after which any non-consumed buffers will be automatically released. Setting this to a higher value than a few seconds is not recommended since this may lead to increased garbage collection.
public EventBus eventBus()
CoreEnvironment
Returns the event bus where events are broadcasted on and can be published to.
eventBus
in interface CoreEnvironment
public DefaultCoreEnvironment.Builder eventBus(EventBus eventBus)
Sets the event bus to an alternative implementation.
This setting should only be tweaked in advanced cases.
public boolean bufferPoolingEnabled()
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.
bufferPoolingEnabled
in interface CoreEnvironment
public DefaultCoreEnvironment.Builder bufferPoolingEnabled(boolean bufferPoolingEnabled)
Forcefully disable buffer pooling by setting the value to false.
This should not be used in general because buffer pooling is in place to reduce GC pressure during workloads. It is implemented to be used as a “last resort” if the client is suspect to a buffer leak which can terminate the application. Until a solution is found to the leak buffer pooling can be disabled at the cost of higher GC.
public DefaultCoreEnvironment build()
Copyright © 2014 Couchbase, Inc.