public Deque < MutablePair < DeltaType , Object > > pop ( Consumer < Deque < MutablePair < DeltaType , Object > > > func ) throws InterruptedException { lock . writeLock ( ) . lock ( ) ; try { while ( true ) { while ( queue . isEmpty ( ) ) { notEmpty . await ( ) ; } // there should have data now String id = this . queue . removeFirst ( ) ; if ( this . initialPopulationCount > 0 ) { this . initialPopulationCount -- ; } if ( ! this . items . containsKey ( id ) ) { // Item may have been deleted subsequently. continue ; } Deque < MutablePair < DeltaType , Object > > deltas = this . items . get ( id ) ; this . items . remove ( id ) ; func . accept ( deltas ) ; // Don't make any copyDeltas here return deltas ; } } finally { lock . writeLock ( ) . unlock ( ) ; } }
Pop deltas .