protected void loadWaterMarks ( File waterMarksFile ) throws IOException { Properties p = new Properties ( ) ; FileInputStream fis = new FileInputStream ( waterMarksFile ) ; logger . info ( "Loading " + waterMarksFile ) ; try { p . load ( fis ) ; Enumeration < ? > enm = p . propertyNames ( ) ; while ( enm . hasMoreElements ( ) ) { String source = ( String ) enm . nextElement ( ) ; String waterMarks = p . getProperty ( source ) ; String [ ] parts = waterMarks . split ( "," ) ; if ( parts . length == 2 ) { long lwmScn = Long . parseLong ( parts [ 0 ] . trim ( ) ) ; long hwmScn = Long . parseLong ( parts [ 1 ] . trim ( ) ) ; // Make sure that hwmScn and lwmScn are always equal when loaded if ( hwmScn < lwmScn ) { lwmScn = hwmScn ; } else { hwmScn = lwmScn ; } WaterMarkEntry wmEntry = sourceWaterMarkMap . get ( source ) ; if ( wmEntry == null ) { wmEntry = new WaterMarkEntry ( source ) ; sourceWaterMarkMap . put ( source , wmEntry ) ; } wmEntry . setLWMScn ( lwmScn ) ; wmEntry . setHWMScn ( hwmScn ) ; } } } catch ( IOException e ) { logger . error ( "Failed to load source water marks from " + waterMarksFile . getName ( ) , e ) ; throw e ; } finally { fis . close ( ) ; fis = null ; } }
Load water marks from an underlying file .