From 12474e42179051720a23d7c921fd33ce50e9ffab Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@63.com> Date: 星期五, 18 二月 2022 16:16:00 +0800 Subject: [PATCH] # --- src/main/java/com/zy/core/thread/BarcodeThread.java | 23 ++++++++++++----------- 1 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/zy/core/thread/BarcodeThread.java b/src/main/java/com/zy/core/thread/BarcodeThread.java index b34d7d4..b8710a6 100644 --- a/src/main/java/com/zy/core/thread/BarcodeThread.java +++ b/src/main/java/com/zy/core/thread/BarcodeThread.java @@ -43,6 +43,7 @@ String s = new String(read); if (!Cools.isEmpty(s)) { barcode = new String(read); + log.info("{}鍙锋潯鐮佸櫒锛屾绱㈡暟鎹細{}", slave.getId(), this.barcode); } } Thread.sleep(100); @@ -76,18 +77,18 @@ public void close() { try { if (null != dataOutputStream) { - dataOutputStream.close(); - } - if (null != dataInputStream) { - dataInputStream.close(); - } + dataOutputStream.close(); + } + if (null != dataInputStream) { + dataInputStream.close(); + } // if (null != socket && !socket.isClosed()) { // socket.close(); // } - if (null != socket){ - socket.close(); - } - socket = null; + if (null != socket){ + socket.close(); + } + socket = null; } catch (IOException e) { log.error("SocketClient close Exception:" + e.getMessage()); } @@ -111,8 +112,8 @@ int len = dataInputStream.read(bytes); byte[] tempBytes = null; if (len > 0) { - tempBytes = new byte[len]; - System.arraycopy(bytes, 0, tempBytes, 0, len); + tempBytes = new byte[len]; + System.arraycopy(bytes, 0, tempBytes, 0, len); } return tempBytes; } -- Gitblit v1.9.1