src/java/org/apache/cassandra/service/StorageService.java
/**
     * Used to request ranges from endpoints in the ring (will block until all data is fetched and ready)
     * @param ranges ranges to fetch as map of the preferred address and range collection
     * @return latch to count down
     */
Used to request ranges from endpoints in the ring (will block until all data is fetched and ready)
@param ranges ranges to fetch as map of the preferred address and range collection
@return latch to count down
Used to request ranges from endpoints in the ring ( will block until all data is fetched and ready ) @param ranges ranges to fetch as map of the preferred address and range collection @return latch to count down
private CountDownLatch requestRanges(final Map<String, Multimap<InetAddress, Range<Token>>> ranges)
    {
        final CountDownLatch latch = new CountDownLatch(ranges.keySet().size());
        for (final String table : ranges.keySet())
        {
            Multimap<InetAddress, Range<Token>> endpointWithRanges = ranges.get(table);
            if (endpointWithRanges.isEmpty())
            {
                latch.countDown();
                continue;
            }
            final Set<InetAddress> pending = new HashSet<InetAddress>(endpointWithRanges.keySet());
            for (final InetAddress source: endpointWithRanges.keySet())
            {
                Collection<Range<Token>> toFetch = endpointWithRanges.get(source);
                final Runnable callback = new Runnable()
                {
                    @Override
                    public void run()
                    {
                        pending.remove(source);
                        if (pending.isEmpty())
                            latch.countDown();
                    }
                };
                if (logger_.isDebugEnabled())
                    logger_.debug("Requesting from " + source + " ranges " + StringUtils.join(toFetch, ", "));
                StreamIn.requestRanges(source, table, toFetch, callback, OperationType.BOOTSTRAP);
            }
        }
        return latch;
    }
private CountDownLatch requestRanges ( final Map < String , Multimap < InetAddress , Range < Token > > > ranges ) { final CountDownLatch latch = new CountDownLatch ( ranges . keySet ( ) . size ( ) ) ; for ( final String table : ranges . keySet ( ) ) { Multimap < InetAddress , Range < Token > > endpointWithRanges = ranges . get ( table ) ; if ( endpointWithRanges . isEmpty ( ) ) { latch . countDown ( ) ; continue ; } final Set < InetAddress > pending = new HashSet < InetAddress > ( endpointWithRanges . keySet ( ) ) ; for ( final InetAddress source : endpointWithRanges . keySet ( ) ) { Collection < Range < Token > > toFetch = endpointWithRanges . get ( source ) ; final Runnable callback = new Runnable ( ) { @ Override public void run ( ) { pending . remove ( source ) ; if ( pending . isEmpty ( ) ) latch . countDown ( ) ; } } ; if ( logger_ . isDebugEnabled ( ) ) logger_ . debug ( "Requesting from " + source + " ranges " + StringUtils . join ( toFetch , ", " ) ) ; StreamIn . requestRanges ( source , table , toFetch , callback , OperationType . BOOTSTRAP ) ; } } return latch ; }
Used to request ranges from endpoints in the ring (will block until all data is fetched and ready)
 @param ranges ranges to fetch as map of the preferred address and range collection
 @return latch to count down
Used to request ranges from endpoints in the ring ( will block until all data is fetched and ready ) @param ranges ranges to fetch as map of the preferred address and range collection @return latch to count down
// Send messages to respective folks to stream data over to me // sending actual request