|
10 | 10 | */ |
11 | 11 | package io.vertx.oracleclient; |
12 | 12 |
|
| 13 | +import io.vertx.codegen.annotations.GenIgnore; |
13 | 14 | import io.vertx.codegen.annotations.VertxGen; |
14 | 15 | import io.vertx.core.Context; |
15 | 16 | import io.vertx.core.Future; |
|
19 | 20 | import io.vertx.sqlclient.Pool; |
20 | 21 | import io.vertx.sqlclient.PoolOptions; |
21 | 22 | import io.vertx.sqlclient.SqlConnection; |
| 23 | +import io.vertx.sqlclient.impl.SingletonSupplier; |
22 | 24 |
|
23 | 25 | import java.util.Collections; |
24 | 26 | import java.util.function.Function; |
| 27 | +import java.util.function.Supplier; |
25 | 28 |
|
26 | 29 | /** |
27 | 30 | * Represents a pool of connection to interact with an Oracle database. |
@@ -54,6 +57,28 @@ static OraclePool pool(Vertx vertx, String connectionUri, PoolOptions poolOption |
54 | 57 | return pool(vertx, OracleConnectOptions.fromUri(connectionUri), poolOptions); |
55 | 58 | } |
56 | 59 |
|
| 60 | + /** |
| 61 | + * Create a connection pool to the Oracle {@code databases}. The supplier is called |
| 62 | + * to provide the options when a new connection is created by the pool. |
| 63 | + * |
| 64 | + * @param databases the databases supplier |
| 65 | + * @param poolOptions the options for creating the pool |
| 66 | + * @return the connection pool |
| 67 | + */ |
| 68 | + @GenIgnore |
| 69 | + static OraclePool pool(Supplier<Future<OracleConnectOptions>> databases, PoolOptions poolOptions) { |
| 70 | + return pool(null, databases, poolOptions); |
| 71 | + } |
| 72 | + |
| 73 | + |
| 74 | + /** |
| 75 | + * Like {@link #pool(Supplier, PoolOptions)} with a specific {@link Vertx} instance. |
| 76 | + */ |
| 77 | + @GenIgnore |
| 78 | + static OraclePool pool(Vertx vertx, Supplier<Future<OracleConnectOptions>> databases, PoolOptions poolOptions) { |
| 79 | + return (OraclePool) OracleDriver.INSTANCE.createPool(vertx, databases, poolOptions); |
| 80 | + } |
| 81 | + |
57 | 82 | @Override |
58 | 83 | OraclePool connectHandler(Handler<SqlConnection> handler); |
59 | 84 |
|
|
0 commit comments