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));
}
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);
}
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);
}
Aggregations