private void rebuildProducerCache ( Collection < IStatsProducer > producers ) { log . debug ( "Rebuilding producer cache with " + producers . size ( ) + " producers." ) ; log . debug ( "Following producers known: " + producers ) ; synchronized ( cacheLock ) { //lets create lists with more place to store as actually need, we will probably need it. final int approxSize = ( int ) ( producers . size ( ) * 1.5 ) ; _cachedProducerList = new ArrayList < ProducerReference > ( approxSize ) ; _cachedProducerMap = new HashMap < String , ProducerReference > ( approxSize ) ; for ( IStatsProducer sp : producers ) { final ProducerReference reference = new ProducerReference ( sp ) ; _cachedProducerList . add ( reference ) ; _cachedProducerMap . put ( sp . getProducerId ( ) , reference ) ; } } if ( log . isDebugEnabled ( ) ) { log . debug ( "Cachedproducer list contains " + _cachedProducerList . size ( ) + " producers: " ) ; log . debug ( String . valueOf ( _cachedProducerList ) ) ; log . debug ( "Cached producer map contains: " + _cachedProducerMap . size ( ) + " producers" ) ; log . debug ( String . valueOf ( _cachedProducerMap ) ) ; } }
Rebuilds the caches with given producers ..