protected void removeExcessiveInProgressTasks(Queue<Exchange> exchanges, int limit) {

        while (exchanges.size() > limit) {
            // must remove last
            Exchange exchange = exchanges.poll();
            releaseTask(exchange);
        }

    }
protected void removeExcessiveInProgressTasks ( Queue < Exchange > exchanges , int limit ) { while ( exchanges . size ( ) > limit ) { Exchange exchange = exchanges . poll ( ) ; releaseTask ( exchange ) ; } }
Drain any in progress files as we are done with this batch

@param exchanges
the exchanges
@param limit
the limit