Class ClientConfiguration

java.lang.Object
org.apache.commons.configuration2.event.BaseEventSource
org.apache.commons.configuration2.AbstractConfiguration
org.apache.commons.configuration2.CompositeConfiguration
org.apache.bookkeeper.conf.AbstractConfiguration<ClientConfiguration>
org.apache.bookkeeper.conf.ClientConfiguration
All Implemented Interfaces:
Cloneable, org.apache.commons.configuration2.Configuration, org.apache.commons.configuration2.event.EventSource, org.apache.commons.configuration2.ImmutableConfiguration, org.apache.commons.configuration2.sync.SynchronizerSupport

public class ClientConfiguration extends AbstractConfiguration<ClientConfiguration>
Configuration settings for client side.
  • Field Details

  • Constructor Details

    • ClientConfiguration

      public ClientConfiguration()
      Construct a default client-side configuration.
    • ClientConfiguration

      public ClientConfiguration(AbstractConfiguration conf)
      Construct a client-side configuration using a base configuration.
      Parameters:
      conf - Base configuration
  • Method Details

    • getThrottleValue

      public int getThrottleValue()
      Get throttle value.
      Returns:
      throttle value
      See Also:
    • setThrottleValue

      public ClientConfiguration setThrottleValue(int throttle)
      Set throttle value.

      Since BookKeeper process requests in asynchronous way, it will holds those pending request in queue. You may easily run it out of memory if producing too many requests than the capability of bookie servers can handle. To prevent that from happening, you can set a throttle value here.

      Setting the throttle value to 0, will disable any throttling.

      Parameters:
      throttle - Throttle Value
      Returns:
      client configuration
    • getEnableDigestTypeAutodetection

      public boolean getEnableDigestTypeAutodetection()
      Get autodetection of digest type.

      Ignores provided digestType, if enabled and uses one from ledger metadata instead. Incompatible with ledger created by bookie versions < 4.2

      It is turned on by default since 4.7.

      Returns:
      flag to enable/disable autodetection of digest type.
    • setEnableDigestTypeAutodetection

      public ClientConfiguration setEnableDigestTypeAutodetection(boolean enable)
      Enable autodetection of digest type. Ignores provided digestType, if enabled and uses one from ledger metadata instead. Incompatible with ledger created by bookie versions < 4.2
      Returns:
      client configuration.
    • getBookieRecoveryDigestType

      public BookKeeper.DigestType getBookieRecoveryDigestType()
      Get digest type used in bookkeeper admin.
      Returns:
      digest type
      See Also:
    • setBookieRecoveryDigestType

      public ClientConfiguration setBookieRecoveryDigestType(BookKeeper.DigestType digestType)
      Set digest type used in bookkeeper admin.

      Digest Type and Passwd used to open ledgers for admin tool For now, assume that all ledgers were created with the same DigestType and password. In the future, this admin tool will need to know for each ledger, what was the DigestType and password used to create it before it can open it. These values will come from System properties, though fixed defaults are defined here.

      Parameters:
      digestType - Digest Type
      Returns:
      client configuration
    • getBookieRecoveryPasswd

      public byte[] getBookieRecoveryPasswd()
      Get passwd used in bookkeeper admin.
      Returns:
      password
      See Also:
    • setBookieRecoveryPasswd

      public ClientConfiguration setBookieRecoveryPasswd(byte[] passwd)
      Set passwd used in bookkeeper admin.

      Digest Type and Passwd used to open ledgers for admin tool For now, assume that all ledgers were created with the same DigestType and password. In the future, this admin tool will need to know for each ledger, what was the DigestType and password used to create it before it can open it. These values will come from System properties, though fixed defaults are defined here.

      Parameters:
      passwd - Password
      Returns:
      client configuration
    • getClientTcpNoDelay

      public boolean getClientTcpNoDelay()
      Is tcp connection no delay.
      Returns:
      tcp socket nodelay setting
      See Also:
    • setClientTcpNoDelay

      public ClientConfiguration setClientTcpNoDelay(boolean noDelay)
      Set socket nodelay setting.

      This settings is used to enabled/disabled Nagle's algorithm, which is a means of improving the efficiency of TCP/IP networks by reducing the number of packets that need to be sent over the network. If you are sending many small messages, such that more than one can fit in a single IP packet, setting client.tcpnodelay to false to enable Nagle algorithm can provide better performance.
      Default value is true.

      Parameters:
      noDelay - NoDelay setting
      Returns:
      client configuration
    • getClientSockKeepalive

      public boolean getClientSockKeepalive()
      get socket keepalive.
      Returns:
      socket keepalive setting
    • setClientSockKeepalive

      public ClientConfiguration setClientSockKeepalive(boolean keepalive)
      Set socket keepalive setting.

      This setting is used to send keep-alive messages on connection-oriented sockets.

      Parameters:
      keepalive - KeepAlive setting
      Returns:
      client configuration
    • getClientSendBufferSize

      public int getClientSendBufferSize()
      Get client netty channel send buffer size.
      Returns:
      client netty channel send buffer size
    • setClientSendBufferSize

      public ClientConfiguration setClientSendBufferSize(int bufferSize)
      Set client netty channel send buffer size.
      Parameters:
      bufferSize - client netty channel send buffer size.
      Returns:
      client configuration.
    • getClientReceiveBufferSize

      public int getClientReceiveBufferSize()
      Get client netty channel receive buffer size.
      Returns:
      client netty channel receive buffer size.
    • setClientReceiveBufferSize

      public ClientConfiguration setClientReceiveBufferSize(int bufferSize)
      Set client netty channel receive buffer size.
      Parameters:
      bufferSize - netty channel receive buffer size.
      Returns:
      client configuration.
    • getClientWriteBufferLowWaterMark

      public int getClientWriteBufferLowWaterMark()
      Get client netty channel write buffer low water mark.
      Returns:
      netty channel write buffer low water mark.
    • setClientWriteBufferLowWaterMark

      public ClientConfiguration setClientWriteBufferLowWaterMark(int waterMark)
      Set client netty channel write buffer low water mark.
      Parameters:
      waterMark - netty channel write buffer low water mark.
      Returns:
      client configuration.
    • getClientWriteBufferHighWaterMark

      public int getClientWriteBufferHighWaterMark()
      Get client netty channel write buffer high water mark.
      Returns:
      netty channel write buffer high water mark.
    • setClientWriteBufferHighWaterMark

      public ClientConfiguration setClientWriteBufferHighWaterMark(int waterMark)
      Set client netty channel write buffer high water mark.
      Parameters:
      waterMark - netty channel write buffer high water mark.
      Returns:
      client configuration.
    • getTimeoutTimerTickDurationMs

      public long getTimeoutTimerTickDurationMs()
      Get the tick duration in milliseconds that used for timeout timer.
      Returns:
      tick duration in milliseconds
    • setTimeoutTimerTickDurationMs

      public ClientConfiguration setTimeoutTimerTickDurationMs(long tickDuration)
      Set the tick duration in milliseconds that used for timeout timer.
      Parameters:
      tickDuration - tick duration in milliseconds.
      Returns:
      client configuration.
    • getTimeoutTimerNumTicks

      public int getTimeoutTimerNumTicks()
      Get number of ticks that used for timeout timer.
      Returns:
      number of ticks that used for timeout timer.
    • setTimeoutTimerNumTicks

      public ClientConfiguration setTimeoutTimerNumTicks(int numTicks)
      Set number of ticks that used for timeout timer.
      Parameters:
      numTicks - number of ticks that used for timeout timer.
      Returns:
      client configuration.
    • getClientConnectTimeoutMillis

      public int getClientConnectTimeoutMillis()
      Get client netty connect timeout in millis.
      Returns:
      client netty connect timeout in millis.
    • setClientConnectTimeoutMillis

      public ClientConfiguration setClientConnectTimeoutMillis(int connectTimeoutMillis)
      Set client netty connect timeout in millis.
      Parameters:
      connectTimeoutMillis - client netty connect timeout in millis.
      Returns:
      client configuration.
    • getTcpUserTimeoutMillis

      public int getTcpUserTimeoutMillis()
      Get client netty TCP user timeout in millis (only for Epoll channels).
      Returns:
      client netty Epoll user tcp timeout in millis.
      Throws:
      NoSuchElementException - if the property is not set.
    • setTcpUserTimeoutMillis

      public ClientConfiguration setTcpUserTimeoutMillis(int tcpUserTimeoutMillis)
      Set client netty TCP user timeout in millis (only for Epoll channels).
      Parameters:
      tcpUserTimeoutMillis - client netty TCP user timeout in millis.
      Returns:
      client configuration.
    • getNumChannelsPerBookie

      public int getNumChannelsPerBookie()
      Get num channels per bookie.
      Returns:
      num channels per bookie.
    • setNumChannelsPerBookie

      public ClientConfiguration setNumChannelsPerBookie(int numChannelsPerBookie)
      Set num channels per bookie.
      Parameters:
      numChannelsPerBookie - num channels per bookie.
      Returns:
      client configuration.
    • getUseV2WireProtocol

      public boolean getUseV2WireProtocol()
      Use older Bookkeeper wire protocol (no protobuf).
      Returns:
      whether or not to use older Bookkeeper wire protocol (no protobuf)
    • setUseV2WireProtocol

      public ClientConfiguration setUseV2WireProtocol(boolean useV2WireProtocol)
      Set whether or not to use older Bookkeeper wire protocol (no protobuf).
      Parameters:
      useV2WireProtocol - whether or not to use older Bookkeeper wire protocol (no protobuf)
      Returns:
      client configuration.
    • getReadTimeout

      @Deprecated public int getReadTimeout()
      Deprecated.
      Get the socket read timeout. This is the number of seconds we wait without hearing a response from a bookie before we consider it failed.

      The default is 5 seconds.

      Returns:
      the current read timeout in seconds
    • setReadTimeout

      @Deprecated public ClientConfiguration setReadTimeout(int timeout)
      Set the socket read timeout.
      Parameters:
      timeout - The new read timeout in seconds
      Returns:
      client configuration
      See Also:
    • getAddEntryTimeout

      public int getAddEntryTimeout()
      Get the timeout for add request. This is the number of seconds we wait without hearing a response for add request from a bookie before we consider it failed.

      The default value is 5 second for backwards compatibility.

      Returns:
      add entry timeout.
    • setAddEntryTimeout

      public ClientConfiguration setAddEntryTimeout(int timeout)
      Set timeout for add entry request.
      Parameters:
      timeout - The new add entry timeout in seconds.
      Returns:
      client configuration.
      See Also:
    • getAddEntryQuorumTimeout

      public int getAddEntryQuorumTimeout()
      Get the timeout for top-level add request. That is, the amount of time we should spend waiting for ack quorum.
      Returns:
      add entry ack quorum timeout.
    • setAddEntryQuorumTimeout

      public ClientConfiguration setAddEntryQuorumTimeout(int timeout)
      Set timeout for top-level add entry request.
      Parameters:
      timeout - The new add entry ack quorum timeout in seconds.
      Returns:
      client configuration.
      See Also:
    • getReadEntryTimeout

      public int getReadEntryTimeout()
      Get the timeout for read entry. This is the number of seconds we wait without hearing a response for read entry request from a bookie before we consider it failed. By default, we use socket timeout specified at getReadTimeout().
      Returns:
      read entry timeout.
    • setReadEntryTimeout

      public ClientConfiguration setReadEntryTimeout(int timeout)
      Set the timeout for read entry request.
      Parameters:
      timeout - The new read entry timeout in seconds.
      Returns:
      client configuration.
      See Also:
    • getTimeoutMonitorIntervalSec

      public long getTimeoutMonitorIntervalSec()
      Get the interval between successive executions of the operation timeout monitor. This value is in seconds.
      Returns:
      the interval at which request timeouts will be checked
      See Also:
    • setTimeoutMonitorIntervalSec

      public ClientConfiguration setTimeoutMonitorIntervalSec(long timeoutInterval)
      Set the interval between successive executions of the operation timeout monitor. The value in seconds. Every X seconds, all outstanding add and read operations are checked to see if they have been running for longer than their configured timeout. Any that have been will be errored out.

      This timeout should be set to a value which is a fraction of the values of getAddEntryQuorumTimeout(), getAddEntryTimeout() and getReadEntryTimeout(), so that these timeouts run in a timely fashion.

      Parameters:
      timeoutInterval - The timeout monitor interval, in seconds
      Returns:
      client configuration
    • getTimeoutTaskIntervalMillis

      @Deprecated public long getTimeoutTaskIntervalMillis()
      Deprecated.
      Get the interval between successive executions of the PerChannelBookieClient's TimeoutTask. This value is in milliseconds. Every X milliseconds, the timeout task will be executed and it will error out entries that have timed out.

      We do it more aggressive to not accumulate pending requests due to slow responses.

      Returns:
      the interval at which request timeouts will be checked
    • setTimeoutTaskIntervalMillis

      @Deprecated public ClientConfiguration setTimeoutTaskIntervalMillis(long timeoutMillis)
      Deprecated.
    • getExplictLacInterval

      public int getExplictLacInterval()
      Get the configured interval between explicit LACs to bookies. Generally LACs are piggy-backed on writes, and user can configure the interval between these protocol messages. A value of '0' disables sending any explicit LACs.
      Returns:
      interval between explicit LACs
    • setExplictLacInterval

      public ClientConfiguration setExplictLacInterval(int interval)
      Set the interval to check the need for sending an explicit LAC.
      Parameters:
      interval - Number of milli seconds between checking the need for sending an explict LAC.
      Returns:
      Client configuration.
    • getPCBCTimeoutTimerTickDurationMs

      @Deprecated public long getPCBCTimeoutTimerTickDurationMs()
      Deprecated.
      Get the tick duration in milliseconds that used for the HashedWheelTimer that used by PCBC to timeout requests.
      Returns:
      tick duration in milliseconds
    • setPCBCTimeoutTimerTickDurationMs

      @Deprecated public ClientConfiguration setPCBCTimeoutTimerTickDurationMs(long tickDuration)
      Deprecated.
      Set the tick duration in milliseconds that used for HashedWheelTimer that used by PCBC to timeout requests. Be aware of HashedWheelTimer if you are going to modify this setting.
      Parameters:
      tickDuration - tick duration in milliseconds.
      Returns:
      client configuration.
      See Also:
    • getPCBCTimeoutTimerNumTicks

      @Deprecated public int getPCBCTimeoutTimerNumTicks()
      Deprecated.
      Get number of ticks that used for HashedWheelTimer that used by PCBC to timeout requests.
      Returns:
      number of ticks that used for timeout timer.
    • setPCBCTimeoutTimerNumTicks

      @Deprecated public ClientConfiguration setPCBCTimeoutTimerNumTicks(int numTicks)
      Deprecated.
      Set number of ticks that used for HashedWheelTimer that used by PCBC to timeout request. Be aware of HashedWheelTimer if you are going to modify this setting.
      Parameters:
      numTicks - number of ticks that used for timeout timer.
      Returns:
      client configuration.
      See Also:
    • getWaitTimeoutOnBackpressureMillis

      public long getWaitTimeoutOnBackpressureMillis()
      Timeout controlling wait on request send in case of unresponsive bookie(s) (i.e. bookie in long GC etc.)
      Returns:
      timeout value negative value disables the feature 0 to allow request to fail immediately Default is -1 (disabled)
    • setWaitTimeoutOnBackpressureMillis

      public ClientConfiguration setWaitTimeoutOnBackpressureMillis(long value)
      Timeout controlling wait on request send in case of unresponsive bookie(s) (i.e. bookie in long GC etc.)
      Parameters:
      value - negative value disables the feature 0 to allow request to fail immediately Default is -1 (disabled)
      Returns:
      client configuration.
    • getNumWorkerThreads

      public int getNumWorkerThreads()
      Get the number of worker threads. This is the number of worker threads used by bookkeeper client to submit operations.
      Returns:
      the number of worker threads
    • setNumWorkerThreads

      public ClientConfiguration setNumWorkerThreads(int numThreads)
      Set the number of worker threads.

      NOTE: setting the number of worker threads after BookKeeper object is constructed will not take any effect on the number of threads in the pool.

      Parameters:
      numThreads - number of worker threads used for bookkeeper
      Returns:
      client configuration
      See Also:
    • getNumIOThreads

      public int getNumIOThreads()
      Get the number of IO threads. This is the number of threads used by Netty to handle TCP connections.
      Returns:
      the number of IO threads
    • setNumIOThreads

      public ClientConfiguration setNumIOThreads(int numThreads)
      Set the number of IO threads.

      This is the number of threads used by Netty to handle TCP connections.

      NOTE: setting the number of IO threads after BookKeeper object is constructed will not take any effect on the number of threads in the pool.

      Parameters:
      numThreads - number of IO threads used for bookkeeper
      Returns:
      client configuration
      See Also:
    • getSpeculativeReadTimeout

      public int getSpeculativeReadTimeout()
      Get the period of time after which a speculative entry read should be triggered. A speculative entry read is sent to the next replica bookie before an error or response has been received for the previous entry read request.

      A speculative entry read is only sent if we have not heard from the current replica bookie during the entire read operation which may comprise of many entries.

      Speculative reads allow the client to avoid having to wait for the connect timeout in the case that a bookie has failed. It induces higher load on the network and on bookies. This should be taken into account before changing this configuration value.

      Returns:
      the speculative read timeout in milliseconds. Default 2000.
      See Also:
    • setSpeculativeReadTimeout

      public ClientConfiguration setSpeculativeReadTimeout(int timeout)
      Set the speculative read timeout. A lower timeout will reduce read latency in the case of a failed bookie, while increasing the load on bookies and the network.

      The default is 2000 milliseconds. A value of 0 will disable speculative reads completely.

      Parameters:
      timeout - the timeout value, in milliseconds
      Returns:
      client configuration
      See Also:
    • getFirstSpeculativeReadTimeout

      public int getFirstSpeculativeReadTimeout()
      Get the first speculative read timeout.
      Returns:
      first speculative read timeout.
    • setFirstSpeculativeReadTimeout

      public ClientConfiguration setFirstSpeculativeReadTimeout(int timeout)
      Set the first speculative read timeout.
      Parameters:
      timeout - first speculative read timeout.
      Returns:
      client configuration.
    • getSpeculativeReadTimeoutBackoffMultiplier

      public float getSpeculativeReadTimeoutBackoffMultiplier()
      Multiplier to use when determining time between successive speculative read requests.
      Returns:
      speculative read timeout backoff multiplier.
    • setSpeculativeReadTimeoutBackoffMultiplier

      public ClientConfiguration setSpeculativeReadTimeoutBackoffMultiplier(float speculativeReadTimeoutBackoffMultiplier)
      Set the multiplier to use when determining time between successive speculative read requests.
      Parameters:
      speculativeReadTimeoutBackoffMultiplier - multiplier to use when determining time between successive speculative read requests.
      Returns:
      client configuration.
    • getSpeculativeReadLACTimeoutBackoffMultiplier

      public float getSpeculativeReadLACTimeoutBackoffMultiplier()
      Multiplier to use when determining time between successive speculative read LAC requests.
      Returns:
      speculative read LAC timeout backoff multiplier.
    • setSpeculativeReadLACTimeoutBackoffMultiplier

      public ClientConfiguration setSpeculativeReadLACTimeoutBackoffMultiplier(float speculativeReadLACTimeoutBackoffMultiplier)
      Set the multiplier to use when determining time between successive speculative read LAC requests.
      Parameters:
      speculativeReadLACTimeoutBackoffMultiplier - multiplier to use when determining time between successive speculative read LAC requests.
      Returns:
      client configuration.
    • getMaxSpeculativeReadTimeout

      public int getMaxSpeculativeReadTimeout()
      Get the max speculative read timeout.
      Returns:
      max speculative read timeout.
    • setMaxSpeculativeReadTimeout

      public ClientConfiguration setMaxSpeculativeReadTimeout(int timeout)
      Set the max speculative read timeout.
      Parameters:
      timeout - max speculative read timeout.
      Returns:
      client configuration.
    • getFirstSpeculativeReadLACTimeout

      public int getFirstSpeculativeReadLACTimeout()
      Get the period of time after which the first speculative read last add confirmed and entry should be triggered. A speculative entry request is sent to the next replica bookie before an error or response has been received for the previous entry read request.

      A speculative entry read is only sent if we have not heard from the current replica bookie during the entire read operation which may comprise of many entries.

      Speculative requests allow the client to avoid having to wait for the connect timeout in the case that a bookie has failed. It induces higher load on the network and on bookies. This should be taken into account before changing this configuration value.

      Returns:
      the speculative request timeout in milliseconds. Default 1500.
    • getMaxSpeculativeReadLACTimeout

      public int getMaxSpeculativeReadLACTimeout()
      Get the maximum interval between successive speculative read last add confirmed and entry requests.
      Returns:
      the max speculative request timeout in milliseconds. Default 5000.
    • setFirstSpeculativeReadLACTimeout

      public ClientConfiguration setFirstSpeculativeReadLACTimeout(int timeout)
      Set the period of time after which the first speculative read last add confirmed and entry should be triggered. A lower timeout will reduce read latency in the case of a failed bookie, while increasing the load on bookies and the network.

      The default is 1500 milliseconds. A value of 0 will disable speculative reads completely.

      Parameters:
      timeout - the timeout value, in milliseconds
      Returns:
      client configuration
      See Also:
    • setMaxSpeculativeReadLACTimeout

      public ClientConfiguration setMaxSpeculativeReadLACTimeout(int timeout)
      Set the maximum interval between successive speculative read last add confirmed and entry requests.
      Parameters:
      timeout - the timeout value, in milliseconds
      Returns:
      client configuration
    • getEnableParallelRecoveryRead

      public boolean getEnableParallelRecoveryRead()
      Whether to enable parallel reading in recovery read.
      Returns:
      true if enable parallel reading in recovery read. otherwise, return false.
    • setEnableParallelRecoveryRead

      public ClientConfiguration setEnableParallelRecoveryRead(boolean enabled)
      Enable/Disable parallel reading in recovery read.
      Parameters:
      enabled - flag to enable/disable parallel reading in recovery read.
      Returns:
      client configuration.
    • getRecoveryReadBatchSize

      public int getRecoveryReadBatchSize()
      Get Recovery Read Batch Size.
      Returns:
      recovery read batch size.
    • setRecoveryReadBatchSize

      public ClientConfiguration setRecoveryReadBatchSize(int batchSize)
      Set Recovery Read Batch Size.
      Parameters:
      batchSize - recovery read batch size.
      Returns:
      client configuration.
    • isReorderReadSequenceEnabled

      public boolean isReorderReadSequenceEnabled()
      If reorder read sequence enabled or not.
      Returns:
      true if reorder read sequence is enabled, otherwise false.
    • setReorderReadSequenceEnabled

      public ClientConfiguration setReorderReadSequenceEnabled(boolean enabled)
      Enable/disable reordering read sequence on reading entries.

      If this flag is enabled, the client will use EnsemblePlacementPolicy.reorderReadSequence(java.util.List, org.apache.bookkeeper.client.BookiesHealthInfo, org.apache.bookkeeper.client.DistributionSchedule.WriteSet) to figure out a better read sequence to attempt reads from replicas and use EnsemblePlacementPolicy.reorderReadLACSequence(java.util.List, org.apache.bookkeeper.client.BookiesHealthInfo, org.apache.bookkeeper.client.DistributionSchedule.WriteSet) to figure out a better read sequence to attempt long poll reads from replicas.

      The order of read sequence is determined by the placement policy implementations.

      Parameters:
      enabled - the flag to enable/disable reorder read sequence.
      Returns:
      client configuration instance.
    • isStickyReadsEnabled

      public boolean isStickyReadsEnabled()
      If read operation should be sticky to a single bookie or not.
      Returns:
      true if reorder read sequence is enabled, otherwise false.
    • setStickyReadsEnabled

      public ClientConfiguration setStickyReadsEnabled(boolean enabled)
      Enable/disable having read operations for a ledger to be sticky to a single bookie.

      If this flag is enabled, the client will use one single bookie (by preference) to read all entries for a ledger.

      Having all the read to one bookie will increase the chances that a read request will be fulfilled by Bookie read cache (or OS file system cache) when doing sequential reads.

      Parameters:
      enabled - the flag to enable/disable sticky reads.
      Returns:
      client configuration instance.
    • isRecoveryBatchReadEnabled

      public boolean isRecoveryBatchReadEnabled()
      If recovery batch read enabled or not.
      Returns:
    • setRecoveryBatchReadEnabled

      public ClientConfiguration setRecoveryBatchReadEnabled(boolean enabled)
      Enable/disable recovery batch read.
      Parameters:
      enabled -
      Returns:
    • getEnsemblePlacementPolicy

      public Class<? extends EnsemblePlacementPolicy> getEnsemblePlacementPolicy() throws org.apache.commons.configuration2.ex.ConfigurationException
      Get Ensemble Placement Policy Class.
      Returns:
      ensemble placement policy class.
      Throws:
      org.apache.commons.configuration2.ex.ConfigurationException
    • setEnsemblePlacementPolicy

      public ClientConfiguration setEnsemblePlacementPolicy(Class<? extends EnsemblePlacementPolicy> policyClass)
      Set Ensemble Placement Policy Class.
      Parameters:
      policyClass - Ensemble Placement Policy Class.
    • getReorderThresholdPendingRequests

      public int getReorderThresholdPendingRequests()
      Get the threshold for the number of pending requests beyond which to reorder reads. If <= zero, this feature is turned off.
      Returns:
      the threshold for the number of pending requests beyond which to reorder reads.
    • setReorderThresholdPendingRequests

      public ClientConfiguration setReorderThresholdPendingRequests(int threshold)
      Set the threshold for the number of pending requests beyond which to reorder reads. If zero, this feature is turned off.
      Parameters:
      threshold - The threshold for the number of pending requests beyond which to reorder reads.
    • getNetworkTopologyStabilizePeriodSeconds

      public int getNetworkTopologyStabilizePeriodSeconds()
      Get the network topology stabilize period in seconds. if it is zero, this feature is turned off.
      Returns:
      network topology stabilize period in seconds.
    • setNetworkTopologyStabilizePeriodSeconds

      public ClientConfiguration setNetworkTopologyStabilizePeriodSeconds(int seconds)
      Set the network topology stabilize period in seconds.
      Parameters:
      seconds - stabilize period in seconds
      Returns:
      client configuration.
      See Also:
    • getBookieAddressResolverEnabled

      public boolean getBookieAddressResolverEnabled()
      Whether to enable BookieAddressResolver.
      Returns:
      flag to enable/disable BookieAddressResolver.
    • setBookieAddressResolverEnabled

      public ClientConfiguration setBookieAddressResolverEnabled(boolean enabled)
      Enable/Disable BookieAddressResolver.

      If this flag is true, read bookie information from the metadata service (e.g. ZooKeeper) to resolve the address from each bookie ID. If all bookie IDs in the cluster are "address:port" or "hostname:port", you can set this flag to false to reduce requests to the metadata service.

      Parameters:
      enabled - flag to enable/disable BookieAddressResolver.
      Returns:
      client configuration.
    • setUseHostnameResolveLocalNodePlacementPolicy

      public void setUseHostnameResolveLocalNodePlacementPolicy(boolean useHostnameResolveLocalNodePlacementPolicy)
      Set the flag to use hostname to resolve local node placement policy.
      Parameters:
      useHostnameResolveLocalNodePlacementPolicy -
    • getUseHostnameResolveLocalNodePlacementPolicy

      public boolean getUseHostnameResolveLocalNodePlacementPolicy()
      Get whether to use hostname to resolve local node placement policy.
      Returns:
    • getEnableTaskExecutionStats

      public boolean getEnableTaskExecutionStats()
      Whether to enable recording task execution stats.
      Returns:
      flag to enable/disable recording task execution stats.
    • setEnableTaskExecutionStats

      public ClientConfiguration setEnableTaskExecutionStats(boolean enabled)
      Enable/Disable recording task execution stats.
      Parameters:
      enabled - flag to enable/disable recording task execution stats.
      Returns:
      client configuration.
    • getTaskExecutionWarnTimeMicros

      public long getTaskExecutionWarnTimeMicros()
      Get task execution duration which triggers a warning.
      Returns:
      time in microseconds which triggers a warning.
    • setTaskExecutionWarnTimeMicros

      public ClientConfiguration setTaskExecutionWarnTimeMicros(long warnTime)
      Set task execution duration which triggers a warning.
      Parameters:
      warnTime - time in microseconds which triggers a warning.
      Returns:
      client configuration.
    • isBookieHealthCheckEnabled

      public boolean isBookieHealthCheckEnabled()
      Check if bookie health check is enabled.
      Returns:
    • enableBookieHealthCheck

      public ClientConfiguration enableBookieHealthCheck()
      Enables the bookie health check.

      If the number of read/write errors for a bookie exceeds getBookieErrorThresholdPerInterval() per interval, that bookie is quarantined for getBookieQuarantineTimeSeconds() seconds. During this quarantined period, the client will try not to use this bookie when creating new ensembles.

      By default, the bookie health check is disabled.

      Returns:
      client configuration
    • getBookieHealthCheckIntervalSeconds

      public int getBookieHealthCheckIntervalSeconds()
      Get the bookie health check interval in seconds.
      Returns:
    • setBookieHealthCheckInterval

      public ClientConfiguration setBookieHealthCheckInterval(int interval, TimeUnit unit)
      Set the bookie health check interval. Default is 60 seconds.

      Note: Please enableBookieHealthCheck() to use this configuration.

      Parameters:
      interval -
      unit -
      Returns:
      client configuration
    • getBookieErrorThresholdPerInterval

      public long getBookieErrorThresholdPerInterval()
      Get the error threshold for a bookie to be quarantined.
      Returns:
    • setBookieErrorThresholdPerInterval

      public ClientConfiguration setBookieErrorThresholdPerInterval(long thresholdPerInterval)
      Set the error threshold per interval (getBookieHealthCheckIntervalSeconds()) for a bookie before it is quarantined. Default is 100 errors per minute.

      Note: Please enableBookieHealthCheck() to use this configuration.

      Parameters:
      thresholdPerInterval -
      Returns:
      client configuration
    • getBookieQuarantineTimeSeconds

      public int getBookieQuarantineTimeSeconds()
      Get the time for which a bookie will be quarantined.
      Returns:
    • setBookieQuarantineTime

      public ClientConfiguration setBookieQuarantineTime(int quarantineTime, TimeUnit unit)
      Set the time for which a bookie will be quarantined. Default is 30 minutes.

      Note: Please enableBookieHealthCheck() to use this configuration.

      Parameters:
      quarantineTime -
      unit -
      Returns:
      client configuration
    • getBookieQuarantineRatio

      public double getBookieQuarantineRatio()
      Get the bookie quarantine ratio.
      Returns:
    • setBookieQuarantineRatio

      public ClientConfiguration setBookieQuarantineRatio(double ratio)
      set the bookie quarantine ratio. default is 1.0.
      Parameters:
      ratio -
      Returns:
      client configuration
    • setNettyMaxFrameSizeBytes

      public ClientConfiguration setNettyMaxFrameSizeBytes(int maxSize)
      Set the max number of bytes a single message can be that is read by the bookie. Any message larger than that size will be rejected.
      Overrides:
      setNettyMaxFrameSizeBytes in class AbstractConfiguration<ClientConfiguration>
      Parameters:
      maxSize - the max size in bytes
      Returns:
      server configuration
    • getGetBookieInfoIntervalSeconds

      public int getGetBookieInfoIntervalSeconds()
      Get the time interval between successive calls for bookie get info. Default is 24 hours.
      Returns:
    • getGetBookieInfoRetryIntervalSeconds

      public int getGetBookieInfoRetryIntervalSeconds()
      Get the time interval between retries on unsuccessful bookie info request. Default is 60s.
      Returns:
    • getDiskWeightBasedPlacementEnabled

      public boolean getDiskWeightBasedPlacementEnabled()
      Return whether disk weight based placement policy is enabled.
      Returns:
    • getBookieMaxWeightMultipleForWeightBasedPlacement

      public int getBookieMaxWeightMultipleForWeightBasedPlacement()
      Returns the max multiple to use for nodes with very high weight.
      Returns:
      max multiple
    • getBookieInfoTimeout

      public int getBookieInfoTimeout()
      Return the timeout value for getBookieInfo request.
      Returns:
    • getStartTLSTimeout

      public int getStartTLSTimeout()
      Return the timeout value for startTLS request.
      Returns:
    • setDiskWeightBasedPlacementEnabled

      public ClientConfiguration setDiskWeightBasedPlacementEnabled(boolean isEnabled)
      Set whether or not disk weight based placement is enabled.
      Parameters:
      isEnabled - - boolean indicating enabled or not
      Returns:
      client configuration
    • setGetBookieInfoIntervalSeconds

      public ClientConfiguration setGetBookieInfoIntervalSeconds(int pollInterval, TimeUnit unit)
      Set the time interval between successive polls for bookie get info.
      Parameters:
      pollInterval -
      unit -
      Returns:
      client configuration
    • setGetBookieInfoRetryIntervalSeconds

      public ClientConfiguration setGetBookieInfoRetryIntervalSeconds(int interval, TimeUnit unit)
      Set the time interval between retries on unsuccessful GetInfo requests.
      Parameters:
      interval -
      unit -
      Returns:
      client configuration
    • setBookieMaxWeightMultipleForWeightBasedPlacement

      public ClientConfiguration setBookieMaxWeightMultipleForWeightBasedPlacement(int multiple)
      Set the max multiple to use for nodes with very high weight.
      Parameters:
      multiple -
      Returns:
      client configuration
    • setGetBookieInfoTimeout

      public ClientConfiguration setGetBookieInfoTimeout(int timeoutSecs)
      Set the timeout value in secs for the GET_BOOKIE_INFO request.
      Parameters:
      timeoutSecs -
      Returns:
      client configuration
    • setStartTLSTimeout

      public ClientConfiguration setStartTLSTimeout(int timeoutSecs)
      Set the timeout value in secs for the START_TLS request.
      Parameters:
      timeoutSecs -
      Returns:
      client configuration
    • getHostnameVerificationEnabled

      public boolean getHostnameVerificationEnabled()
      Whether hostname verification enabled?
      Returns:
      true if hostname verification enabled, otherwise false.
    • setHostnameVerificationEnabled

      public ClientConfiguration setHostnameVerificationEnabled(boolean enabled)
      Enable/Disable hostname verification for tls connection.
      Parameters:
      enabled - flag to enable/disable tls hostname verification.
      Returns:
      client configuration.
    • setClientRole

      public ClientConfiguration setClientRole(String role)
      Set the client role.
      Parameters:
      role - defines how the client will act
      Returns:
      client configuration
    • getClientRole

      public String getClientRole()
      Get the role of the client.
      Returns:
      the type of client
    • getTLSKeyStoreType

      public String getTLSKeyStoreType()
      Get the keystore type for client. Default is JKS.
      Returns:
    • setTLSKeyStoreType

      public ClientConfiguration setTLSKeyStoreType(String arg)
      Set the keystore type for client.
      Returns:
    • getTLSKeyStore

      public String getTLSKeyStore()
      Get the keystore path for the client.
      Returns:
    • setTLSKeyStore

      public ClientConfiguration setTLSKeyStore(String arg)
      Set the keystore path for the client.
      Returns:
    • getTLSKeyStorePasswordPath

      public String getTLSKeyStorePasswordPath()
      Get the path to file containing keystore password, if the client keystore is password protected. Default is null.
      Returns:
    • setTLSKeyStorePasswordPath

      public ClientConfiguration setTLSKeyStorePasswordPath(String arg)
      Set the path to file containing keystore password, if the client keystore is password protected.
      Returns:
    • getTLSTrustStoreType

      public String getTLSTrustStoreType()
      Get the truststore type for client. Default is JKS.
      Returns:
    • setTLSTrustStoreType

      public ClientConfiguration setTLSTrustStoreType(String arg)
      Set the truststore type for client.
      Returns:
    • getTLSTrustStore

      public String getTLSTrustStore()
      Get the truststore path for the client.
      Returns:
    • setTLSTrustStore

      public ClientConfiguration setTLSTrustStore(String arg)
      Set the truststore path for the client.
      Returns:
    • getTLSTrustStorePasswordPath

      public String getTLSTrustStorePasswordPath()
      Get the path to file containing truststore password, if the client truststore is password protected. Default is null.
      Returns:
    • setTLSTrustStorePasswordPath

      public ClientConfiguration setTLSTrustStorePasswordPath(String arg)
      Set the path to file containing truststore password, if the client truststore is password protected.
      Returns:
    • getTLSCertificatePath

      public String getTLSCertificatePath()
      Get the path to file containing TLS Certificate.
      Returns:
    • setTLSCertificatePath

      public ClientConfiguration setTLSCertificatePath(String arg)
      Set the path to file containing TLS Certificate.
      Returns:
    • getOpportunisticStriping

      public boolean getOpportunisticStriping()
      Whether to allow opportunistic striping.
      Returns:
      true if opportunistic striping is enabled
    • setOpportunisticStriping

      public ClientConfiguration setOpportunisticStriping(boolean enabled)
      Enable/Disable opportunistic striping.

      If set to true, when you are creating a ledger with a given ensemble size, the system will automatically handle the lack of enough bookies, reducing ensemble size up to the write quorum size. This way in little clusters you can try to use striping (ensemble size > write quorum size) in case that you have enough bookies up and running, and degrade automatically to the minimum requested replication count.

      Parameters:
      enabled - flag to enable/disable opportunistic striping.
      Returns:
      client configuration.
    • getDelayEnsembleChange

      public boolean getDelayEnsembleChange()
      Whether to delay ensemble change or not?
      Returns:
      true if to delay ensemble change, otherwise false.
    • setDelayEnsembleChange

      public ClientConfiguration setDelayEnsembleChange(boolean enabled)
      Enable/Disable delaying ensemble change.

      If set to true, ensemble change only happens when it can't meet ack quorum requirement. If set to false, ensemble change happens immediately when it received a failed write.

      Parameters:
      enabled - flag to enable/disable delaying ensemble change.
      Returns:
      client configuration.
    • getEnableBookieAddressTracking

      public boolean getEnableBookieAddressTracking()
      Whether to enable bookie address changes tracking.
      Returns:
      flag to enable/disable bookie address changes tracking
    • setEnableBookieAddressTracking

      public ClientConfiguration setEnableBookieAddressTracking(boolean value)
      Enable/Disable bookie address changes tracking.
      Parameters:
      value - flag to enable/disable bookie address changes tracking
      Returns:
      client configuration.
    • getEnableBookieFailureTracking

      public boolean getEnableBookieFailureTracking()
      Whether to enable bookie failure tracking.
      Returns:
      flag to enable/disable bookie failure tracking
    • setEnableBookieFailureTracking

      public ClientConfiguration setEnableBookieFailureTracking(boolean enabled)
      Enable/Disable bookie failure tracking.
      Parameters:
      enabled - flag to enable/disable bookie failure tracking
      Returns:
      client configuration.
    • getBookieFailureHistoryExpirationMSec

      public int getBookieFailureHistoryExpirationMSec()
      Get the bookie failure tracking expiration timeout.
      Returns:
      bookie failure tracking expiration timeout.
    • setBookieFailureHistoryExpirationMSec

      public ClientConfiguration setBookieFailureHistoryExpirationMSec(int expirationMSec)
      Set the bookie failure tracking expiration timeout.
      Parameters:
      expirationMSec - bookie failure tracking expiration timeout.
      Returns:
      client configuration.
    • getDisableEnsembleChangeFeatureName

      public String getDisableEnsembleChangeFeatureName()
      Get the name of the dynamic feature that disables ensemble change.
      Returns:
      name of the dynamic feature that disables ensemble change
    • setDisableEnsembleChangeFeatureName

      public ClientConfiguration setDisableEnsembleChangeFeatureName(String disableEnsembleChangeFeatureName)
      Set the name of the dynamic feature that disables ensemble change.
      Parameters:
      disableEnsembleChangeFeatureName - name of the dynamic feature that disables ensemble change
      Returns:
      client configuration.
    • getMaxAllowedEnsembleChanges

      public int getMaxAllowedEnsembleChanges()
      Get the max allowed ensemble change number.
      Returns:
      value of MaxAllowedEnsembleChanges, default MAX_VALUE, indicating feature is disable.
    • setMaxAllowedEnsembleChanges

      public ClientConfiguration setMaxAllowedEnsembleChanges(int num)
      Set the max allowed ensemble change number.
      Parameters:
      num - value of MaxAllowedEnsembleChanges
      Returns:
      client configuration.
    • isNettyUsePooledBuffers

      @Deprecated public boolean isNettyUsePooledBuffers()
      Option to use Netty Pooled ByteBufs.
      Returns:
      the value of the option
    • setNettyUsePooledBuffers

      public ClientConfiguration setNettyUsePooledBuffers(boolean enabled)
      Enable/Disable the usage of Pooled Netty buffers. While using v2 wire protocol the application will be responsible for releasing ByteBufs returned by BookKeeper.
      Parameters:
      enabled - if enabled BookKeeper will use default Pooled Netty Buffer allocator
      See Also:
    • setRegistrationClientClass

      @Deprecated public ClientConfiguration setRegistrationClientClass(Class<? extends RegistrationClient> regClientClass)
      Deprecated.
      since 4.7.0
      Set registration manager class.
      Parameters:
      regClientClass - ClientClass
    • getRegistrationClientClass

      @Deprecated public Class<? extends RegistrationClient> getRegistrationClientClass() throws org.apache.commons.configuration2.ex.ConfigurationException
      Deprecated.
      since 4.7.0
      Get Registration Client Class.
      Returns:
      registration manager class.
      Throws:
      org.apache.commons.configuration2.ex.ConfigurationException
    • setStoreSystemtimeAsLedgerCreationTime

      public ClientConfiguration setStoreSystemtimeAsLedgerCreationTime(boolean enabled)
      Enable the client to use system time as the ledger creation time.

      If this is enabled, the client will write a ctime field into the ledger metadata. Otherwise, nothing will be written. The creation time of this ledger will be the ctime of the metadata record in metadata store.

      Parameters:
      enabled - flag to enable/disable client using system time as the ledger creation time.
    • getStoreSystemtimeAsLedgerCreationTime

      public boolean getStoreSystemtimeAsLedgerCreationTime()
      Return the flag that indicates whether client is using system time as the ledger creation time when creating ledgers.
      Returns:
      the flag that indicates whether client is using system time as the ledger creation time when creating ledgers.
    • setClientConnectBookieUnavailableLogThrottling

      public ClientConfiguration setClientConnectBookieUnavailableLogThrottling(int throttleValue, TimeUnit unit)
      Set the log frequency when a bookie is unavailable, in order to limit log filesize.
      Parameters:
      throttleValue -
      unit -
      Returns:
      client configuration.
    • getClientConnectBookieUnavailableLogThrottlingMs

      public long getClientConnectBookieUnavailableLogThrottlingMs()
      Get the log frequency when a bookie is unavailable, in milliseconds.
      Returns:
      log frequency when a bookie is unavailable, in milliseconds.
    • setBatchReadEnabled

      public ClientConfiguration setBatchReadEnabled(boolean enable)
    • isBatchReadEnabled

      public boolean isBatchReadEnabled()
    • setTcpKeepIdle

      public ClientConfiguration setTcpKeepIdle(int keepIdle)
      Set TCP_KEEPIDLE value for SO_KEEPALIVE.
      Parameters:
      keepIdle - time in seconds
      Returns:
      client configuration
    • getTcpKeepIdle

      public int getTcpKeepIdle()
      Get TCP_KEEPIDLE value for SO_KEEPALIVE.
      Returns:
      time in seconds, -1 means use system default
    • setTcpKeepIntvl

      public ClientConfiguration setTcpKeepIntvl(int keepIntvl)
      Set TCP_KEEPINTVL value for SO_KEEPALIVE.
      Parameters:
      keepIntvl - time in seconds
      Returns:
      client configuration
    • getTcpKeepIntvl

      public int getTcpKeepIntvl()
      Get TCP_KEEPINTVL value for SO_KEEPALIVE.
      Returns:
      time in seconds, -1 means use system default
    • setTcpKeepCnt

      public ClientConfiguration setTcpKeepCnt(int keepCnt)
      Set TCP_KEEPCNT value for SO_KEEPALIVE.
      Parameters:
      keepCnt - count
      Returns:
      client configuration
    • getTcpKeepCnt

      public int getTcpKeepCnt()
      Get TCP_KEEPCNT value for SO_KEEPALIVE.
      Returns:
      count, -1 means use system default
    • getThis

      protected ClientConfiguration getThis()
      Description copied from class: AbstractConfiguration
      Trickery to allow inheritance with fluent style.
      Specified by:
      getThis in class AbstractConfiguration<ClientConfiguration>