程序包 com.cnosdb
类 BatchOptions
java.lang.Object
com.cnosdb.BatchOptions
- 所有已实现的接口:
Cloneable
BatchOptions are used to configure batching of individual data point writes
into CnosDB. See
CnosDB.enableBatch(BatchOptions)-
字段概要
字段修饰符和类型字段说明static final intstatic final intstatic final intstatic final booleanstatic final intstatic final TimeUnitstatic final BatchOptionsDefault batch options. -
方法概要
修饰符和类型方法说明actions(int actions) bufferLimit(int bufferLimit) The client maintains a buffer for failed writes so that the writes will be retried later on.consistency(CnosDB.ConsistencyLevel consistency) dropActionsOnQueueExhaustion(boolean dropActionsOnQueueExhaustion) Set to define the behaviour when the action queue exhausts.droppedActionHandler(Consumer<Point> droppedActionHandler) Handler to handle dropped actions due to queue actions.exceptionHandler(BiConsumer<Iterable<Point>, Throwable> exceptionHandler) flushDuration(int flushDuration) intintintintbooleanjitterDuration(int jitterDuration) Jitters the batch flush interval by a random amount.Set the time precision to use for the whole batch.threadFactory(ThreadFactory threadFactory)
-
字段详细资料
-
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
-
DEFAULT_DROP_ACTIONS_ON_QUEUE_EXHAUSTION
public static final boolean DEFAULT_DROP_ACTIONS_ON_QUEUE_EXHAUSTION- 另请参阅:
-
DEFAULTS
Default batch options. This class is immutable, each configuration is built by taking the DEFAULTS and setting specific configuration properties.
-
-
方法详细资料
-
actions
- 参数:
actions- the number of actions to collect- 返回:
- the BatchOptions instance to be able to use it in a fluent manner.
-
flushDuration
- 参数:
flushDuration- the time to wait at most (milliseconds).- 返回:
- the BatchOptions instance to be able to use it in a fluent manner.
-
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
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 thangetActions()- 参数:
bufferLimit- maximum number of points stored in the retry buffer- 返回:
- the BatchOptions instance to be able to use it in a fluent manner.
-
threadFactory
- 参数:
threadFactory- a ThreadFactory instance to be used- 返回:
- the BatchOptions instance to be able to use it in a fluent manner.
-
exceptionHandler
- 参数:
exceptionHandler- a consumer function to handle asynchronous errors- 返回:
- the BatchOptions instance to be able to use it in a fluent manner.
-
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
Set the time precision to use for the whole batch. If unspecified, will default toTimeUnit.NANOSECONDS.- 参数:
precision- sets the precision to use- 返回:
- the BatchOptions instance to be able to use it in a fluent manner.
-
dropActionsOnQueueExhaustion
Set to define the behaviour when the action queue exhausts. If unspecified, will default to false which means that theCnosDB.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 anddroppedActionHandlerwill be called.- 参数:
dropActionsOnQueueExhaustion- sets the behavior- 返回:
- the BatchOptions instance to be able to use it in a fluent manner.
-
droppedActionHandler
Handler to handle dropped actions due to queue actions. This is only valid whendropActionsOnQueueExhaustionis 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
- 返回:
- a ThreadFactory instance to be used
-
getExceptionHandler
- 返回:
- a consumer function to handle asynchronous errors
-
getConsistency
- 返回:
- cluster consistency setting (how many nodes have to store data points to treat a write as a success)
-
getPrecision
- 返回:
- the time precision
-
isDropActionsOnQueueExhaustion
public boolean isDropActionsOnQueueExhaustion()- 返回:
- a boolean determining whether to drop actions on action queue exhaustion.
-
getDroppedActionHandler
- 返回:
- a consumer function to handle actions drops on action queue exhaustion.
-