Search in sources :

Example 6 with DB2Pool

use of io.vertx.db2client.DB2Pool in project vertx-sql-client by eclipse-vertx.

the class SqlClientExamples method poolSharing1.

public void poolSharing1(Vertx vertx, DB2ConnectOptions database, int maxSize) {
    DB2Pool pool = DB2Pool.pool(database, new PoolOptions().setMaxSize(maxSize));
    vertx.deployVerticle(() -> new AbstractVerticle() {

        @Override
        public void start() throws Exception {
        // Use the pool
        }
    }, new DeploymentOptions().setInstances(4));
}
Also used : DeploymentOptions(io.vertx.core.DeploymentOptions) PoolOptions(io.vertx.sqlclient.PoolOptions) AbstractVerticle(io.vertx.core.AbstractVerticle) DB2Pool(io.vertx.db2client.DB2Pool)

Example 7 with DB2Pool

use of io.vertx.db2client.DB2Pool in project vertx-sql-client by eclipse-vertx.

the class DB2Driver method newPool.

@Override
public DB2Pool newPool(Vertx vertx, List<? extends SqlConnectOptions> databases, PoolOptions options, CloseFuture closeFuture) {
    VertxInternal vx = (VertxInternal) vertx;
    PoolImpl pool;
    if (options.isShared()) {
        pool = vx.createSharedClient(SHARED_CLIENT_KEY, options.getName(), closeFuture, cf -> newPoolImpl(vx, databases, options, cf));
    } else {
        pool = newPoolImpl(vx, databases, options, closeFuture);
    }
    return new DB2PoolImpl(vx, closeFuture, pool);
}
Also used : SqlConnectOptions(io.vertx.sqlclient.SqlConnectOptions) VertxInternal(io.vertx.core.impl.VertxInternal) QueryTracer(io.vertx.sqlclient.impl.tracing.QueryTracer) Vertx(io.vertx.core.Vertx) ConnectionFactory(io.vertx.sqlclient.spi.ConnectionFactory) ContextInternal(io.vertx.core.impl.ContextInternal) Driver(io.vertx.sqlclient.spi.Driver) PoolImpl(io.vertx.sqlclient.impl.PoolImpl) Collectors(java.util.stream.Collectors) VertxMetrics(io.vertx.core.spi.metrics.VertxMetrics) PoolOptions(io.vertx.sqlclient.PoolOptions) Connection(io.vertx.sqlclient.impl.Connection) List(java.util.List) DB2Pool(io.vertx.db2client.DB2Pool) CloseFuture(io.vertx.core.impl.CloseFuture) DB2ConnectOptions(io.vertx.db2client.DB2ConnectOptions) io.vertx.db2client.impl(io.vertx.db2client.impl) JsonObject(io.vertx.core.json.JsonObject) ClientMetrics(io.vertx.core.spi.metrics.ClientMetrics) SqlConnectionInternal(io.vertx.sqlclient.impl.SqlConnectionInternal) VertxInternal(io.vertx.core.impl.VertxInternal) PoolImpl(io.vertx.sqlclient.impl.PoolImpl)

Example 8 with DB2Pool

use of io.vertx.db2client.DB2Pool in project quarkus by quarkusio.

the class DB2PoolRecorder method configureDB2Pool.

public RuntimeValue<DB2Pool> configureDB2Pool(RuntimeValue<Vertx> vertx, Supplier<Integer> eventLoopCount, String dataSourceName, DataSourcesRuntimeConfig dataSourcesRuntimeConfig, DataSourcesReactiveRuntimeConfig dataSourcesReactiveRuntimeConfig, DataSourcesReactiveDB2Config dataSourcesReactiveDB2Config, ShutdownContext shutdown) {
    DB2Pool db2Pool = initialize(vertx.getValue(), eventLoopCount.get(), dataSourcesRuntimeConfig.getDataSourceRuntimeConfig(dataSourceName), dataSourcesReactiveRuntimeConfig.getDataSourceReactiveRuntimeConfig(dataSourceName), dataSourcesReactiveDB2Config.getDataSourceReactiveRuntimeConfig(dataSourceName));
    shutdown.addShutdownTask(db2Pool::close);
    return new RuntimeValue<>(db2Pool);
}
Also used : RuntimeValue(io.quarkus.runtime.RuntimeValue) DB2Pool(io.vertx.db2client.DB2Pool)

Aggregations

DB2Pool (io.vertx.db2client.DB2Pool)8 PoolOptions (io.vertx.sqlclient.PoolOptions)5 DB2ConnectOptions (io.vertx.db2client.DB2ConnectOptions)4 Vertx (io.vertx.core.Vertx)2 Row (io.vertx.sqlclient.Row)2 RowSet (io.vertx.sqlclient.RowSet)2 SqlClient (io.vertx.sqlclient.SqlClient)2 Collectors (java.util.stream.Collectors)2 RuntimeValue (io.quarkus.runtime.RuntimeValue)1 AbstractVerticle (io.vertx.core.AbstractVerticle)1 DeploymentOptions (io.vertx.core.DeploymentOptions)1 Future (io.vertx.core.Future)1 CloseFuture (io.vertx.core.impl.CloseFuture)1 ContextInternal (io.vertx.core.impl.ContextInternal)1 VertxInternal (io.vertx.core.impl.VertxInternal)1 JsonObject (io.vertx.core.json.JsonObject)1 JksOptions (io.vertx.core.net.JksOptions)1 ClientMetrics (io.vertx.core.spi.metrics.ClientMetrics)1 VertxMetrics (io.vertx.core.spi.metrics.VertxMetrics)1 DB2Connection (io.vertx.db2client.DB2Connection)1