public synchronized static boolean isBlacklisted ( String ip ) { if ( blacklistCache == null || blacklistCache . isEmpty ( ) ) { blacklistCache = new HashSet <> ( ) ; for ( IBlackListProvider provider : BLACKLIST_PROVIDERS ) { try { blacklistCache . addAll ( provider . getIPs ( ) ) ; } catch ( IOException e ) { LOGGER . warn ( "Error fetching blacklist records" , e ) ; } } } return blacklistCache . contains ( ip ) ; }
Check if the IP is in a blacklist