|
1 | 1 | package com.keven1z.core.model;
|
2 | 2 |
|
3 |
| -import com.keven1z.core.EngineController; |
4 |
| -import com.keven1z.core.utils.FileUtils; |
5 |
| -import org.apache.commons.lang3.StringUtils; |
6 | 3 |
|
| 4 | +import org.apache.commons.lang3.StringUtils; |
7 | 5 | import java.io.File;
|
8 | 6 | import java.lang.management.ManagementFactory;
|
9 | 7 | import java.net.InetAddress;
|
10 | 8 | import java.net.UnknownHostException;
|
11 | 9 | import java.util.HashMap;
|
12 | 10 | import java.util.Map;
|
13 |
| - |
14 |
| -import static com.keven1z.core.consts.CommonConst.DEFAULT_APPLICATION_NAME; |
15 |
| - |
16 | 11 | /**
|
17 | 12 | * 检测的应用的信息
|
18 | 13 | */
|
@@ -85,7 +80,7 @@ public static void setAgentId(String agentId) {
|
85 | 80 | }
|
86 | 81 |
|
87 | 82 | public static String getHostName() {
|
88 |
| - if (isLinux()) { |
| 83 | + if (isLinux() || isMacOS()) { |
89 | 84 | try {
|
90 | 85 | return (InetAddress.getLocalHost()).getHostName();
|
91 | 86 | } catch (UnknownHostException uhe) {
|
@@ -185,6 +180,10 @@ private static boolean isLinux() {
|
185 | 180 | String serverName = System.getProperty("os.name");
|
186 | 181 | return StringUtils.startsWith(serverName, "Linux");
|
187 | 182 | }
|
| 183 | + private static boolean isMacOS() { |
| 184 | + String serverName = System.getProperty("os.name"); |
| 185 | + return StringUtils.startsWith(serverName, "Mac"); |
| 186 | + } |
188 | 187 |
|
189 | 188 | public static void clear() {
|
190 | 189 | ApplicationModel.getApplicationInfo().clear();
|
|
0 commit comments