private PoolStatus _getPoolStatus(PoolConfigurationModel poolConfiguration) { PoolStatus retValue = null; if (poolConfiguration != null) { PoolSettings poolSettings = poolConfiguration.getPoolSettings(); if (poolSettings != null) { retValue = poolManagerApi.getStatus(poolSettings); } } return retValue; }
/** @return poolConfigurationId => poolStatus map. */ @RequestMapping(value = "/admin/pools/status", method = RequestMethod.GET) @ResponseBody public Map<Long, PoolStatus> getPoolsStatus() { Map<Long /* poolConfigurationId */, PoolStatus> resultMap = new HashMap<Long, PoolStatus>(); // get pool status for all pools Collection<PoolStatus> poolStatuses = poolManagerApi.listStatuses(); // map every status found to its pool configuration List<PoolConfigurationModel> poolConfigurationModels = poolDao.readPools(); for (PoolConfigurationModel poolConfiguration : poolConfigurationModels) { Long poolConfigurationId = poolConfiguration.getId(); for (PoolStatus poolStatus : poolStatuses) { if (poolStatus.getPoolId().equals(poolConfiguration.getPoolSettings().getUuid())) { resultMap.put(poolConfigurationId, poolStatus); } } } return resultMap; }