org.influxdb.InfluxDB.disableBatch()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(4.8k)|赞(0)|评价(0)|浏览(214)

本文整理了Java中org.influxdb.InfluxDB.disableBatch()方法的一些代码示例,展示了InfluxDB.disableBatch()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。InfluxDB.disableBatch()方法的具体详情如下:
包路径:org.influxdb.InfluxDB
类名称:InfluxDB
方法名:disableBatch

InfluxDB.disableBatch介绍

[英]Disable Batching.
[中]禁用批处理。

代码示例

代码示例来源:origin: PerfCake/PerfCake

@Override
public void close() {
 if (influxDb != null) {
   influxDb.disableBatch(); // flushes batch
 }
}

代码示例来源:origin: com.remondis.limbus/limbus-monitoring-influx

@Override
protected void performFinish() {
 try {
  if (influxDB != null) {
   influxDB.disableBatch();
   influxDB = null;
  }
 } catch (Exception e) {
  log.warn("Finishing the Influx HTTP publisher threw an exception.", e);
 }
}

代码示例来源:origin: inspectIT/inspectIT

/**
 * Disables batching of the current {@link #influxDB} client.
 */
private void disableBatching() {
  if ((null != influxDB) && influxDB.isBatchEnabled()) {
    influxDB.disableBatch();
  }
}

代码示例来源:origin: apache/bahir-flink

@Override
  public void close() {
    if (influxDBClient.isBatchEnabled()) {
      influxDBClient.disableBatch();
    }
    influxDBClient.close();
  }
}

代码示例来源:origin: inspectIT/inspectIT

@Test
public void disconnected() {
  influxDao.active = true;
  when(influxDb.isBatchEnabled()).thenReturn(true);
  influxDao.onDisconnection();
  assertThat(influxDao.isConnected(), is(false));
  assertThat(influxDao.getServiceStatus(), is(ExternalServiceStatus.DISCONNECTED));
  verify(influxDb).isBatchEnabled();
  verify(influxDb).disableBatch();
  verifyNoMoreInteractions(influxDb);
  verifyZeroInteractions(future, executor, availabilityChecker, clientFactory);
}

代码示例来源:origin: inspectIT/inspectIT

@Test
public void disableInfluxConnectionOngoing() {
  when(future.isDone()).thenReturn(false);
  when(influxDb.isBatchEnabled()).thenReturn(false, true);
  influxDao.active = true;
  influxDao.propertiesUpdated();
  influxDao.active = false;
  influxDao.propertiesUpdated();
  assertThat(influxDao.isConnected(), is(false));
  assertThat(influxDao.getServiceStatus(), is(ExternalServiceStatus.DISABLED));
  verify(future).cancel(true);
  verify(future).isDone();
  verify(executor, times(1)).submit(any(Runnable.class));
  verify(influxDb).ping();
  verify(influxDb).write(any(String.class), any(String.class), any(Point.class));
  verify(influxDb).query(any(Query.class));
  verify(influxDb, times(2)).isBatchEnabled();
  verify(influxDb).enableBatch(InfluxDBDao.BATCH_BUFFER_SIZE, InfluxDBDao.BATCH_FLUSH_TIMER, TimeUnit.SECONDS);
  verify(influxDb).disableBatch();
  verify(availabilityChecker, times(2)).deactivate();
  verify(availabilityChecker).setInflux(influxDb);
  verify(availabilityChecker).activate();
  verify(clientFactory).createClient();
  verifyNoMoreInteractions(future, influxDb, availabilityChecker, executor, clientFactory);
}

代码示例来源:origin: inspectIT/inspectIT

@Test
public void disableInflux() {
  when(future.isDone()).thenReturn(true);
  when(influxDb.isBatchEnabled()).thenReturn(false, true);
  influxDao.active = true;
  influxDao.propertiesUpdated();
  influxDao.active = false;
  influxDao.propertiesUpdated();
  assertThat(influxDao.isConnected(), is(false));
  assertThat(influxDao.getServiceStatus(), is(ExternalServiceStatus.DISABLED));
  verify(future).isDone();
  verify(executor, times(1)).submit(any(Runnable.class));
  verify(influxDb).ping();
  verify(influxDb).write(any(String.class), any(String.class), any(Point.class));
  verify(influxDb).query(any(Query.class));
  verify(influxDb, times(2)).isBatchEnabled();
  verify(influxDb).enableBatch(InfluxDBDao.BATCH_BUFFER_SIZE, InfluxDBDao.BATCH_FLUSH_TIMER, TimeUnit.SECONDS);
  verify(influxDb).disableBatch();
  verify(availabilityChecker, times(2)).deactivate();
  verify(availabilityChecker).setInflux(influxDb);
  verify(availabilityChecker).activate();
  verify(clientFactory).createClient();
  verifyNoMoreInteractions(future, influxDb, availabilityChecker, executor, clientFactory);
}

代码示例来源:origin: NovatecConsulting/JMeter-InfluxDB-Writer

@Override
public void teardownTest(BackendListenerContext context) throws Exception {
  LOGGER.info("Shutting down influxDB scheduler...");
  scheduler.shutdown();
  addVirtualUsersMetrics(0,0,0,0,JMeterContextService.getThreadCounts().finishedThreads);
  influxDB.write(
      influxDBConfig.getInfluxDatabase(),
      influxDBConfig.getInfluxRetentionPolicy(),
      Point.measurement(TestStartEndMeasurement.MEASUREMENT_NAME).time(System.currentTimeMillis(), TimeUnit.MILLISECONDS)
          .tag(TestStartEndMeasurement.Tags.TYPE, TestStartEndMeasurement.Values.FINISHED)
          .tag(TestStartEndMeasurement.Tags.NODE_NAME, nodeName)
          .tag(TestStartEndMeasurement.Tags.RUN_ID, runId)
          .tag(TestStartEndMeasurement.Tags.TEST_NAME, testName)
          .addField(TestStartEndMeasurement.Fields.PLACEHOLDER,"1")
          .build());
  influxDB.disableBatch();
  try {
    scheduler.awaitTermination(30, TimeUnit.SECONDS);
    LOGGER.info("influxDB scheduler terminated!");
  } catch (InterruptedException e) {
    LOGGER.error("Error waiting for end of scheduler");
  }
  samplersToFilter.clear();
  super.teardownTest(context);
}

代码示例来源:origin: Scrin/RuuviCollector

influxDB.enableBatch(batchSize, batchTime, TimeUnit.MILLISECONDS);
} else {
  influxDB.disableBatch();

相关文章