全功能逆变/假负载61850通信程序
Administrator
2023-10-27 8243249b56be4805343458734bc3fdc5c5133a2f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package com.battdata_rt;
 
import java.util.ArrayList;
 
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
 
import com.dec.fbs9100.MysqlConnPool;
 
public class BattData_RT_RamDB_Thread extends Thread {
    
    MysqlConnPool m_conn_pool;
    ArrayList<BattData_RT> al_bgdata;
    double ser_ver = 0;
    boolean server_start_inf_set_ok = false;
    private Logger logger = null;
    
    public BattData_RT_RamDB_Thread(MysqlConnPool conn_pool, ArrayList<BattData_RT> bd_al, double ver)
    {
        logger = LogManager.getLogger(this.getClass());
        
        m_conn_pool = conn_pool;
        al_bgdata = bd_al;
        ser_ver = ver;
    }
    
    @Override
    public void run() {
        logger.info("Server Run State RT_RamDB_Thread Started... ");
        
        while(true) {
            if(false == server_start_inf_set_ok) {
                server_start_inf_set_ok = BattData_RT_RamDB_Thread_SQL
                                            .updateServerStartInfTo_RamDB_Table(m_conn_pool, ser_ver);
            }
            
            if(al_bgdata.size() < 1) {
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
                continue;
            }
            
            try {
                Thread.sleep(3000);
                BattData_RT_RamDB_Thread_SQL.updateServerState_RamDB_Table(m_conn_pool);
            } catch (InterruptedException e) {
                // TODO Auto-generated catch block
                logger.error(e.toString(), e);
            }
        }
    }
}