whyclj
2020-12-31 37a84590794954175fdcfa8a5c5b1febc08b21f2
修复停止监听后线程仍未停止bug
2个文件已修改
8 ■■■■ 已修改文件
src/com/sp_comm/Central_Monitor_Thread.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/main_window_central_monitor.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/com/sp_comm/Central_Monitor_Thread.java
@@ -19,6 +19,7 @@
    public boolean auto_update_data = false;                //自动随机数据
    public boolean write_data = false;                        //写入数据
    
    public boolean running_en = true;                        //是否运行
    public Central_ST_Data data;
    
    
@@ -38,7 +39,8 @@
                } catch (InterruptedException e1) {
                    e1.printStackTrace();
                }
                while(true) {
                while(running_en) {
                    //System.out.println(this.getClass().getName());
                    try {
                        /********* 读取数据 ****************************************************/
                        if(read_data) {                
src/main/main_window_central_monitor.java
@@ -604,6 +604,7 @@
                btn_read_simul_dcdis.setEnabled(false);                    //读取数据
                btn_write_simul_dcdis.setEnabled(false);                //写入数据
                
                central_monitor_thread.running_en = false;
                central_monitor_thread.mymodbus.destory();
            }
        });
@@ -1505,9 +1506,10 @@
        panel_508.setLayout(new GridLayout(2, 1,0,0));
        
        panel_509 = new JPanel();
        panel_508.add(panel_509);
        panel_508.add(panel_509);
        panel_509.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "远程控制", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
        panel_509.setLayout(new GridLayout(3, 4, 4, 2));
        btn_switch_close_2500kVA_in1 = new JButton("1号2500A进线屏开关合闸");
        btn_switch_close_2500kVA_in1.setEnabled(false);
        btn_switch_close_2500kVA_in1.addActionListener(new ActionListener() {