Skip to content

Commit

Permalink
HSEARCH-2179 Release the latch in the finally block
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavonalle authored and Sanne committed Mar 12, 2016
1 parent d40070e commit eaed7ad
Showing 1 changed file with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,19 +136,23 @@ private class Consumer implements Runnable {
@Override
public void run() {
Iterable<Changeset> changesets;
while ( ! stop ) {
changesets = transferQueue.drainToDetachedIterable();
while ( changesets == null && ! stop ) {
// Avoid busy wait
parkCurrentThread();
try {
while ( !stop ) {
changesets = transferQueue.drainToDetachedIterable();
while ( changesets == null && !stop ) {
// Avoid busy wait
parkCurrentThread();
changesets = transferQueue.drainToDetachedIterable();
}
if ( changesets != null ) {
applyChangesets( changesets );
}
}
if ( changesets != null ) {
applyChangesets( changesets );
}
log.stoppingSyncConsumerThread( indexName );
}
finally {
shutdownLatch.countDown();
}
log.stoppingSyncConsumerThread( indexName );
shutdownLatch.countDown();
}

private void applyChangesets(Iterable<Changeset> changesets) {
Expand Down

0 comments on commit eaed7ad

Please sign in to comment.