public static boolean applyFilters ( Object event , Set < EventFilter > filters , StatsTimer filterStats , String invokerDesc , Logger logger ) { if ( filters . isEmpty ( ) ) { return true ; } Stopwatch filterStart = filterStats . start ( ) ; try { for ( EventFilter filter : filters ) { if ( ! filter . apply ( event ) ) { logger . debug ( "Event: " + event + " filtered out for : " + invokerDesc + " due to the filter: " + filter ) ; return false ; } } return true ; } finally { filterStart . stop ( ) ; } }
Utility method to apply filters for an event this can be used both by publisher & subscriber code .