src/java/org/apache/cassandra/net/MessagingService.java
/**
     * Stream a file from source to destination. This is highly optimized
     * to not hold any of the contents of the file in memory.
     * @param header Header contains file to stream and other metadata.
     * @param to endpoint to which we need to stream the file.
    */
Stream a file from source to destination. This is highly optimized
to not hold any of the contents of the file in memory.
@param header Header contains file to stream and other metadata.
@param to endpoint to which we need to stream the file.
Stream a file from source to destination . This is highly optimized to not hold any of the contents of the file in memory . @param header Header contains file to stream and other metadata . @param to endpoint to which we need to stream the file .
public void stream(StreamHeader header, InetAddress to)
    {
        DebuggableThreadPoolExecutor executor = streamExecutors.get(to);
        if (executor == null)
        {
            executor = new DebuggableThreadPoolExecutor(0,
                                                        1,
                                                        1,
                                                        TimeUnit.SECONDS,
                                                        new LinkedBlockingQueue<Runnable>(),
                                                        new NamedThreadFactory("Streaming to " + to));
            DebuggableThreadPoolExecutor old = streamExecutors.putIfAbsent(to, executor);
            if (old != null)
            {
                executor.shutdown();
                executor = old;
            }
        }
        executor.execute(new FileStreamTask(header, to));
    }
public void stream ( StreamHeader header , InetAddress to ) { DebuggableThreadPoolExecutor executor = streamExecutors . get ( to ) ; if ( executor == null ) { executor = new DebuggableThreadPoolExecutor ( 0 , 1 , 1 , TimeUnit . SECONDS , new LinkedBlockingQueue < Runnable > ( ) , new NamedThreadFactory ( "Streaming to " + to ) ) ; DebuggableThreadPoolExecutor old = streamExecutors . putIfAbsent ( to , executor ) ; if ( old != null ) { executor . shutdown ( ) ; executor = old ; } } executor . execute ( new FileStreamTask ( header , to ) ) ; }
Stream a file from source to destination.
Stream a file from source to destination .
// Using a core pool size of 0 is important. See documentation of streamExecutors.