diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2022-02-16 21:54:34 +0100 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2022-02-16 21:54:34 +0100 |
commit | aebde18f6bf8165d6e93a6b8041b01c69596931f (patch) | |
tree | ebf6cdace8cfe4420a5df0bddb40962841e45974 /config/src/main | |
parent | 0f50c99c8a87a3c476327231ca0ad99c40ec3ba1 (diff) |
If the queue is empty, avoid an extra poll which will do both an extra time conversion and take a lock.
Diffstat (limited to 'config/src/main')
-rw-r--r-- | config/src/main/java/com/yahoo/config/subscription/impl/JRTConfigSubscription.java | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/config/src/main/java/com/yahoo/config/subscription/impl/JRTConfigSubscription.java b/config/src/main/java/com/yahoo/config/subscription/impl/JRTConfigSubscription.java index a18f1b4b260..90c538ac19b 100644 --- a/config/src/main/java/com/yahoo/config/subscription/impl/JRTConfigSubscription.java +++ b/config/src/main/java/com/yahoo/config/subscription/impl/JRTConfigSubscription.java @@ -72,12 +72,12 @@ public class JRTConfigSubscription<T extends ConfigInstance> extends ConfigSubsc JRTClientConfigRequest response = pollQueue(timeoutMillis); // There might be more than one response on the queue, so empty queue by polling with // 0 timeout until queue is empty (returned value is null) - JRTClientConfigRequest temp; - do { + JRTClientConfigRequest temp = response; + while (temp != null) { temp = pollQueue(0); if (temp != null) response = temp; - } while (temp != null); + } return response; } |