You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by hx...@apache.org on 2020/01/11 16:31:59 UTC

[incubator-iotdb] branch fix_414_close_metric_service created (now 4b1bdc4)

This is an automated email from the ASF dual-hosted git repository.

hxd pushed a change to branch fix_414_close_metric_service
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git.


      at 4b1bdc4  stop the MetricService if the service start failed but the socket has been initialized.

This branch includes the following new commits:

     new 4b1bdc4  stop the MetricService if the service start failed but the socket has been initialized.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[incubator-iotdb] 01/01: stop the MetricService if the service start failed but the socket has been initialized.

Posted by hx...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hxd pushed a commit to branch fix_414_close_metric_service
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git

commit 4b1bdc4db6002d9f25ea58a3d4d424bd457e4f43
Author: xiangdong huang <sa...@gmail.com>
AuthorDate: Sun Jan 12 00:30:56 2020 +0800

    stop the MetricService if the service start failed but the socket has been initialized.
---
 .../org/apache/iotdb/db/service/MetricsService.java   | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/service/MetricsService.java b/server/src/main/java/org/apache/iotdb/db/service/MetricsService.java
index 63315ef..7dab5aa 100644
--- a/server/src/main/java/org/apache/iotdb/db/service/MetricsService.java
+++ b/server/src/main/java/org/apache/iotdb/db/service/MetricsService.java
@@ -89,11 +89,20 @@ public class MetricsService implements MetricsServiceMBean, IService {
     metricsWebUI.initialize();
     server = metricsWebUI.getServer(port);
     metricsSystem.start();
-    executorService.execute(new MetricsServiceThread(server));
-    logger.info("{}: start {} successfully, listening on ip {} port {}",
-        IoTDBConstant.GLOBAL_DB_NAME, this.getID().getName(),
-        IoTDBDescriptor.getInstance().getConfig().getRpcAddress(),
-        IoTDBDescriptor.getInstance().getConfig().getMetricsPort());
+    try {
+      executorService.execute(new MetricsServiceThread(server));
+      logger.info("{}: start {} successfully, listening on ip {} port {}",
+          IoTDBConstant.GLOBAL_DB_NAME, this.getID().getName(),
+          IoTDBDescriptor.getInstance().getConfig().getRpcAddress(),
+          IoTDBDescriptor.getInstance().getConfig().getMetricsPort());
+    } catch (NullPointerException e) {
+      //issue IOTDB-414, we need to stop the service.
+      logger.error("{}: start {} failed, listening on ip {} port {}",
+          IoTDBConstant.GLOBAL_DB_NAME, this.getID().getName(),
+          IoTDBDescriptor.getInstance().getConfig().getRpcAddress(),
+          IoTDBDescriptor.getInstance().getConfig().getMetricsPort());
+      stopService();
+    }
   }
 
   @Override