程序包 com.cnosdb

类 BatchOptions

java.lang.Object
com.cnosdb.BatchOptions
所有已实现的接口:
Cloneable

public final class BatchOptions extends Object implements Cloneable
BatchOptions are used to configure batching of individual data point writes into CnosDB. See CnosDB.enableBatch(BatchOptions)
  • 字段详细资料

    • DEFAULT_BATCH_ACTIONS_LIMIT

      public static final int DEFAULT_BATCH_ACTIONS_LIMIT
      另请参阅:
    • DEFAULT_BATCH_INTERVAL_DURATION

      public static final int DEFAULT_BATCH_INTERVAL_DURATION
      另请参阅:
    • DEFAULT_JITTER_INTERVAL_DURATION

      public static final int DEFAULT_JITTER_INTERVAL_DURATION
      另请参阅:
    • DEFAULT_BUFFER_LIMIT

      public static final int DEFAULT_BUFFER_LIMIT
      另请参阅:
    • DEFAULT_PRECISION

      public static final TimeUnit DEFAULT_PRECISION
    • DEFAULT_DROP_ACTIONS_ON_QUEUE_EXHAUSTION

      public static final boolean DEFAULT_DROP_ACTIONS_ON_QUEUE_EXHAUSTION
      另请参阅:
    • DEFAULTS

      public static final BatchOptions DEFAULTS
      Default batch options. This class is immutable, each configuration is built by taking the DEFAULTS and setting specific configuration properties.
  • 方法详细资料

    • actions

      public BatchOptions actions(int actions)
      参数:
      actions - the number of actions to collect
      返回:
      the BatchOptions instance to be able to use it in a fluent manner.
    • flushDuration

      public BatchOptions flushDuration(int flushDuration)
      参数:
      flushDuration - the time to wait at most (milliseconds).
      返回:
      the BatchOptions instance to be able to use it in a fluent manner.
    • jitterDuration

      public BatchOptions jitterDuration(int jitterDuration)
      Jitters the batch flush interval by a random amount. This is primarily to avoid large write spikes for users running a large number of client instances. ie, a jitter of 5s and flush duration 10s means flushes will happen every 10-15s.
      参数:
      jitterDuration - (milliseconds)
      返回:
      the BatchOptions instance to be able to use it in a fluent manner.
    • bufferLimit

      public BatchOptions bufferLimit(int bufferLimit)
      The client maintains a buffer for failed writes so that the writes will be retried later on. This may help to overcome temporary network problems or CnosDB load spikes. When the buffer is full and new points are written, oldest entries in the buffer are lost. To disable this feature set buffer limit to a value smaller than getActions()
      参数:
      bufferLimit - maximum number of points stored in the retry buffer
      返回:
      the BatchOptions instance to be able to use it in a fluent manner.
    • threadFactory

      public BatchOptions threadFactory(ThreadFactory threadFactory)
      参数:
      threadFactory - a ThreadFactory instance to be used
      返回:
      the BatchOptions instance to be able to use it in a fluent manner.
    • exceptionHandler

      public BatchOptions exceptionHandler(BiConsumer<Iterable<Point>,Throwable> exceptionHandler)
      参数:
      exceptionHandler - a consumer function to handle asynchronous errors
      返回:
      the BatchOptions instance to be able to use it in a fluent manner.
    • consistency

      public BatchOptions consistency(CnosDB.ConsistencyLevel consistency)
      参数:
      consistency - cluster consistency setting (how many nodes have to store data points to treat a write as a success)
      返回:
      the BatchOptions instance to be able to use it in a fluent manner.
    • precision

      public BatchOptions precision(TimeUnit precision)
      Set the time precision to use for the whole batch. If unspecified, will default to TimeUnit.NANOSECONDS.
      参数:
      precision - sets the precision to use
      返回:
      the BatchOptions instance to be able to use it in a fluent manner.
    • dropActionsOnQueueExhaustion

      public BatchOptions dropActionsOnQueueExhaustion(boolean dropActionsOnQueueExhaustion)
      Set to define the behaviour when the action queue exhausts. If unspecified, will default to false which means that the CnosDB.write(Point) will be blocked till the space in the queue is created. true means that the newer actions being written to the queue will be dropped and droppedActionHandler will be called.
      参数:
      dropActionsOnQueueExhaustion - sets the behavior
      返回:
      the BatchOptions instance to be able to use it in a fluent manner.
    • droppedActionHandler

      public BatchOptions droppedActionHandler(Consumer<Point> droppedActionHandler)
      Handler to handle dropped actions due to queue actions. This is only valid when dropActionsOnQueueExhaustion is set to true.
      参数:
      droppedActionHandler - to handle action drops on action queue exhaustion.
      返回:
      the BatchOptions instance to be able to use it in a fluent manner.
    • getActions

      public int getActions()
      返回:
      actions the number of actions to collect
    • getFlushDuration

      public int getFlushDuration()
      返回:
      flushDuration the time to wait at most (milliseconds).
    • getJitterDuration

      public int getJitterDuration()
      返回:
      batch flush interval jitter value (milliseconds)
    • getBufferLimit

      public int getBufferLimit()
      返回:
      Maximum number of points stored in the retry buffer, see bufferLimit(int)
    • getThreadFactory

      public ThreadFactory getThreadFactory()
      返回:
      a ThreadFactory instance to be used
    • getExceptionHandler

      public BiConsumer<Iterable<Point>,Throwable> getExceptionHandler()
      返回:
      a consumer function to handle asynchronous errors
    • getConsistency

      public CnosDB.ConsistencyLevel getConsistency()
      返回:
      cluster consistency setting (how many nodes have to store data points to treat a write as a success)
    • getPrecision

      public TimeUnit getPrecision()
      返回:
      the time precision
    • isDropActionsOnQueueExhaustion

      public boolean isDropActionsOnQueueExhaustion()
      返回:
      a boolean determining whether to drop actions on action queue exhaustion.
    • getDroppedActionHandler

      public Consumer<Point> getDroppedActionHandler()
      返回:
      a consumer function to handle actions drops on action queue exhaustion.