public void cancelSegments ( IntSet cancelledSegments ) { if ( segments . removeAll ( cancelledSegments ) ) { if ( trace ) { log . tracef ( "Cancelling outbound transfer to node %s, segments %s (remaining segments %s)" , destination , cancelledSegments , segments ) ; } entriesBySegment . keySet ( ) . removeAll ( cancelledSegments ) ; // here we do not update accumulatedEntries but this inaccuracy does not cause any harm if ( segments . isEmpty ( ) ) { cancel ( ) ; } } }
Cancel some of the segments . If all segments get cancelled then the whole task will be cancelled .