You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When an influxdb-java client is created and batch is enabled, it prevents the application from exiting normally due to the use of a default non-daemon thread pool. This prevents the application from shutting down in the event that the main thread exits/ crashes. Adding a shutdown hook would not help with closing the client as the JVM will only run shutdown hooks after all non-daemon thread exits. A small example would be running the following:
But I was wondering if it would be a better user experience to have this be the default behaviour so that the main application is allowed to exit normally. The rationale is that a common use case for influxdb-java is to write application metrics and usually one would not expect a metrics library to affect the main application (e.g. cause it to not exit properly).
The text was updated successfully, but these errors were encountered:
nice finding, do you mind adding this to the documentation and probably to the javadoc of the influxDB.enableBatch method ? I'm happy to review a pull request.
Hi alright, just wondering do you think BatchOptions.DEFAULT should have a thread factory that by default produce daemon threads or should this just be documented?
As making this default is a change in behavior i really prefer to document it, or if you create a PR to change the behavior for the defaults, this must be documented well in the changelog
Hi Team,
When an influxdb-java client is created and batch is enabled, it prevents the application from exiting normally due to the use of a default non-daemon thread pool. This prevents the application from shutting down in the event that the main thread exits/ crashes. Adding a shutdown hook would not help with closing the client as the JVM will only run shutdown hooks after all non-daemon thread exits. A small example would be running the following:
Currently, the workaround is to explicitly specify a daemon thread factory:
But I was wondering if it would be a better user experience to have this be the default behaviour so that the main application is allowed to exit normally. The rationale is that a common use case for influxdb-java is to write application metrics and usually one would not expect a metrics library to affect the main application (e.g. cause it to not exit properly).
The text was updated successfully, but these errors were encountered: