question: protected void injectStats ( ) throws BaseCollectionException { DbClient client = ( DbClient ) _keyMap . get ( Constants . dbClient ) ; @ SuppressWarnings ( "unchecked" ) List < Stat > stats = ( List < Stat > ) _keyMap . get ( Constants . _Stats ) ; @ SuppressWarnings ( "unchecked" ) Map < String , String > props = ( Map < String , String > ) _keyMap . get ( Constants . PROPS ) ; int size = Constants . DEFAULT_PARTITION_SIZE ; if ( null != props . get ( Constants . METERING_RECORDS_PARTITION_SIZE ) ) { size = Integer . parseInt ( props . get ( Constants . METERING_RECORDS_PARTITION_SIZE ) ) ; } if ( null == _partitionManager ) { Stat [ ] statBatch = new Stat [ stats . size ( ) ] ; statBatch = stats . toArray ( statBatch ) ; try { client . insertTimeSeries ( StatTimeSeries . class , statBatch ) ; _logger . info ( "{} Stat records persisted to DB" , statBatch . length ) ; } catch ( DatabaseException e ) { _logger . error ( "Error inserting records into the database" , e ) ; } } else { _partitionManager . insertInBatches ( stats , size , client ) ; } }
target:  Inject Stats to Cassandra. To-Do: To verify, how fast batch insertion is working for entries in 1000s. If its taking time, then will need to work out, splitting again the batch into smaller batches.