This commit is contained in:
cheney
2022-07-22 21:11:23 +08:00
parent cb0d4e6e9f
commit 63c663a88f
12 changed files with 77 additions and 25 deletions
+26 -8
View File
@@ -3,7 +3,9 @@ package sample;
import com.sunyard.proto.Util;
import com.sunyard.sge.database.*;
import com.sunyard.sge.database.Consts;
import com.sunyard.sge.log.LogFactory;
import org.junit.Assert;
import org.slf4j.Logger;
import java.nio.ByteBuffer;
import java.util.ArrayList;
@@ -13,16 +15,30 @@ public class Sample
{
public static void main(String[] args) {
System.setProperty("com.sunyard.sydapi4j.debug", "true");
// 路径要以 / 或 \\ 结尾表示目录
SydApi.SYD_SetLogConfig("./logs/", Consts.LogLevelDebug );
SydApi api = new SydApi4Database();
Logger log = LogFactory.getLogger();
log.info("start");
// 通常单例就够了
SydApiBuilder builder = new SydApiBuilder(
new String[]{ "192.168.0.200" },
new int[]{ 8889 },
10,
15
);
// 每个工作线程中调用
SydApi api = builder.build();
try {
api = api.SYD_Connect_Ex(
new String[]{ "192.168.0.200" },
new int[]{ 8889 },
10,
15
);
// 不建议使用了
// api = api.SYD_Connect_Ex(
// new String[]{ "192.168.0.200" },
// new int[]{ 8889 },
// 10,
// 15
// );
// 短数据加密解密
@@ -54,6 +70,8 @@ public class Sample
if ( null != api ) {
api.SYD_Disconnect_Ex();
}
System.out.println("all over");
log.info("all over");
}
}