Java Code Examples for io.vertx.mysqlclient.MySQLPool#pool()

The following examples show how to use io.vertx.mysqlclient.MySQLPool#pool() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MySQLTest.java    From vertx-auth with Apache License 2.0 6 votes vote down vote up
@Before
public void before() {
  // Create the client pool
  mysql = MySQLPool.pool(
    rule.vertx(),
    // default config
    new MySQLConnectOptions()
      .setPort(container.getMappedPort(3306))
      .setHost(container.getContainerIpAddress())
      .setDatabase("testschema")
      .setUser("mysql")
      .setPassword("password"),
    // default pool config
    new PoolOptions()
      .setMaxSize(5));
}
 
Example 2
Source File: MySQLPoolRecorder.java    From quarkus with Apache License 2.0 5 votes vote down vote up
private MySQLPool initialize(Vertx vertx, DataSourceRuntimeConfig dataSourceRuntimeConfig,
        DataSourceReactiveRuntimeConfig dataSourceReactiveRuntimeConfig,
        DataSourceReactiveMySQLConfig dataSourceReactiveMySQLConfig) {
    PoolOptions poolOptions = toPoolOptions(dataSourceRuntimeConfig, dataSourceReactiveRuntimeConfig,
            dataSourceReactiveMySQLConfig);
    MySQLConnectOptions mysqlConnectOptions = toMySQLConnectOptions(dataSourceRuntimeConfig,
            dataSourceReactiveRuntimeConfig, dataSourceReactiveMySQLConfig);
    if (dataSourceReactiveRuntimeConfig.threadLocal.isPresent() &&
            dataSourceReactiveRuntimeConfig.threadLocal.get()) {
        return new ThreadLocalMySQLPool(vertx, mysqlConnectOptions, poolOptions);
    }
    return MySQLPool.pool(vertx, mysqlConnectOptions, poolOptions);
}
 
Example 3
Source File: MySQLPoolRecorder.java    From quarkus with Apache License 2.0 5 votes vote down vote up
private MySQLPool legacyInitialize(Vertx vertx, DataSourceRuntimeConfig dataSourceRuntimeConfig,
        LegacyDataSourceRuntimeConfig legacyDataSourceRuntimeConfig,
        LegacyDataSourceReactiveMySQLConfig legacyDataSourceReactiveMySQLConfig) {
    PoolOptions poolOptions = legacyToPoolOptionsLegacy(legacyDataSourceRuntimeConfig);
    MySQLConnectOptions mysqlConnectOptions = legacyToMySQLConnectOptions(dataSourceRuntimeConfig,
            legacyDataSourceRuntimeConfig, legacyDataSourceReactiveMySQLConfig);
    return MySQLPool.pool(vertx, mysqlConnectOptions, poolOptions);
}
 
Example 4
Source File: ThreadLocalMySQLPool.java    From quarkus with Apache License 2.0 4 votes vote down vote up
@Override
protected MySQLPool createThreadLocalPool() {
    return MySQLPool.pool(vertx, mySQLConnectOptions, poolOptions);
}
 
Example 5
Source File: MySQLTest.java    From vertx-sql-client with Apache License 2.0 4 votes vote down vote up
@Before
public void setup() throws Exception {
  vertx = Vertx.vertx();
  pool = MySQLPool.pool(vertx, connectOptions(), new PoolOptions());
}
 
Example 6
Source File: MySQLDriver.java    From vertx-sql-client with Apache License 2.0 4 votes vote down vote up
@Override
public Pool createPool(SqlConnectOptions options, PoolOptions poolOptions) {
  return MySQLPool.pool(wrap(options), poolOptions);
}
 
Example 7
Source File: MySQLDriver.java    From vertx-sql-client with Apache License 2.0 4 votes vote down vote up
@Override
public Pool createPool(Vertx vertx, SqlConnectOptions options, PoolOptions poolOptions) {
  return MySQLPool.pool(vertx, wrap(options), poolOptions);
}
 
Example 8
Source File: MySQLTransactionTest.java    From vertx-sql-client with Apache License 2.0 4 votes vote down vote up
@Override
protected Pool createPool() {
  return MySQLPool.pool(vertx, new MySQLConnectOptions(rule.options()), new PoolOptions().setMaxSize(1));
}
 
Example 9
Source File: MySQLTransactionTest.java    From vertx-sql-client with Apache License 2.0 4 votes vote down vote up
@Override
protected Pool nonTxPool() {
  return MySQLPool.pool(vertx, new MySQLConnectOptions(rule.options()), new PoolOptions().setMaxSize(1));
}
 
Example 10
Source File: MySQLTracingTest.java    From vertx-sql-client with Apache License 2.0 4 votes vote down vote up
@Override
protected Pool createPool(Vertx vertx) {
  return MySQLPool.pool(vertx, rule.options(), new PoolOptions());
}