private void handleSuspectSegmentsBeforeStream ( Object requestId , SegmentListener listener , IntSet segments ) { LocalizedCacheTopology topology = dm . getCacheTopology ( ) ; if ( trace ) { log . tracef ( "Topology for supplier is %s for id %s" , topology , requestId ) ; } ConsistentHash readCH = topology . getCurrentCH ( ) ; ConsistentHash pendingCH = topology . getPendingCH ( ) ; if ( pendingCH != null ) { IntSet lostSegments = IntSets . mutableEmptySet ( topology . getCurrentCH ( ) . getNumSegments ( ) ) ; PrimitiveIterator . OfInt iterator = segments . iterator ( ) ; while ( iterator . hasNext ( ) ) { int segment = iterator . nextInt ( ) ; // If the segment is not owned by both CHs we can't use it during rehash if ( ! pendingCH . isSegmentLocalToNode ( localAddress , segment ) || ! readCH . isSegmentLocalToNode ( localAddress , segment ) ) { iterator . remove ( ) ; lostSegments . set ( segment ) ; } } if ( ! lostSegments . isEmpty ( ) ) { if ( trace ) { log . tracef ( "Lost segments %s during rehash for id %s" , lostSegments , requestId ) ; } listener . lostSegments ( lostSegments ) ; } else if ( trace ) { log . tracef ( "Currently in the middle of a rehash for id %s" , requestId ) ; } } else { IntSet ourSegments = topology . getLocalReadSegments ( ) ; if ( segments . retainAll ( ourSegments ) ) { if ( trace ) { log . tracef ( "We found to be missing some segments requested for id %s" , requestId ) ; } listener . localSegments ( ourSegments ) ; } else if ( trace ) { log . tracef ( "Hash %s for id %s" , readCH , requestId ) ; } } }
that we allow backup owners to respond even though it was thought to be a primary owner .