NIFI-2268: Instead of allowing HandleHttpRequest to run constantly calling BlockingQueue.poll() as fast as possible, call BlockingQueue.poll(2, TimeUnit.MILLISECONDS) to avoid overutilization of CPU when there is no work to be done

This closes #1762.

Signed-off-by: Bryan Bende <bbende@apache.org>
This commit is contained in:
Mark Payne 2017-05-05 13:43:17 -04:00 committed by Bryan Bende
parent e6be5d3276
commit 12249e5a08
No known key found for this signature in database
GPG Key ID: A0DDA9ED50711C39
1 changed files with 8 additions and 1 deletions

View File

@ -484,7 +484,14 @@ public class HandleHttpRequest extends AbstractProcessor {
throw new ProcessException("Failed to initialize the server",e);
}
final HttpRequestContainer container = containerQueue.poll();
HttpRequestContainer container;
try {
container = containerQueue.poll(2, TimeUnit.MILLISECONDS);
} catch (final InterruptedException e1) {
Thread.currentThread().interrupt();
return;
}
if (container == null) {
return;
}