| | |
| | | } |
| | | |
| | | /** |
| | | * 统计在线用户数 |
| | | */ |
| | | public int countOnlineUsers() { |
| | | Set<String> keys = redisTemplate.keys(RedisCacheKey.signUserKey("*")); |
| | | |
| | | return null == keys ? 0 : keys.size(); |
| | | } |
| | | |
| | | /** |
| | | * 查询服务资源状态 |
| | | */ |
| | | public List<ResEntity> selectResStatus() { |
| | |
| | | return testResStatus(resList); |
| | | } |
| | | |
| | | /** |
| | | * 测试资源状态 |
| | | */ |
| | | private List<ResEntity> testResStatus(List<ResEntity> resList) { |
| | | List<ResEntity> list = new ArrayList<ResEntity>(); |
| | | for (ResEntity re : resList) { |
| | |
| | | // Ping通地址 |
| | | socket.connect(add, 2000); |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage()); |
| | | // log.error(e.getMessage()) |
| | | list.add(re); |
| | | } finally { |
| | | try { |