]> source.dussan.org Git - sonarqube.git/commitdiff
Fix thread cleanup on errors in BulkIndexer
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Thu, 18 Dec 2014 17:06:53 +0000 (18:06 +0100)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Thu, 18 Dec 2014 17:39:28 +0000 (18:39 +0100)
server/sonar-server/src/main/java/org/sonar/server/es/BulkIndexer.java

index a1af20bc681a138d3e31139fd8f86a213a463ea6..21ed0c37e41d055bd803b9a88f7d248910b28f1d 100644 (file)
@@ -136,12 +136,14 @@ public class BulkIndexer implements Startable {
 
   @Override
   public void stop() {
-    if (bulkRequest.numberOfActions() > 0) {
-      executeBulk(bulkRequest);
+    try {
+      if (bulkRequest.numberOfActions() > 0) {
+        executeBulk(bulkRequest);
+      }
+    } finally {
+      progress.stop();
     }
 
-    progress.stop();
-
     if (refresh) {
       client.prepareRefresh(indexName).get();
     }