aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephane Gamard <stephane.gamard@searchbox.com>2014-05-02 16:23:04 +0200
committerStephane Gamard <stephane.gamard@searchbox.com>2014-05-02 19:47:58 +0200
commit6fcca8cfa9e4d87cc5bc729ce4b84ef84081bd0c (patch)
treefd9bd4a819c8e77fa85adb9b1fe97983fcf500a3
parenta9de40dcab992729d8dc697d276e8e61f115727f (diff)
downloadsonarqube-6fcca8cfa9e4d87cc5bc729ce4b84ef84081bd0c.tar.gz
sonarqube-6fcca8cfa9e4d87cc5bc729ce4b84ef84081bd0c.zip
Added a timeout on Latch for synched ClusterAction
-rw-r--r--sonar-server/src/main/java/org/sonar/server/cluster/LocalNonBlockingWorkQueue.java13
1 files changed, 4 insertions, 9 deletions
diff --git a/sonar-server/src/main/java/org/sonar/server/cluster/LocalNonBlockingWorkQueue.java b/sonar-server/src/main/java/org/sonar/server/cluster/LocalNonBlockingWorkQueue.java
index c11204912c7..e979b43ec82 100644
--- a/sonar-server/src/main/java/org/sonar/server/cluster/LocalNonBlockingWorkQueue.java
+++ b/sonar-server/src/main/java/org/sonar/server/cluster/LocalNonBlockingWorkQueue.java
@@ -19,9 +19,6 @@
*/
package org.sonar.server.cluster;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
import org.sonar.api.ServerComponent;
import org.sonar.core.cluster.QueueAction;
import org.sonar.core.cluster.WorkQueue;
@@ -34,8 +31,6 @@ import java.util.concurrent.TimeUnit;
public class LocalNonBlockingWorkQueue extends LinkedBlockingQueue<Runnable>
implements ServerComponent, WorkQueue {
- private static final Logger LOG = LoggerFactory.getLogger(LocalNonBlockingWorkQueue.class);
-
public LocalNonBlockingWorkQueue() {
super();
}
@@ -46,9 +41,9 @@ public class LocalNonBlockingWorkQueue extends LinkedBlockingQueue<Runnable>
action.setLatch(latch);
try {
this.offer(action, 1000, TimeUnit.SECONDS);
- latch.await();
+ latch.await(1500, TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
- LOG.error("ES update has been interrupted: {}", e.getMessage());
+ throw new IllegalStateException("ES update has been interrupted: ");
}
}
@@ -60,9 +55,9 @@ public class LocalNonBlockingWorkQueue extends LinkedBlockingQueue<Runnable>
action.setLatch(latch);
this.offer(action, 1000, TimeUnit.SECONDS);
}
- latch.await();
+ latch.await(1500, TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
- LOG.error("ES update has been interrupted: {}", e.getMessage());
+ throw new IllegalStateException("ES update has been interrupted: ");
}
}
}