static long parseParametersForPollingInterval ( Map < String , String > parameters ) throws JournalException { String intervalString = parameters . get ( PARAMETER_FOLLOW_POLLING_INTERVAL ) ; if ( intervalString == null ) { intervalString = DEFAULT_FOLLOW_POLLING_INTERVAL ; } Pattern p = Pattern . compile ( "([0-9]+)([HM]?)" ) ; Matcher m = p . matcher ( intervalString ) ; if ( ! m . matches ( ) ) { throw new JournalException ( "Parameter '" + PARAMETER_FOLLOW_POLLING_INTERVAL + "' must be an positive integer number of seconds, " + "optionally followed by 'H'(hours), or 'M'(minutes)" ) ; } long interval = Long . parseLong ( m . group ( 1 ) ) * 1000 ; String factor = m . group ( 2 ) ; if ( "H" . equals ( factor ) ) { interval *= 60 * 60 ; } else if ( "M" . equals ( factor ) ) { interval *= 60 ; } return interval ; }
Find the polling interval that we will choose when checking for new journal files to appear .