public static ProducerSnapshot createSnapshot ( IStatsProducer producer , String intervalName ) { ProducerSnapshot ret = new ProducerSnapshot ( ) ; ret . setCategory ( producer . getCategory ( ) ) ; ret . setSubsystem ( producer . getSubsystem ( ) ) ; ret . setProducerId ( producer . getProducerId ( ) ) ; ret . setIntervalName ( intervalName ) ; List < IStats > stats = producer . getStats ( ) ; if ( stats != null && stats . size ( ) > 0 ) ret . setStatClassName ( stats . get ( 0 ) . getClass ( ) . getName ( ) ) ; //optimization if ( stats == null || stats . size ( ) == 0 ) return ret ; List < String > cachedValueNames = stats . get ( 0 ) . getAvailableValueNames ( ) ; for ( IStats stat : stats ) { ret . addSnapshot ( createStatSnapshot ( stat , intervalName , cachedValueNames ) ) ; } return ret ; }
Creates a snapshot for a producer .