public ConcurrentMap<UserKey, User> getAllUsers(String region) throws Exception { ConcurrentMap<UserKey, User> users = new ConcurrentHashMap<>(); try (Connection connection = ds.getConnection(); PreparedStatement statement = connection.prepareStatement(selectAllUsers)) { statement.setString(1, region); try (ResultSet rs = statement.executeQuery()) { while (rs.next()) { User user = new User( rs.getString("email"), rs.getString("pass"), rs.getString("appName"), rs.getString("region"), rs.getString("ip"), rs.getBoolean("is_facebook_user"), rs.getBoolean("is_super_admin"), rs.getString("name"), getTs(rs, "last_modified"), getTs(rs, "last_logged"), rs.getString("last_logged_ip"), JsonParser.parseProfileFromString(rs.getString("json")), rs.getInt("energy") ); users.put(new UserKey(user), user); } connection.commit(); } } log.info("Loaded {} users.", users.size()); return users; }