hxb
2022-03-27 cc6023291bc94a229b53d7c2d83bf2b39bbfa9a0
HDLSDK/hdl-connect/src/main/java/com/hdl/sdk/connect/HDLLink.java
@@ -23,26 +23,20 @@
    /**
     * instance
     */
    private volatile static HDLLink instance;
    private  static final HDLLink instance=new HDLLink();
    /**
     * getInstance
     *
     * @return HDLLink
     */
    public static synchronized HDLLink getInstance() {
        if (instance == null) {
            synchronized (HDLLink.class) {
                if (instance == null) {
                    instance = new HDLLink();
//                    ThreadToolUtils.getInstance().newScheduledThreadPool(1).scheduleWithFixedDelay(new Runnable() {
//                        @Override
//                        public void run() {
////定期搜索网关,后面看有必要再做
//                        }
//                    },0,10, TimeUnit.SECONDS);
                }
            }
        }
    public static  HDLLink getInstance() {
//        if (instance == null) {
//            synchronized (HDLLink.class) {
//                if (instance == null) {
//                    instance = new HDLLink();
//                }
//            }
//        }
        return instance;
    }
@@ -215,6 +209,7 @@
     * @param callBack 回调
     */
    public void tcpSendMsg(String topic, String bodyStr, HDLLinkCallBack callBack) {
        HDLAuthSocket.getInstance();//通过这个可以先初始化UDP监听事件
        HDLSocket.getInstance().tcpSendMsg(topic, bodyStr, callBack);
    }
@@ -245,6 +240,7 @@
     * @param bodyStr  回复的主题
     */
    public void tcpSendMsg(String topic, String bodyStr) {
        HDLAuthSocket.getInstance();//通过这个可以先初始化UDP监听事件
        HDLSocket.getInstance().tcpSendMsg(topic, bodyStr);
    }
}