Example usage for io.vertx.pgclient PgPool close

List of usage examples for io.vertx.pgclient PgPool close

Introduction

In this page you can find the example usage for io.vertx.pgclient PgPool close.

Prototype

void close();

Source Link

Document

Close the pool and release the associated resources.

Usage

From source file:examples.PgClientExamples.java

License:Apache License

public void gettingStarted() {

    // Connect options
    PgConnectOptions connectOptions = new PgConnectOptions().setPort(5432).setHost("the-host")
            .setDatabase("the-db").setUser("user").setPassword("secret");

    // Pool options
    PoolOptions poolOptions = new PoolOptions().setMaxSize(5);

    // Create the client pool
    PgPool client = PgPool.pool(connectOptions, poolOptions);

    // A simple query
    client.query("SELECT * FROM users WHERE id='julien'", ar -> {
        if (ar.succeeded()) {
            RowSet<Row> result = ar.result();
            System.out.println("Got " + result.size() + " rows ");
        } else {//from w  ww .j  a v a  2  s . co m
            System.out.println("Failure: " + ar.cause().getMessage());
        }

        // Now close the pool
        client.close();
    });
}

From source file:examples.PgClientExamples.java

License:Apache License

public void connecting03(PgPool pool) {

    // Close the pool and all the associated resources
    pool.close();
}