File tree Expand file tree Collapse file tree 1 file changed +3
-5
lines changed
platform-agent/src/main/java/com/flow/platform/agent Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change 2828import com .flow .platform .util .Logger ;
2929import com .google .common .collect .Lists ;
3030import com .google .common .collect .Maps ;
31- import com .sun .management .OperatingSystemMXBean ;
32- import java .lang .management .ManagementFactory ;
3331import java .time .ZonedDateTime ;
3432import java .util .ArrayList ;
3533import java .util .HashMap ;
@@ -238,9 +236,9 @@ public void run() {
238236 private String collectionAgentInfo () {
239237 String javaVersion = System .getProperty ("java.version" );
240238 String osName = System .getProperty ("os.name" );
241- OperatingSystemMXBean os = ( OperatingSystemMXBean ) ManagementFactory . getOperatingSystemMXBean ();
242- long total = os . getTotalPhysicalMemorySize ();
243- long free = os . getFreePhysicalMemorySize ();
239+ Runtime runtime = Runtime . getRuntime ();
240+ long total = runtime . totalMemory ();
241+ long free = runtime . freeMemory ();
244242 long use = total - free ;
245243 Map <String , String > dic = new HashMap <>(7 );
246244 dic .put ("javaVersion" , javaVersion );
You can’t perform that action at this time.
0 commit comments