From f41d94d3e05e221182623361d967f884737c0171 Mon Sep 17 00:00:00 2001 From: Administrator <zhubaomin> Date: 星期二, 19 十二月 2023 14:22:50 +0800 Subject: [PATCH] Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV --- pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/tcpClient/TcpClUnit.java | 45 +++++++++++++++++++++++---------------------- 1 files changed, 23 insertions(+), 22 deletions(-) diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/tcpClient/TcpClUnit.java b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/tcpClient/TcpClUnit.java index 78a8b90..8db9ab8 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/tcpClient/TcpClUnit.java +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mwTest-client/src/main/java/com/dy/testClient/tcpClient/TcpClUnit.java @@ -83,10 +83,13 @@ log.info("鍏辨ā鎷熶簡" + totalRtuClientCount + "鍙癛TU"); Collection<MyThreadJob> collection = jobMap.values() ; + int connectedCount = 0 ; for(MyThreadJob job : collection){ connectServer(job) ; + connectedCount++ ; + log.info("褰撳墠寤虹珛涓庨�氫俊涓棿浠惰繛鎺ョ殑RTU鏁伴噺涓猴細" + connectedCount); } - log.info("鍚姩鎵�鏈塕TU杩炴帴閫氫俊涓棿浠�"); + log.info("鎵�鏈塕TU宸蹭笌閫氫俊涓棿浠跺缓绔嬭繛鎺�"); while (true){ int noConnectedCount = checkConnected() ; @@ -99,6 +102,7 @@ } startJob() ; + while(true){ if(totalOverClientCount.longValue() >= totalRtuClientCount.longValue()){ Long seconds = (System.currentTimeMillis() - startTime)/1000 ; @@ -176,30 +180,27 @@ } private void startJob(){ - new Thread(new Runnable(){ - @Override - public void run() { - try { - int notOverCount; - while(true){ - notOverCount = 0 ; - Collection<MyThreadJob> collection = jobMap.values() ; - for(MyThreadJob job : collection){ - if(!job.isOver){ - notOverCount++ ; - pool.putJob(job); - } - } - if(notOverCount > 0){ - log.info("褰撳墠杩樻湁" + notOverCount + "鍙癛TU鏈畬鎴愪换鍔�"); - Thread.sleep(ServerProperties.sendInterval * 1000); - }else{ - break ; + new Thread(() -> { + try { + int notOverCount; + while(true){ + notOverCount = 0 ; + Collection<MyThreadJob> collection = jobMap.values() ; + for(MyThreadJob job : collection){ + if(!job.isOver){ + notOverCount++ ; + pool.putJob(job); } } - } catch (Exception e) { - e.printStackTrace(); + if(notOverCount > 0){ + log.info("褰撳墠杩樻湁" + notOverCount + "鍙癛TU鏈畬鎴愪换鍔�"); + Thread.sleep(ServerProperties.sendInterval * 1000); + }else{ + break ; + } } + } catch (Exception e) { + e.printStackTrace(); } }).start(); } -- Gitblit v1.8.0