mirror of
https://github.com/elastic/logstash.git
synced 2025-04-25 07:07:54 -04:00
replace decreasing timeout with fixed timeout
This commit is contained in:
parent
9525a806d7
commit
75b360f2ff
1 changed files with 1 additions and 2 deletions
|
@ -77,13 +77,12 @@ public final class LsQueueUtils {
|
||||||
private static int drain(final BlockingQueue<JrubyEventExtLibrary.RubyEvent> queue,
|
private static int drain(final BlockingQueue<JrubyEventExtLibrary.RubyEvent> queue,
|
||||||
final Collection<JrubyEventExtLibrary.RubyEvent> collection, final int count,
|
final Collection<JrubyEventExtLibrary.RubyEvent> collection, final int count,
|
||||||
final long nanos) throws InterruptedException {
|
final long nanos) throws InterruptedException {
|
||||||
final long deadline = System.nanoTime() + nanos;
|
|
||||||
int added = 0;
|
int added = 0;
|
||||||
do {
|
do {
|
||||||
added += queue.drainTo(collection, count - added);
|
added += queue.drainTo(collection, count - added);
|
||||||
if (added < count) {
|
if (added < count) {
|
||||||
final JrubyEventExtLibrary.RubyEvent event =
|
final JrubyEventExtLibrary.RubyEvent event =
|
||||||
queue.poll(deadline - System.nanoTime(), TimeUnit.NANOSECONDS);
|
queue.poll(nanos, TimeUnit.NANOSECONDS);
|
||||||
if (event == null) {
|
if (event == null) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue