public List < RollupInterval > getRollupInterval ( final long interval , final String str_interval ) { if ( interval <= 0 ) { throw new IllegalArgumentException ( "Interval cannot be null or empty" ) ; } final Map < Long , RollupInterval > rollups = new TreeMap < Long , RollupInterval > ( Collections . reverseOrder ( ) ) ; boolean right_match = false ; for ( RollupInterval rollup : forward_intervals . values ( ) ) { if ( rollup . getIntervalSeconds ( ) == interval ) { rollups . put ( ( long ) rollup . getIntervalSeconds ( ) , rollup ) ; right_match = true ; } else if ( interval % rollup . getIntervalSeconds ( ) == 0 ) { rollups . put ( ( long ) rollup . getIntervalSeconds ( ) , rollup ) ; } } if ( rollups . isEmpty ( ) ) { throw new NoSuchRollupForIntervalException ( Long . toString ( interval ) ) ; } List < RollupInterval > best_matches = new ArrayList < RollupInterval > ( rollups . values ( ) ) ; if ( ! right_match ) { LOG . warn ( "No such rollup interval found, " + str_interval + ". So falling " + "back to the next best match " + best_matches . get ( 0 ) . getInterval ( ) ) ; } return best_matches ; }
Fetches the RollupInterval corresponding to the integer interval in seconds . It returns a list of matching RollupInterval and best next matches in the order . It will help to search on the next best rollup tables . It is guaranteed that it return a non - empty list For example if the interval is 1 day then it may return RollupInterval objects in the order 1 day 1 hour 10 minutes 1 minute