我正在嘗試通過InfluxDB實例將指標(biāo)報告合并到我的Vertx應(yīng)用程序中。但是,當(dāng)我嘗試正常結(jié)束我的應(yīng)用程序時,某處有一個掛起的線程。我設(shè)法將其跟蹤到InfluxDB連接以進行vertx的指標(biāo)報告,或者看起來如此,但是我沒有找到殺死它的方法。誰能指出我正確的方向?一個最小的工作示例(如果禁用指標(biāo),則應(yīng)用程序會正常完成,否則將掛起):import io.vertx.core.Vertx;import io.vertx.core.VertxOptions;import io.vertx.micrometer.MicrometerMetricsOptions;import io.vertx.micrometer.VertxInfluxDbOptions;import io.vertx.micrometer.backends.BackendRegistries;public class MWE { public static void main(String[] args) { //setting up the metric options for influxdb. seems to work in MWE without credentials MicrometerMetricsOptions metricsOptions = new MicrometerMetricsOptions() .setRegistryName("data-client") .setInfluxDbOptions(new VertxInfluxDbOptions() //disabling this would make sure the application _does_ gracefully exit .setEnabled(true) ) .setEnabled(true); //setting up the vertx instance Vertx vertx = Vertx.vertx( new VertxOptions() .setMetricsOptions(metricsOptions) .setWorkerPoolSize(50) ); //stop vertx after a second vertx.setTimer(1000, timerID -> { //closing the vertx instance vertx.close(result -> System.out.println("Vertx was closed.")); //closing the registry of metrics to influxdb BackendRegistries.getNow("data-client").close(); System.out.println("Closed everything"); }); System.out.println("Done with main"); }}
Vertx-InfluxDB指標(biāo)保持連接打開
慕無忌1623718
2021-04-16 15:19:30