Class Pool
- All Implemented Interfaces:
MutinyDelegate
NOTE: This class has been automatically generated from the original non Mutiny-ified interface.
- Author:
- Julien Viet
- See Also:
-
Pool
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionio.smallrye.mutiny.Uni<Void>close()Close the client and release the associated resources.voidClose the client and release the associated resources.Close the client and release the associated resources.booleanio.smallrye.mutiny.Uni<SqlConnection>Get a connection from the pool.Get a connection from the pool.Get a connection from the pool.io.vertx.sqlclient.PoolGet the delegate instance.inthashCode()static PoolnewInstance(io.vertx.sqlclient.Pool delegate) Creates a new instance of thePool.static Poolpool(Vertx vertx, io.vertx.sqlclient.SqlConnectOptions database, io.vertx.sqlclient.PoolOptions options) Create a connection pool to thedatabasewith the givenoptions.static Poolpool(io.vertx.sqlclient.SqlConnectOptions connectOptions) Likepool(SqlConnectOptions, PoolOptions)with default options.static Poolpool(io.vertx.sqlclient.SqlConnectOptions database, io.vertx.sqlclient.PoolOptions options) Likepool(Vertx, SqlConnectOptions, PoolOptions)with a Vert.x instance created automatically.preparedQuery(String sql) Create a prepared query, one of thePreparedQuery.execute(io.vertx.mutiny.sqlclient.Tuple)orPreparedQuery.executeBatch(java.util.List<io.vertx.mutiny.sqlclient.Tuple>)methods must be called to execute the query.Create a query, theQuery.execute()method must be called to execute the query.intsize()toString()<T> io.smallrye.mutiny.Uni<T>withConnection(Function<SqlConnection, io.smallrye.mutiny.Uni<T>> function) Get a connection from the pool and execute the givenfunction.<T> TwithConnectionAndAwait(Function<SqlConnection, io.smallrye.mutiny.Uni<T>> function) Get a connection from the pool and execute the givenfunction.<T> PoolwithConnectionAndForget(Function<SqlConnection, io.smallrye.mutiny.Uni<T>> function) Get a connection from the pool and execute the givenfunction.<T> io.smallrye.mutiny.Uni<T>withTransaction(io.vertx.sqlclient.TransactionPropagation txPropagation, Function<SqlConnection, io.smallrye.mutiny.Uni<T>> function) LikewithTransaction(Function)but allows for setting the mode, defining how the acquired connection is managed during the execution of the function.<T> io.smallrye.mutiny.Uni<T>withTransaction(Function<SqlConnection, io.smallrye.mutiny.Uni<T>> function) Execute the givenfunctionwithin a transaction.<T> TwithTransactionAndAwait(io.vertx.sqlclient.TransactionPropagation txPropagation, Function<SqlConnection, io.smallrye.mutiny.Uni<T>> function) LikewithTransaction(Function)but allows for setting the mode, defining how the acquired connection is managed during the execution of the function.<T> TwithTransactionAndAwait(Function<SqlConnection, io.smallrye.mutiny.Uni<T>> function) Execute the givenfunctionwithin a transaction.<T> PoolwithTransactionAndForget(io.vertx.sqlclient.TransactionPropagation txPropagation, Function<SqlConnection, io.smallrye.mutiny.Uni<T>> function) LikewithTransaction(Function)but allows for setting the mode, defining how the acquired connection is managed during the execution of the function.<T> PoolwithTransactionAndForget(Function<SqlConnection, io.smallrye.mutiny.Uni<T>> function) Execute the givenfunctionwithin a transaction.Methods inherited from class io.vertx.mutiny.sqlclient.SqlClient
newInstance, preparedQuery
-
Field Details
-
__TYPE_ARG
-
-
Constructor Details
-
Pool
public Pool(io.vertx.sqlclient.Pool delegate) Create a new instance ofPooldelegating to the given (non-null) instance ofPool. -
Pool
-
-
Method Details
-
getDelegate
public io.vertx.sqlclient.Pool getDelegate()Get the delegate instance.This method returns the instance on which this shim is delegating the calls. And so, give you access to the bare API.
- Specified by:
getDelegatein interfaceMutinyDelegate- Overrides:
getDelegatein classSqlClient- Returns:
- the delegate instance
-
getConnection
Get a connection from the pool.Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
Pool.getConnection()
-
getConnectionAndAwait
Get a connection from the pool.Unlike the bare Vert.x variant, this method returns a
SqlConnection. This method awaits indefinitely for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in aRuntimeException).- Returns:
- The operation result
- See Also:
-
Pool.getConnection()
-
getConnectionAndForget
Get a connection from the pool.Unlike the bare Vert.x variant, this method ignores the
SqlConnectionresult or any failure.- Returns:
- The current instance to chain operations if needed.
- See Also:
-
Pool.getConnection()
-
withTransaction
@CheckReturnValue public <T> io.smallrye.mutiny.Uni<T> withTransaction(Function<SqlConnection, io.smallrye.mutiny.Uni<T>> function) Execute the givenfunctionwithin a transaction.The
functionis passed a client executing all operations within a transaction. When the uni returned by the function- succeeds the transaction commits
- fails the transaction rollbacks
The
handleris given a success result when the function returns a succeeded futures and the transaction commits. Otherwise it is given a failure result.Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Parameters:
function- the code to execute- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
Pool.withTransaction(Function)
-
withTransactionAndAwait
Execute the givenfunctionwithin a transaction.The
functionis passed a client executing all operations within a transaction. When the underlying uni returned by the function- succeeds the transaction commits
- fails the transaction rollbacks
The
handleris given a success result when the function returns a succeeded futures and the transaction commits. Otherwise it is given a failure result.Unlike the bare Vert.x variant, this method returns a
Pool. This method awaits indefinitely for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in aRuntimeException).- Parameters:
function- the code to execute- Returns:
- The operation result
- See Also:
-
Pool.withTransaction(Function)
-
withTransactionAndForget
public <T> Pool withTransactionAndForget(Function<SqlConnection, io.smallrye.mutiny.Uni<T>> function) Execute the givenfunctionwithin a transaction.The
functionis passed a client executing all operations within a transaction. When the underlying uni returned by the function- succeeds the transaction commits
- fails the transaction rollbacks
The
handleris given a success result when the function returns a succeeded futures and the transaction commits. Otherwise it is given a failure result.Unlike the bare Vert.x variant, this method ignores the
Poolresult or any failure.- Parameters:
function- the code to execute- Returns:
- The current instance to chain operations if needed.
- See Also:
-
Pool.withTransaction(Function)
-
withTransaction
@CheckReturnValue public <T> io.smallrye.mutiny.Uni<T> withTransaction(io.vertx.sqlclient.TransactionPropagation txPropagation, Function<SqlConnection, io.smallrye.mutiny.Uni<T>> function) LikewithTransaction(Function)but allows for setting the mode, defining how the acquired connection is managed during the execution of the function.Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
Pool.withTransaction(TransactionPropagation, Function)
-
withTransactionAndAwait
public <T> T withTransactionAndAwait(io.vertx.sqlclient.TransactionPropagation txPropagation, Function<SqlConnection, io.smallrye.mutiny.Uni<T>> function) LikewithTransaction(Function)but allows for setting the mode, defining how the acquired connection is managed during the execution of the function.Unlike the bare Vert.x variant, this method returns a
Pool. This method awaits indefinitely for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in aRuntimeException).- Returns:
- The operation result
- See Also:
-
Pool.withTransaction(TransactionPropagation, Function)
-
withTransactionAndForget
public <T> Pool withTransactionAndForget(io.vertx.sqlclient.TransactionPropagation txPropagation, Function<SqlConnection, io.smallrye.mutiny.Uni<T>> function) LikewithTransaction(Function)but allows for setting the mode, defining how the acquired connection is managed during the execution of the function.Unlike the bare Vert.x variant, this method ignores the
Poolresult or any failure.- Returns:
- The current instance to chain operations if needed.
- See Also:
-
Pool.withTransaction(TransactionPropagation, Function)
-
withConnection
@CheckReturnValue public <T> io.smallrye.mutiny.Uni<T> withConnection(Function<SqlConnection, io.smallrye.mutiny.Uni<T>> function) Get a connection from the pool and execute the givenfunction.When the uni returned by the
functioncompletes, the connection is returned to the pool.The
handleris given a success result when the function returns a succeeded futures. Otherwise it is given a failure result.Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
- Parameters:
function- the code to execute- Returns:
- A
Unirepresenting the asynchronous result of this operation. - See Also:
-
Pool.withConnection(Function)
-
withConnectionAndAwait
Get a connection from the pool and execute the givenfunction.When the underlying uni returned by the
functioncompletes, the connection is returned to the pool.The
handleris given a success result when the function returns a succeeded futures. Otherwise it is given a failure result.Unlike the bare Vert.x variant, this method returns a
Pool. This method awaits indefinitely for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in aRuntimeException).- Parameters:
function- the code to execute- Returns:
- The operation result
- See Also:
-
Pool.withConnection(Function)
-
withConnectionAndForget
Get a connection from the pool and execute the givenfunction.When the underlying uni returned by the
functioncompletes, the connection is returned to the pool.The
handleris given a success result when the function returns a succeeded futures. Otherwise it is given a failure result.Unlike the bare Vert.x variant, this method ignores the
Poolresult or any failure.- Parameters:
function- the code to execute- Returns:
- The current instance to chain operations if needed.
- See Also:
-
Pool.withConnection(Function)
-
close
Close the client and release the associated resources.Unlike the bare Vert.x variant, this method returns a
Uni. The uni emits the result of the operation as item. If the operation fails, the uni emits the failure.Don't forget to subscribe on it to trigger the operation.
-
closeAndAwait
public void closeAndAwait()Close the client and release the associated resources.Unlike the bare Vert.x variant, this method returns a
Void. This method awaits indefinitely for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in aRuntimeException).- Overrides:
closeAndAwaitin classSqlClient- See Also:
-
SqlClient.close()
-
closeAndForget
Close the client and release the associated resources.Unlike the bare Vert.x variant, this method ignores the
Voidresult or any failure.- Overrides:
closeAndForgetin classSqlClient- Returns:
- The current instance to chain operations if needed.
- See Also:
-
SqlClient.close()
-
pool
Likepool(SqlConnectOptions, PoolOptions)with default options. -
pool
public static Pool pool(io.vertx.sqlclient.SqlConnectOptions database, io.vertx.sqlclient.PoolOptions options) Likepool(Vertx, SqlConnectOptions, PoolOptions)with a Vert.x instance created automatically. -
pool
public static Pool pool(Vertx vertx, io.vertx.sqlclient.SqlConnectOptions database, io.vertx.sqlclient.PoolOptions options) Create a connection pool to thedatabasewith the givenoptions.A
Driverwill be selected among the drivers found on the classpath returningtruewhenDriver#acceptsOptions(SqlConnectOptions)applied to the first options of the list.- Parameters:
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 pool- Returns:
- the connection pool
-
query
Create a query, theQuery.execute()method must be called to execute the query. A connection is borrowed from the connection pool when the query is executed and then immediately returned to the pool after it completes. -
preparedQuery
Create a prepared query, one of thePreparedQuery.execute(io.vertx.mutiny.sqlclient.Tuple)orPreparedQuery.executeBatch(java.util.List<io.vertx.mutiny.sqlclient.Tuple>)methods must be called to execute the query. A connection is borrowed from the connection pool when the query is executed and then immediately returned to the pool after it completes.- Overrides:
preparedQueryin classSqlClient- Returns:
- the prepared query
-
size
public int size()- Returns:
- the current pool size approximation
-
newInstance
Creates a new instance of thePool. -
hashCode
public int hashCode() -
equals
-
toString
-