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/02/18 00:57:50 UTC

[incubator-iotdb] branch ut_close_socket updated: try 8181 port after environmentutil.cleanup

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

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


The following commit(s) were added to refs/heads/ut_close_socket by this push:
     new e33be28  try 8181 port after environmentutil.cleanup
e33be28 is described below

commit e33be28526c8c763b707025ae22853b7a6bf150a
Author: xiangdong huang <sa...@gmail.com>
AuthorDate: Tue Feb 18 08:57:29 2020 +0800

    try 8181 port after environmentutil.cleanup
---
 .../java/org/apache/iotdb/db/utils/EnvironmentUtils.java   | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/server/src/test/java/org/apache/iotdb/db/utils/EnvironmentUtils.java b/server/src/test/java/org/apache/iotdb/db/utils/EnvironmentUtils.java
index a6de3c9..d5183c3 100644
--- a/server/src/test/java/org/apache/iotdb/db/utils/EnvironmentUtils.java
+++ b/server/src/test/java/org/apache/iotdb/db/utils/EnvironmentUtils.java
@@ -22,6 +22,9 @@ import static org.junit.Assert.fail;
 
 import java.io.File;
 import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.net.Socket;
+import java.net.SocketAddress;
 import javax.management.remote.JMXConnector;
 import javax.management.remote.JMXConnectorFactory;
 import javax.management.remote.JMXServiceURL;
@@ -97,8 +100,15 @@ public class EnvironmentUtils {
     } catch (IOException e) {
       //do nothing
     }
-
-
+    //try MetricService
+    try {
+      Socket socket = new Socket();
+      socket.connect(new InetSocketAddress("127.0.0.1", 8181));
+      logger.error("stop MetricService failed. 8181 can be connected now.");
+      socket.close();
+    } catch (Exception e) {
+      //do nothing
+    }
     QueryResourceManager.getInstance().endQuery(TEST_QUERY_JOB_ID);
     // clear opened file streams
     FileReaderManager.getInstance().closeAndRemoveAllOpenedReaders();