diff --git a/vertx-pg-client/src/main/java/io/vertx/pgclient/PgConnection.java b/vertx-pg-client/src/main/java/io/vertx/pgclient/PgConnection.java index 167bd738e..c2014b309 100644 --- a/vertx-pg-client/src/main/java/io/vertx/pgclient/PgConnection.java +++ b/vertx-pg-client/src/main/java/io/vertx/pgclient/PgConnection.java @@ -17,12 +17,15 @@ package io.vertx.pgclient; +import io.vertx.codegen.annotations.Fluent; +import io.vertx.codegen.annotations.VertxGen; +import io.vertx.core.AsyncResult; +import io.vertx.core.Future; +import io.vertx.core.Handler; +import io.vertx.core.Vertx; import io.vertx.core.impl.ContextInternal; import io.vertx.pgclient.impl.PgConnectionImpl; import io.vertx.sqlclient.SqlConnection; -import io.vertx.codegen.annotations.Fluent; -import io.vertx.codegen.annotations.VertxGen; -import io.vertx.core.*; /** * A connection to Postgres. @@ -52,7 +55,7 @@ public interface PgConnection extends SqlConnection { * @return a future notified with the connection or the failure */ static Future connect(Vertx vertx, PgConnectOptions options) { - return PgConnectionImpl.connect((ContextInternal) vertx.getOrCreateContext(), () -> options); + return PgConnectionImpl.connect((ContextInternal) vertx.getOrCreateContext(), options); } /** diff --git a/vertx-pg-client/src/main/java/io/vertx/pgclient/impl/PgConnectionImpl.java b/vertx-pg-client/src/main/java/io/vertx/pgclient/impl/PgConnectionImpl.java index 12a029162..339ae9d43 100644 --- a/vertx-pg-client/src/main/java/io/vertx/pgclient/impl/PgConnectionImpl.java +++ b/vertx-pg-client/src/main/java/io/vertx/pgclient/impl/PgConnectionImpl.java @@ -30,18 +30,16 @@ import io.vertx.sqlclient.impl.SocketConnectionBase; import io.vertx.sqlclient.impl.SqlConnectionBase; -import java.util.function.Supplier; - public class PgConnectionImpl extends SqlConnectionBase implements PgConnection { - public static Future connect(ContextInternal context, Supplier options) { + public static Future connect(ContextInternal context, PgConnectOptions options) { PgConnectionFactory client; try { client = new PgConnectionFactory(context.owner()); } catch (Exception e) { return context.failedFuture(e); } - return prepareForClose(context, client.connect(context, options.get())).map(PgConnection::cast); + return prepareForClose(context, client.connect(context, options)).map(PgConnection::cast); } private volatile Handler notificationHandler;