From 223bddfabc955b8aea8f4a5cddb7efc7fcff3b4f Mon Sep 17 00:00:00 2001 From: Santiago Pericasgeertsen Date: Tue, 14 Nov 2023 14:05:39 -0500 Subject: [PATCH] Optimize single provider case. Signed-off-by: Santiago Pericasgeertsen --- .../main/java/io/helidon/webserver/ConnectionHandler.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/webserver/webserver/src/main/java/io/helidon/webserver/ConnectionHandler.java b/webserver/webserver/src/main/java/io/helidon/webserver/ConnectionHandler.java index c4bb7ab11b0..673b2861b42 100644 --- a/webserver/webserver/src/main/java/io/helidon/webserver/ConnectionHandler.java +++ b/webserver/webserver/src/main/java/io/helidon/webserver/ConnectionHandler.java @@ -227,6 +227,11 @@ public Router router() { } private ServerConnection identifyConnection() { + // if just one candidate, take a chance with it + if (providerCandidates.size() == 1) { + return providerCandidates.getFirst().connection(this); + } + try { reader.ensureAvailable(); } catch (DataReader.InsufficientDataAvailableException e) {