From a9bef83948da0f2008cb4bec6c97241bc53838f4 Mon Sep 17 00:00:00 2001 From: Robert Macaulay Date: Fri, 22 Nov 2019 11:18:13 -0600 Subject: [PATCH] Reduce exception construction This was creating the exception regardless of whether it needed it or not. This uses the supplier interface to just construct it if needed --- .../hotels/styx/client/connectionpool/SimpleConnectionPool.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/client/src/main/java/com/hotels/styx/client/connectionpool/SimpleConnectionPool.java b/components/client/src/main/java/com/hotels/styx/client/connectionpool/SimpleConnectionPool.java index 4239249039..314ebfbbcd 100644 --- a/components/client/src/main/java/com/hotels/styx/client/connectionpool/SimpleConnectionPool.java +++ b/components/client/src/main/java/com/hotels/styx/client/connectionpool/SimpleConnectionPool.java @@ -91,7 +91,7 @@ public Publisher borrowConnection() { } }).timeout( Duration.ofMillis(poolSettings.pendingConnectionTimeoutMillis()), - Mono.error(new MaxPendingConnectionTimeoutException(origin, connectionSettings.connectTimeoutMillis()))); + Mono.error(() -> new MaxPendingConnectionTimeoutException(origin, connectionSettings.connectTimeoutMillis()))); } private void newConnection() {