| | |
| | | } |
| | | |
| | | // log.info("acceptorThread is end:{}", sb.toString()); |
| | | JSONObject result = JSON.parseObject(sb.toString()); |
| | | JSONObject result = null; |
| | | try { |
| | | result = JSON.parseObject(sb.toString()); |
| | | }catch (Exception e) { |
| | | log.error("error body:{}", sb.toString()); |
| | | e.printStackTrace(); |
| | | } |
| | | if(result == null){ |
| | | continue; |
| | | } |
| | |
| | | continue; |
| | | } |
| | | |
| | | NyShuttleThread shuttleThread = (NyShuttleThread) SlaveConnection.get(SlaveType.Shuttle, device.getDeviceNo()); |
| | | if (shuttleThread == null) { |
| | | // init |
| | | NyShuttleThread thread = new NyShuttleThread(device, redisUtil);; |
| | | new Thread(thread).start(); |
| | | SlaveConnection.put(SlaveType.Shuttle, device.getDeviceNo(), thread); |
| | | }else { |
| | | Socket socket = shuttleThread.getSocket(); |
| | | if(socket == null){ |
| | | continue; |
| | | } |
| | | } |
| | | |
| | | log.info("{}:device is run,devices:{}", device.getDeviceNo(),JSON.toJSONString(fakeServerMap)); |
| | | |
| | | Thread fakeThread = new Thread(() -> { |
| | |
| | | fakeThread.start(); |
| | | fakeThreadMap.put(String.valueOf(SlaveType.Shuttle) + device.getDeviceNo(), fakeThread); |
| | | |
| | | // init |
| | | ThreadHandler thread = new NyShuttleThread(device, redisUtil);; |
| | | new Thread(thread).start(); |
| | | SlaveConnection.put(SlaveType.Shuttle, device.getDeviceNo(), thread); |
| | | try { |
| | | Thread.sleep(2000); |
| | | }catch (Exception e){} |
| | | } |
| | | } |
| | | |