private NotificationResponse doFetch(List<String> feedUrls, String username) {

        final List<NotificationCategory> categories = new ArrayList<>();
        final List<NotificationError> errors = new ArrayList<>();

        for (String item : feedUrls) {

            // It's okay to pull a response from cache, if we have one, since refresh happens in invoke()
            final Element m = cache.get(item);
            if (m != null) {
                // ## CACHE HIT ##
                if (logger.isDebugEnabled()) {
                    logger.debug("Feed cache HIT for url:  " + item);
                }
                final NotificationCategory category = (NotificationCategory) m.getObjectValue();
                categories.add(category);
            } else {
                // ## CACHE MISS ##
                if (logger.isDebugEnabled()) {
                    logger.debug("Feed cache MISS for url:  " + item);
                    logger.debug("Checking the following feed URL for notifications for user '"
                            + username + "' -- " + item);
                }
                final NotificationCategory category = fetchFromSourceUrl(item);
                if (category != null) {
                    cache.put(new Element(item, category));
                    categories.add(category);
                } else {
                    final NotificationError error = new NotificationError();
                    error.setError("Service Unavailable");
                    error.setSource(getName());
                    errors.add(error);
                }
            }

        }

        final NotificationResponse rslt = new NotificationResponse();
        rslt.setCategories(categories);
        rslt.setErrors(errors);
        return rslt;

    }
private NotificationResponse doFetch ( List < String > feedUrls , String username ) { final List < NotificationCategory > categories = new ArrayList < > ( ) ; final List < NotificationError > errors = new ArrayList < > ( ) ; for ( String item : feedUrls ) { final Element m = cache . get ( item ) ; if ( m != null ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Feed cache HIT for url:  " + item ) ; } final NotificationCategory category = ( NotificationCategory ) m . getObjectValue ( ) ; categories . add ( category ) ; } else { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Feed cache MISS for url:  " + item ) ; logger . debug ( "Checking the following feed URL for notifications for user '" + username + "' -- " + item ) ; } final NotificationCategory category = fetchFromSourceUrl ( item ) ; if ( category != null ) { cache . put ( new Element ( item , category ) ) ; categories . add ( category ) ; } else { final NotificationError error = new NotificationError ( ) ; error . setError ( "Service Unavailable" ) ; error . setSource ( getName ( ) ) ; errors . add ( error ) ; } } } final NotificationResponse rslt = new NotificationResponse ( ) ; rslt . setCategories ( categories ) ; rslt . setErrors ( errors ) ; return rslt ; }
/*
Implementation