Modifier and Type | Field and Description |
---|---|
static io.vertx.lang.rx.TypeArg<Pool> |
__TYPE_ARG |
Constructor and Description |
---|
Pool(Object delegate) |
Pool(Pool delegate) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the pool and release the associated resources.
|
void |
close(Handler<AsyncResult<Void>> handler)
Close the pool and release the associated resources.
|
Pool |
connectHandler(Handler<SqlConnection> handler)
Set an handler called when the pool has established a connection to the database.
|
Pool |
connectionProvider(java.util.function.Function<Context,Future<SqlConnection>> provider)
Replace the default pool connection provider, the new
provider returns a future connection for a
given . |
Pool |
connectionProvider(Function<Context,Single<SqlConnection>> provider)
Replace the default pool connection provider, the new
provider returns a future connection for a
given . |
boolean |
equals(Object o) |
void |
getConnection()
Get a connection from the pool.
|
void |
getConnection(Handler<AsyncResult<SqlConnection>> handler)
Get a connection from the pool.
|
Pool |
getDelegate() |
int |
hashCode() |
static Pool |
newInstance(Pool arg) |
static Pool |
pool(SqlConnectOptions connectOptions)
Like
pool(io.vertx.sqlclient.SqlConnectOptions) with default options. |
static Pool |
pool(SqlConnectOptions database,
PoolOptions options)
Like
pool(io.vertx.sqlclient.SqlConnectOptions) with a Vert.x instance created automatically. |
static Pool |
pool(Vertx vertx,
SqlConnectOptions database,
PoolOptions options)
Create a connection pool to the
database with the given options . |
PreparedQuery<RowSet<Row>> |
preparedQuery(String sql)
A connection is borrowed from the connection pool when the query is executed and then immediately returned
to the pool after it completes.
|
Query<RowSet<Row>> |
query(String sql)
A connection is borrowed from the connection pool when the query is executed and then immediately returned
to the pool after it completes.
|
Completable |
rxClose()
Close the pool and release the associated resources.
|
Single<SqlConnection> |
rxGetConnection()
Get a connection from the pool.
|
<T> Maybe<T> |
rxWithConnection(java.util.function.Function<SqlConnection,Future<T>> function)
Get a connection from the pool and execute the given
function . |
<T> Maybe<T> |
rxWithConnection(Function<SqlConnection,Maybe<T>> function)
Get a connection from the pool and execute the given
function . |
<T> Maybe<T> |
rxWithTransaction(java.util.function.Function<SqlConnection,Future<T>> function)
Execute the given
function within a transaction. |
<T> Maybe<T> |
rxWithTransaction(Function<SqlConnection,Maybe<T>> function)
Execute the given
function within a transaction. |
<T> Maybe<T> |
rxWithTransaction(TransactionPropagation txPropagation,
java.util.function.Function<SqlConnection,Future<T>> function)
Like
withTransaction(java.util.function.Function<io.vertx.reactivex.sqlclient.SqlConnection, io.vertx.core.Future<T>>, io.vertx.core.Handler<io.vertx.core.AsyncResult<T>>) but allows for setting the mode, defining how the acquired
connection is managed during the execution of the function. |
<T> Maybe<T> |
rxWithTransaction(TransactionPropagation txPropagation,
Function<SqlConnection,Maybe<T>> function)
Like
withTransaction(java.util.function.Function<io.vertx.reactivex.sqlclient.SqlConnection, io.vertx.core.Future<T>>, io.vertx.core.Handler<io.vertx.core.AsyncResult<T>>) but allows for setting the mode, defining how the acquired
connection is managed during the execution of the function. |
int |
size() |
String |
toString() |
<T> void |
withConnection(java.util.function.Function<SqlConnection,Future<T>> function)
Get a connection from the pool and execute the given
function . |
<T> void |
withConnection(java.util.function.Function<SqlConnection,Future<T>> function,
Handler<AsyncResult<T>> handler)
Get a connection from the pool and execute the given
function . |
<T> void |
withConnection(Function<SqlConnection,Maybe<T>> function)
Get a connection from the pool and execute the given
function . |
<T> void |
withConnection(Function<SqlConnection,Maybe<T>> function,
Handler<AsyncResult<T>> handler)
Get a connection from the pool and execute the given
function . |
<T> void |
withTransaction(java.util.function.Function<SqlConnection,Future<T>> function)
Execute the given
function within a transaction. |
<T> void |
withTransaction(java.util.function.Function<SqlConnection,Future<T>> function,
Handler<AsyncResult<T>> handler)
Execute the given
function within a transaction. |
<T> void |
withTransaction(Function<SqlConnection,Maybe<T>> function)
Execute the given
function within a transaction. |
<T> void |
withTransaction(Function<SqlConnection,Maybe<T>> function,
Handler<AsyncResult<T>> handler)
Execute the given
function within a transaction. |
<T> void |
withTransaction(TransactionPropagation txPropagation,
java.util.function.Function<SqlConnection,Future<T>> function)
Like
withTransaction(java.util.function.Function<io.vertx.reactivex.sqlclient.SqlConnection, io.vertx.core.Future<T>>, io.vertx.core.Handler<io.vertx.core.AsyncResult<T>>) but allows for setting the mode, defining how the acquired
connection is managed during the execution of the function. |
<T> void |
withTransaction(TransactionPropagation txPropagation,
java.util.function.Function<SqlConnection,Future<T>> function,
Handler<AsyncResult<T>> handler)
Like
withTransaction(java.util.function.Function<io.vertx.reactivex.sqlclient.SqlConnection, io.vertx.core.Future<T>>, io.vertx.core.Handler<io.vertx.core.AsyncResult<T>>) but allows for setting the mode, defining how the acquired
connection is managed during the execution of the function. |
<T> void |
withTransaction(TransactionPropagation txPropagation,
Function<SqlConnection,Maybe<T>> function)
Like
withTransaction(java.util.function.Function<io.vertx.reactivex.sqlclient.SqlConnection, io.vertx.core.Future<T>>, io.vertx.core.Handler<io.vertx.core.AsyncResult<T>>) but allows for setting the mode, defining how the acquired
connection is managed during the execution of the function. |
<T> void |
withTransaction(TransactionPropagation txPropagation,
Function<SqlConnection,Maybe<T>> function,
Handler<AsyncResult<T>> handler)
Like
withTransaction(java.util.function.Function<io.vertx.reactivex.sqlclient.SqlConnection, io.vertx.core.Future<T>>, io.vertx.core.Handler<io.vertx.core.AsyncResult<T>>) but allows for setting the mode, defining how the acquired
connection is managed during the execution of the function. |
newInstance, preparedQuery
public static final io.vertx.lang.rx.TypeArg<Pool> __TYPE_ARG
public Pool getDelegate()
getDelegate
in class SqlClient
public static Pool pool(SqlConnectOptions connectOptions)
pool(io.vertx.sqlclient.SqlConnectOptions)
with default options.connectOptions
- public static Pool pool(SqlConnectOptions database, PoolOptions options)
pool(io.vertx.sqlclient.SqlConnectOptions)
with a Vert.x instance created automatically.database
- options
- public static Pool pool(Vertx vertx, SqlConnectOptions database, PoolOptions options)
database
with the given options
.
A will be selected among the drivers found on the classpath returning
true
when applied to the first options
of the list.
vertx
- the Vertx instance to be used with the connection pooldatabase
- the options used to create the connection pool, such as database hostnameoptions
- the options for creating the poolpublic void getConnection(Handler<AsyncResult<SqlConnection>> handler)
handler
- the handler that will get the connection resultpublic void getConnection()
public Single<SqlConnection> rxGetConnection()
public Query<RowSet<Row>> query(String sql)
public PreparedQuery<RowSet<Row>> preparedQuery(String sql)
preparedQuery
in class SqlClient
sql
- public <T> void withTransaction(java.util.function.Function<SqlConnection,Future<T>> function, Handler<AsyncResult<T>> handler)
function
within a transaction.
The function
is passed a client executing all operations within a transaction.
When the future returned by the function
The handler
is given a success result when the function returns a succeeded futures and the transaction commits.
Otherwise it is given a failure result.
function
- the code to executehandler
- the result handlerpublic <T> void withTransaction(java.util.function.Function<SqlConnection,Future<T>> function)
function
within a transaction.
The function
is passed a client executing all operations within a transaction.
When the future returned by the function
The handler
is given a success result when the function returns a succeeded futures and the transaction commits.
Otherwise it is given a failure result.
function
- the code to executepublic <T> Maybe<T> rxWithTransaction(java.util.function.Function<SqlConnection,Future<T>> function)
function
within a transaction.
The function
is passed a client executing all operations within a transaction.
When the future returned by the function
The handler
is given a success result when the function returns a succeeded futures and the transaction commits.
Otherwise it is given a failure result.
function
- the code to executepublic <T> void withTransaction(Function<SqlConnection,Maybe<T>> function, Handler<AsyncResult<T>> handler)
function
within a transaction.
The function
is passed a client executing all operations within a transaction.
When the future returned by the function
The handler
is given a success result when the function returns a succeeded futures and the transaction commits.
Otherwise it is given a failure result.
function
- the code to executehandler
- the result handlerpublic <T> void withTransaction(Function<SqlConnection,Maybe<T>> function)
function
within a transaction.
The function
is passed a client executing all operations within a transaction.
When the future returned by the function
The handler
is given a success result when the function returns a succeeded futures and the transaction commits.
Otherwise it is given a failure result.
function
- the code to executepublic <T> Maybe<T> rxWithTransaction(Function<SqlConnection,Maybe<T>> function)
function
within a transaction.
The function
is passed a client executing all operations within a transaction.
When the future returned by the function
The handler
is given a success result when the function returns a succeeded futures and the transaction commits.
Otherwise it is given a failure result.
function
- the code to executepublic <T> void withTransaction(TransactionPropagation txPropagation, java.util.function.Function<SqlConnection,Future<T>> function, Handler<AsyncResult<T>> handler)
withTransaction(java.util.function.Function<io.vertx.reactivex.sqlclient.SqlConnection, io.vertx.core.Future<T>>, io.vertx.core.Handler<io.vertx.core.AsyncResult<T>>)
but allows for setting the mode, defining how the acquired
connection is managed during the execution of the function.txPropagation
- function
- handler
- public <T> void withTransaction(TransactionPropagation txPropagation, java.util.function.Function<SqlConnection,Future<T>> function)
withTransaction(java.util.function.Function<io.vertx.reactivex.sqlclient.SqlConnection, io.vertx.core.Future<T>>, io.vertx.core.Handler<io.vertx.core.AsyncResult<T>>)
but allows for setting the mode, defining how the acquired
connection is managed during the execution of the function.txPropagation
- function
- public <T> Maybe<T> rxWithTransaction(TransactionPropagation txPropagation, java.util.function.Function<SqlConnection,Future<T>> function)
withTransaction(java.util.function.Function<io.vertx.reactivex.sqlclient.SqlConnection, io.vertx.core.Future<T>>, io.vertx.core.Handler<io.vertx.core.AsyncResult<T>>)
but allows for setting the mode, defining how the acquired
connection is managed during the execution of the function.txPropagation
- function
- public <T> void withTransaction(TransactionPropagation txPropagation, Function<SqlConnection,Maybe<T>> function, Handler<AsyncResult<T>> handler)
withTransaction(java.util.function.Function<io.vertx.reactivex.sqlclient.SqlConnection, io.vertx.core.Future<T>>, io.vertx.core.Handler<io.vertx.core.AsyncResult<T>>)
but allows for setting the mode, defining how the acquired
connection is managed during the execution of the function.txPropagation
- function
- handler
- public <T> void withTransaction(TransactionPropagation txPropagation, Function<SqlConnection,Maybe<T>> function)
withTransaction(java.util.function.Function<io.vertx.reactivex.sqlclient.SqlConnection, io.vertx.core.Future<T>>, io.vertx.core.Handler<io.vertx.core.AsyncResult<T>>)
but allows for setting the mode, defining how the acquired
connection is managed during the execution of the function.txPropagation
- function
- public <T> Maybe<T> rxWithTransaction(TransactionPropagation txPropagation, Function<SqlConnection,Maybe<T>> function)
withTransaction(java.util.function.Function<io.vertx.reactivex.sqlclient.SqlConnection, io.vertx.core.Future<T>>, io.vertx.core.Handler<io.vertx.core.AsyncResult<T>>)
but allows for setting the mode, defining how the acquired
connection is managed during the execution of the function.txPropagation
- function
- public <T> void withConnection(java.util.function.Function<SqlConnection,Future<T>> function, Handler<AsyncResult<T>> handler)
function
.
When the future returned by the function
completes, the connection is returned to the pool.
The handler
is given a success result when the function returns a succeeded futures.
Otherwise it is given a failure result.
function
- the code to executehandler
- the result handlerpublic <T> void withConnection(java.util.function.Function<SqlConnection,Future<T>> function)
function
.
When the future returned by the function
completes, the connection is returned to the pool.
The handler
is given a success result when the function returns a succeeded futures.
Otherwise it is given a failure result.
function
- the code to executepublic <T> Maybe<T> rxWithConnection(java.util.function.Function<SqlConnection,Future<T>> function)
function
.
When the future returned by the function
completes, the connection is returned to the pool.
The handler
is given a success result when the function returns a succeeded futures.
Otherwise it is given a failure result.
function
- the code to executepublic <T> void withConnection(Function<SqlConnection,Maybe<T>> function, Handler<AsyncResult<T>> handler)
function
.
When the future returned by the function
completes, the connection is returned to the pool.
The handler
is given a success result when the function returns a succeeded futures.
Otherwise it is given a failure result.
function
- the code to executehandler
- the result handlerpublic <T> void withConnection(Function<SqlConnection,Maybe<T>> function)
function
.
When the future returned by the function
completes, the connection is returned to the pool.
The handler
is given a success result when the function returns a succeeded futures.
Otherwise it is given a failure result.
function
- the code to executepublic <T> Maybe<T> rxWithConnection(Function<SqlConnection,Maybe<T>> function)
function
.
When the future returned by the function
completes, the connection is returned to the pool.
The handler
is given a success result when the function returns a succeeded futures.
Otherwise it is given a failure result.
function
- the code to executepublic void close(Handler<AsyncResult<Void>> handler)
public void close()
public Completable rxClose()
public Pool connectHandler(Handler<SqlConnection> handler)
This handler allows interactions with the database before the connection is added to the pool.
When the handler has finished, it must call SqlClient.close(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>)
to release the connection
to the pool.
handler
- the handlerpublic Pool connectionProvider(java.util.function.Function<Context,Future<SqlConnection>> provider)
provider
returns a future connection for a
given .
A ConnectionFactory
can be used as connection provider.
provider
- the new connection providerpublic Pool connectionProvider(Function<Context,Single<SqlConnection>> provider)
provider
returns a future connection for a
given .
A ConnectionFactory
can be used as connection provider.
provider
- the new connection providerpublic int size()
Copyright © 2024 Eclipse. All rights reserved.