Skip to content

Commit ea861ac

Browse files
committed
Error handling doc
1 parent cb12f31 commit ea861ac

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

README.md

+10-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,16 @@ Query query = new Query("SELECT idle FROM cpu", dbName);
7575
influxDB.query(query);
7676
influxDB.deleteDatabase(dbName);
7777
```
78-
Note that the batching functionality creates an internal thread pool that needs to be shutdown explicitly as part of a gracefull application shut-down, or the application will not shut down properly. To do so simply call: ```influxDB.close()```
78+
Note that the batching functionality creates an internal thread pool that needs to be shutdown explicitly as part of a graceful application shut-down, or the application will not shut down properly. To do so simply call: ```influxDB.close()```
79+
80+
Also note that any errors that happen during the batch flush won't leak into the caller of the `write` method. By default, any kind of errors will be just logged with "SEVERE" level.
81+
82+
If you need to be notified and do some custom logic when such asynchronous errors happen, you can add an error handler with a `Consumer<Throwable>` using the overloaded `enableBatch` method:
83+
84+
```java
85+
// Flush every 2000 Points, at least every 100ms
86+
influxDB.enableBatch(2000, 100, TimeUnit.MILLISECONDS, Executors.defaultThreadFactory(), (throwable) -> { /* custom error handling here */ });
87+
```
7988

8089
### Advanced Usages:
8190

0 commit comments

Comments
 (0)