|
13 | 13 |
|
14 | 14 | import io.netty.channel.EventLoop;
|
15 | 15 | import io.vertx.core.*;
|
| 16 | +import io.vertx.core.http.ConnectionPoolTooBusyException; |
16 | 17 | import io.vertx.core.impl.ContextInternal;
|
17 | 18 | import io.vertx.core.impl.EventLoopContext;
|
18 | 19 | import io.vertx.core.impl.VertxInternal;
|
|
22 | 23 | import io.vertx.core.spi.metrics.ClientMetrics;
|
23 | 24 | import io.vertx.core.spi.tracing.VertxTracer;
|
24 | 25 | import io.vertx.core.tracing.TracingPolicy;
|
| 26 | +import io.vertx.sqlclient.DatabaseException; |
25 | 27 | import io.vertx.sqlclient.SqlConnection;
|
26 | 28 | import io.vertx.sqlclient.impl.Connection;
|
27 | 29 | import io.vertx.sqlclient.impl.SqlConnectionBase;
|
|
31 | 33 | import io.vertx.sqlclient.spi.ConnectionFactory;
|
32 | 34 | import io.vertx.sqlclient.spi.DatabaseMetadata;
|
33 | 35 |
|
| 36 | +import java.sql.SQLTimeoutException; |
34 | 37 | import java.util.List;
|
35 | 38 | import java.util.function.Function;
|
36 | 39 | import java.util.function.Supplier;
|
@@ -217,12 +220,10 @@ public void onEnqueue(PoolWaiter<PooledConnection> waiter) {
|
217 | 220 | if (timeout > 0L && timerID == -1L) {
|
218 | 221 | timerID = context.setTimer(timeout, id -> {
|
219 | 222 | pool.cancel(waiter, ar -> {
|
220 |
| - if (ar.succeeded()) { |
221 |
| - if (ar.result()) { |
222 |
| - handler.handle(Future.failedFuture("Timeout")); |
223 |
| - } |
| 223 | + if (ar.succeeded() && ar.result()) { |
| 224 | + handler.handle(Future.failedFuture(new ConnectionPoolTooBusyException("Timeout while waiting for connection"))); |
224 | 225 | } else {
|
225 |
| - // ???? |
| 226 | + handler.handle(Future.failedFuture(new ConnectionPoolTooBusyException("Failed to cancel pool request after timeout while waiting for connection"))); |
226 | 227 | }
|
227 | 228 | });
|
228 | 229 | });
|
|
0 commit comments