| | |
| | | * 查询服务资源状态 |
| | | */ |
| | | public List<ResEntity> selectResStatus() { |
| | | List<ResEntity> resList = resService.selectResAll(); |
| | | List<ResEntity> resList = resService.selectAll(); |
| | | |
| | | return testResStatus(resList); |
| | | } |
| | |
| | | for (ResEntity re : resList) { |
| | | Socket socket = new Socket(); |
| | | try { |
| | | if (StringHelper.isEmpty(re.getServer())) { |
| | | if (StringHelper.isEmpty(re.getUrl())) { |
| | | list.add(re); |
| | | continue; |
| | | } |
| | | |
| | | URI uri = new URI(re.getServer()); |
| | | URI uri = new URI(re.getUrl()); |
| | | SocketAddress add = new InetSocketAddress(uri.getHost(), uri.getPort() == -1 ? 80 : uri.getPort()); |
| | | |
| | | // Ping通地址 |
| | | socket.connect(add, 2000); |
| | | socket.connect(add, 1500); |
| | | } catch (Exception e) { |
| | | // log.error(e.getMessage()) |
| | | list.add(re); |
| | |
| | | * 统计服务资源状态 |
| | | */ |
| | | public JSONObject countResStatus() { |
| | | List<ResEntity> resList = resService.selectResAll(); |
| | | List<ResEntity> resList = resService.selectAll(); |
| | | List<ResEntity> unableList = testResStatus(resList); |
| | | |
| | | JSONObject jsonObject = new JSONObject(); |