Skip to content

Commit d89a016

Browse files
committed
使用oshi代替sigar获取系统属性。
1 parent 68197d9 commit d89a016

4 files changed

Lines changed: 355 additions & 25 deletions

File tree

src/main/java/com/xwintop/xJavaFxTool/controller/javaFxTools/ShowSystemInfoController.java

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
package com.xwintop.xJavaFxTool.controller.javaFxTools;
22

3+
import cn.hutool.core.thread.ThreadUtil;
34
import com.xwintop.xJavaFxTool.services.javaFxTools.ShowSystemInfoService;
45
import com.xwintop.xJavaFxTool.view.javaFxTools.ShowSystemInfoView;
5-
6-
import java.net.URL;
7-
import java.util.ResourceBundle;
8-
96
import javafx.beans.value.ChangeListener;
107
import javafx.beans.value.ObservableValue;
118
import javafx.event.Event;
@@ -14,11 +11,14 @@
1411
import lombok.Setter;
1512
import lombok.extern.log4j.Log4j;
1613

17-
/**
14+
import java.net.URL;
15+
import java.util.ResourceBundle;
16+
17+
/**
1818
* @ClassName: ShowSystemInfoController
1919
* @Description: 显示系统信息
2020
* @author: xufeng
21-
* @date: 2017/11/28 22:16
21+
* @date: 2017/11/28 22:16
2222
*/
2323
@Getter
2424
@Setter
@@ -39,16 +39,21 @@ private void initView() {
3939
showSystemInfoService.showOverviewCpuLineChart();
4040
showSystemInfoService.showOverviewMemoryLineChart();
4141
showSystemInfoService.showOverviewDiskLineChart();
42-
showSystemInfoService.showOverviewNetLineChart();
42+
// showSystemInfoService.showOverviewNetLineChart();
4343
// showSystemInfoService.showDiskInfo();
44-
showSystemInfoService.showVmInfo();
44+
ThreadUtil.execute(() -> {
45+
showSystemInfoService.showSystemInfo();
46+
});
47+
ThreadUtil.execute(() -> {
48+
showSystemInfoService.showVmInfo();
49+
});
4550
}
4651

4752
private void initEvent() {
4853
mainTabPane.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Tab>() {
4954
@Override
5055
public void changed(ObservableValue<? extends Tab> observable, Tab oldValue, Tab newValue) {
51-
if(newValue == diskTab){
56+
if (newValue == diskTab) {
5257
System.out.println(newValue.getText());
5358
showSystemInfoService.showDiskInfo();
5459
}
@@ -59,10 +64,10 @@ public void changed(ObservableValue<? extends Tab> observable, Tab oldValue, Tab
5964
private void initService() {
6065
}
6166

62-
/**
67+
/**
6368
* 父控件被移除前调用
6469
*/
65-
public void onCloseRequest(Event event){
70+
public void onCloseRequest(Event event) {
6671
System.out.println("移除所以线程");
6772
showSystemInfoService.stopTimerList();
6873
}

0 commit comments

Comments
 (0)