false,
false,
1
);
bulkShardProcessor.add("foo", new BytesArray("{\"foo\": \"bar1\"}"), "1", null);
verify(transportShardBulkAction).execute(
any(BulkShardRequest.class),
bulkShardResponseListener.capture());
final ActionListener<BulkShardResponse> listener = bulkShardResponseListener.getValue();
listener.onFailure(new EsRejectedExecutionException());
// wait, failure retry lock is done in decoupled thread
Thread.sleep(1);
final ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(2);
final AtomicBoolean hadBlocked = new AtomicBoolean(false);
final AtomicBoolean hasBlocked = new AtomicBoolean(true);
final CountDownLatch latch = new CountDownLatch(1);
scheduledExecutorService.execute(new Runnable() {
@Override
public void run() {
scheduledExecutorService.schedule(new Runnable() {
@Override
public void run() {
hadBlocked.set(hasBlocked.get());
latch.countDown();
}
}, 10, TimeUnit.MILLISECONDS);
bulkShardProcessor.add("foo", new BytesArray("{\"foo\": \"bar2\"}"), "2", null);
hasBlocked.set(false);
}
});
latch.await();
assertTrue(hadBlocked.get());