protected LoadStatisticsSnapshot computeSnapshot ( Iterable < Queue . BuildableItem > queue ) { final LoadStatisticsSnapshot . Builder builder = LoadStatisticsSnapshot . builder ( ) ; final Iterable < Node > nodes = getNodes ( ) ; if ( nodes != null ) { for ( Node node : nodes ) { builder . with ( node ) ; } } int q = 0 ; if ( queue != null ) { for ( Queue . BuildableItem item : queue ) { for ( SubTask st : item . task . getSubTasks ( ) ) { if ( matches ( item , st ) ) q ++ ; } } } return builder . withQueueLength ( q ) . build ( ) ; }
Computes the self - consistent snapshot with the specified queue items .