private static void updateJobOverview ( File webOverviewDir , File webDir ) { try ( JsonGenerator gen = jacksonFactory . createGenerator ( HistoryServer . createOrGetFile ( webDir , JobsOverviewHeaders . URL ) ) ) { File [ ] overviews = new File ( webOverviewDir . getPath ( ) ) . listFiles ( ) ; if ( overviews != null ) { Collection < JobDetails > allJobs = new ArrayList <> ( overviews . length ) ; for ( File overview : overviews ) { MultipleJobsDetails subJobs = mapper . readValue ( overview , MultipleJobsDetails . class ) ; allJobs . addAll ( subJobs . getJobs ( ) ) ; } mapper . writeValue ( gen , new MultipleJobsDetails ( allJobs ) ) ; } } catch ( IOException ioe ) { LOG . error ( "Failed to update job overview." , ioe ) ; } }
This method replicates the JSON response that would be given by the JobsOverviewHandler when listing both running and finished jobs .