You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by li...@apache.org on 2019/02/21 07:09:28 UTC
[incubator-iotdb] branch fix_OpenFileNumUtilTest_failure_lr
updated: check OS for getPID()
This is an automated email from the ASF dual-hosted git repository.
liurui pushed a commit to branch fix_OpenFileNumUtilTest_failure_lr
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git
The following commit(s) were added to refs/heads/fix_OpenFileNumUtilTest_failure_lr by this push:
new 88d7fcf check OS for getPID()
88d7fcf is described below
commit 88d7fcfada99525b105f04d1356ba9fbe59083c5
Author: liuruiyiyang <24...@qq.com>
AuthorDate: Thu Feb 21 15:09:17 2019 +0800
check OS for getPID()
---
.../org/apache/iotdb/db/utils/OpenFileNumUtil.java | 46 +++++++++++-----------
1 file changed, 24 insertions(+), 22 deletions(-)
diff --git a/iotdb/src/main/java/org/apache/iotdb/db/utils/OpenFileNumUtil.java b/iotdb/src/main/java/org/apache/iotdb/db/utils/OpenFileNumUtil.java
index eaa8372..9a26ead 100644
--- a/iotdb/src/main/java/org/apache/iotdb/db/utils/OpenFileNumUtil.java
+++ b/iotdb/src/main/java/org/apache/iotdb/db/utils/OpenFileNumUtil.java
@@ -98,30 +98,32 @@ public class OpenFileNumUtil {
Process pro1;
Runtime r = Runtime.getRuntime();
String osName = System.getProperty("os.name").toLowerCase();
- try {
- String command;
- String processName = IOTDB_PROCESS_KEY_WORD;
- if (osName.startsWith(LINUX_OS_NAME)) {
- command = String.format(SEARCH_PID_LINUX, processName);
- } else {
- command = String.format(SEARCH_PID_MAC, processName);
- }
- COMMAND_TEMPLATE[2] = command;
- pro1 = r.exec(COMMAND_TEMPLATE);
- BufferedReader in1 = new BufferedReader(new InputStreamReader(pro1.getInputStream()));
- String line;
- while ((line = in1.readLine()) != null) {
- line = line.trim();
- String[] temp = line.split("\\s+");
- if (temp.length > 1 && isNumeric(temp[1])) {
- iotdbPid = Integer.parseInt(temp[1]);
- break;
+ if (osName.startsWith(LINUX_OS_NAME) || osName.startsWith(MAC_OS_NAME)) {
+ try {
+ String command;
+ String processName = IOTDB_PROCESS_KEY_WORD;
+ if (osName.startsWith(LINUX_OS_NAME)) {
+ command = String.format(SEARCH_PID_LINUX, processName);
+ } else {
+ command = String.format(SEARCH_PID_MAC, processName);
+ }
+ COMMAND_TEMPLATE[2] = command;
+ pro1 = r.exec(COMMAND_TEMPLATE);
+ BufferedReader in1 = new BufferedReader(new InputStreamReader(pro1.getInputStream()));
+ String line;
+ while ((line = in1.readLine()) != null) {
+ line = line.trim();
+ String[] temp = line.split("\\s+");
+ if (temp.length > 1 && isNumeric(temp[1])) {
+ iotdbPid = Integer.parseInt(temp[1]);
+ break;
+ }
}
+ in1.close();
+ pro1.destroy();
+ } catch (IOException e) {
+ log.error("Cannot get pid of IoTDB process. ", e);
}
- in1.close();
- pro1.destroy();
- } catch (IOException e) {
- log.error("Cannot get pid of IoTDB process. ", e);
}
return iotdbPid;
}