This commit is contained in:
junj2.liang
2022-09-13 15:57:21 +08:00
parent 53c1e93115
commit 4e2f6b3ac4
5 changed files with 79 additions and 52 deletions
-50
View File
@@ -1,50 +0,0 @@
package sample;
import com.sunyard.SydApi;
import racal.sunyard.main.SydApi4j;
import racal.sunyard.main.SydApiBuilder;
public class ConnectThread extends Thread {
public SydApi getApi() {
SydApiBuilder builder = new SydApiBuilder().setIp("172.16.18.59");
SydApi4j papi = (SydApi4j) builder.build();
// SydApi4j papi = (SydApi4j) new SydApi4j().connect("172.16.18.59" , 8889, null,1000);
return papi;
}
public static void main(String[] args) {
// logger.info("测试开始");
int n = Runtime.getRuntime().availableProcessors();
int max = 1001;
Thread[] tList = new Thread[max];
for (int i = 0; i < max; i++) {
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
ConnectThread stable = new ConnectThread();
SydApi api = stable.getApi();
try {
// SydApi api = stable.getApi();
} catch (Exception e) {
e.printStackTrace();
}
}
});
tList[i] = thread;
}
for (Thread t : tList) {
t.start();
}
for (Thread t : tList) {
try {
t.join();
} catch (InterruptedException e3) {
e3.printStackTrace();
}
}
}
}
+1 -1
View File
@@ -79,7 +79,7 @@ public class FuncTest {
SydApi api = new SydApi4Database();
try {
for (int j = 0; j < 20; j++) {
api.SYD_Short_Connect_Ex(pcipList,iportList,10,15);
api.SYD_Short_Connect_Ex(pcipList,iportList,50,15);
byte[] bytes = api.SYD_SM4_ShortData(0, (tmp + "t" + j).getBytes(), Consts.ECB_ENC);
byte[] result = api.SYD_SM4_ShortData(0, bytes, Consts.ECB_DEC);
}