Skip to content

Commit a306add

Browse files
committed
Remove callback methods and use only futures
1 parent 43b0992 commit a306add

File tree

36 files changed

+54
-670
lines changed

36 files changed

+54
-670
lines changed

vertx-db2-client/src/main/java/io/vertx/db2client/DB2Connection.java

Lines changed: 4 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,11 @@
1515
*/
1616
package io.vertx.db2client;
1717

18-
import io.vertx.codegen.annotations.Fluent;
1918
import io.vertx.codegen.annotations.VertxGen;
20-
import io.vertx.core.AsyncResult;
2119
import io.vertx.core.Future;
2220
import io.vertx.core.Handler;
2321
import io.vertx.core.Vertx;
2422
import io.vertx.db2client.impl.DB2ConnectionImpl;
25-
import io.vertx.sqlclient.PreparedStatement;
2623
import io.vertx.sqlclient.SqlConnection;
2724

2825
import static io.vertx.db2client.DB2ConnectOptions.fromUri;
@@ -38,45 +35,20 @@ public interface DB2Connection extends SqlConnection {
3835
*
3936
* @param vertx the vertx instance
4037
* @param connectOptions the options for the connection
41-
* @param handler the handler called with the connection or the failure
42-
*/
43-
@Deprecated
44-
static void connect(Vertx vertx, DB2ConnectOptions connectOptions, Handler<AsyncResult<DB2Connection>> handler) {
45-
Future<DB2Connection> fut = connect(vertx, connectOptions);
46-
if (handler != null) {
47-
fut.onComplete(handler);
48-
}
49-
}
50-
51-
/**
52-
* Like {@link #connect(Vertx, DB2ConnectOptions, Handler)} but returns a
53-
* {@code Future} of the asynchronous result
38+
* @return a future notified with the connection or the failure
5439
*/
5540
static Future<DB2Connection> connect(Vertx vertx, DB2ConnectOptions connectOptions) {
5641
return DB2ConnectionImpl.connect(vertx, connectOptions);
5742
}
5843

5944
/**
60-
* Like {@link #connect(Vertx, DB2ConnectOptions, Handler)} with options build
45+
* Like {@link #connect(Vertx, DB2ConnectOptions)} with options build
6146
* from {@code connectionUri}.
6247
*/
63-
@Deprecated
64-
static void connect(Vertx vertx, String connectionUri, Handler<AsyncResult<DB2Connection>> handler) {
65-
connect(vertx, fromUri(connectionUri), handler);
66-
}
67-
68-
/**
69-
* Like {@link #connect(Vertx, String, Handler)} but returns a {@code Future} of
70-
* the asynchronous result
71-
*/
7248
static Future<DB2Connection> connect(Vertx vertx, String connectionUri) {
7349
return connect(vertx, fromUri(connectionUri));
7450
}
7551

76-
@Override
77-
@Deprecated
78-
DB2Connection prepare(String sql, Handler<AsyncResult<PreparedStatement>> handler);
79-
8052
@Override
8153
DB2Connection exceptionHandler(Handler<Throwable> handler);
8254

@@ -86,32 +58,14 @@ static Future<DB2Connection> connect(Vertx vertx, String connectionUri) {
8658
/**
8759
* Send a PING command to check if the server is alive.
8860
*
89-
* @param handler the handler notified when the server responses to client
90-
* @return a reference to this, so the API can be used fluently
91-
*/
92-
@Fluent
93-
@Deprecated
94-
DB2Connection ping(Handler<AsyncResult<Void>> handler);
95-
96-
/**
97-
* Like {@link #ping(Handler)} but returns a {@code Future} of the asynchronous
98-
* result
61+
* @return a future notified with the server response
9962
*/
10063
Future<Void> ping();
10164

10265
/**
10366
* Send a DEBUG command to dump debug information to the server's stdout.
10467
*
105-
* @param handler the handler notified with the execution result
106-
* @return a reference to this, so the API can be used fluently
107-
*/
108-
@Fluent
109-
@Deprecated
110-
DB2Connection debug(Handler<AsyncResult<Void>> handler);
111-
112-
/**
113-
* Like {@link #debug(Handler)} but returns a {@code Future} of the asynchronous
114-
* result
68+
* @return a future notified with the execution result
11569
*/
11670
Future<Void> debug();
11771

vertx-db2-client/src/main/java/io/vertx/db2client/impl/DB2ConnectionImpl.java

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@
1515
*/
1616
package io.vertx.db2client.impl;
1717

18-
import io.vertx.core.AsyncResult;
1918
import io.vertx.core.Future;
20-
import io.vertx.core.Handler;
2119
import io.vertx.core.Vertx;
2220
import io.vertx.core.impl.ContextInternal;
2321
import io.vertx.core.spi.metrics.ClientMetrics;
@@ -48,25 +46,11 @@ public DB2ConnectionImpl(ContextInternal context, ConnectionFactory factory, Con
4846
super(context, factory, conn, DB2Driver.INSTANCE, tracer, metrics);
4947
}
5048

51-
@Override
52-
public DB2Connection ping(Handler<AsyncResult<Void>> handler) {
53-
Future<Void> fut = ping();
54-
if (handler != null) {
55-
fut.onComplete(handler);
56-
}
57-
return this;
58-
}
59-
6049
@Override
6150
public Future<Void> ping() {
6251
return schedule(context, new PingCommand());
6352
}
6453

65-
@Override
66-
public DB2Connection debug(Handler<AsyncResult<Void>> handler) {
67-
throw new UnsupportedOperationException("Debug command not implemented");
68-
}
69-
7054
@Override
7155
public Future<Void> debug() {
7256
throw new UnsupportedOperationException("Debug command not implemented");

vertx-db2-client/src/main/java/io/vertx/db2client/package-info.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
@ModuleGen(name = "vertx-db2-client", groupPackage = "io.vertx", checkCallbackDeprecation = true)
16+
@ModuleGen(name = "vertx-db2-client", groupPackage = "io.vertx", useFutures = true)
1717
package io.vertx.db2client;
1818

1919
import io.vertx.codegen.annotations.ModuleGen;

vertx-mssql-client/src/main/java/io/vertx/mssqlclient/MSSQLConnection.java

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
import io.vertx.codegen.annotations.Fluent;
1515
import io.vertx.codegen.annotations.VertxGen;
16-
import io.vertx.core.AsyncResult;
1716
import io.vertx.core.Future;
1817
import io.vertx.core.Handler;
1918
import io.vertx.core.Vertx;
@@ -34,46 +33,19 @@ public interface MSSQLConnection extends SqlConnection {
3433
*
3534
* @param vertx the vertx instance
3635
* @param connectOptions the options for the connection
37-
* @param handler the handler called with the connection or the failure
38-
*/
39-
@Deprecated
40-
static void connect(Vertx vertx, MSSQLConnectOptions connectOptions, Handler<AsyncResult<MSSQLConnection>> handler) {
41-
Future<MSSQLConnection> fut = MSSQLConnectionImpl.connect(vertx, connectOptions);
42-
if (handler != null) {
43-
fut.onComplete(handler);
44-
}
45-
}
46-
47-
/**
48-
* Like {@link #connect(Vertx, MSSQLConnectOptions, Handler)} but returns a {@code Future} of the asynchronous result
36+
* @return a future notified with the connection or the failure
4937
*/
5038
static Future<MSSQLConnection> connect(Vertx vertx, MSSQLConnectOptions connectOptions) {
5139
return MSSQLConnectionImpl.connect(vertx, connectOptions);
5240
}
5341

5442
/**
55-
* Like {@link #connect(Vertx, MSSQLConnectOptions, Handler)} with options built from {@code connectionUri}.
56-
*/
57-
@Deprecated
58-
static void connect(Vertx vertx, String connectionUri, Handler<AsyncResult<MSSQLConnection>> handler) {
59-
connect(vertx, fromUri(connectionUri), handler);
60-
}
61-
62-
/**
63-
* Like {@link #connect(Vertx, String, Handler)} but returns a {@code Future} of the asynchronous result
43+
* Like {@link #connect(Vertx, MSSQLConnectOptions)} with options built from {@code connectionUri}.
6444
*/
6545
static Future<MSSQLConnection> connect(Vertx vertx, String connectionUri) {
6646
return connect(vertx, fromUri(connectionUri));
6747
}
6848

69-
/**
70-
* {@inheritDoc}
71-
*/
72-
@Fluent
73-
@Override
74-
@Deprecated
75-
MSSQLConnection prepare(String s, Handler<AsyncResult<PreparedStatement>> handler);
76-
7749
/**
7850
* {@inheritDoc}
7951
*/

vertx-mssql-client/src/main/java/io/vertx/mssqlclient/package-info.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
1010
*/
1111

12-
@ModuleGen(name = "vertx-mssql-client", groupPackage = "io.vertx", checkCallbackDeprecation = true)
12+
@ModuleGen(name = "vertx-mssql-client", groupPackage = "io.vertx", useFutures = true)
1313
package io.vertx.mssqlclient;
1414

1515
import io.vertx.codegen.annotations.ModuleGen;

vertx-mysql-client/src/main/java/io/vertx/mysqlclient/MySQLConnection.java

Lines changed: 10 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,11 @@
1313

1414
import io.vertx.codegen.annotations.Fluent;
1515
import io.vertx.codegen.annotations.VertxGen;
16-
import io.vertx.core.AsyncResult;
1716
import io.vertx.core.Future;
1817
import io.vertx.core.Handler;
1918
import io.vertx.core.Vertx;
2019
import io.vertx.core.impl.ContextInternal;
2120
import io.vertx.mysqlclient.impl.MySQLConnectionImpl;
22-
import io.vertx.sqlclient.PreparedStatement;
2321
import io.vertx.sqlclient.SqlConnection;
2422

2523
import static io.vertx.mysqlclient.MySQLConnectOptions.fromUri;
@@ -42,51 +40,25 @@
4240
*/
4341
@VertxGen
4442
public interface MySQLConnection extends SqlConnection {
43+
4544
/**
4645
* Create a connection to MySQL server with the given {@code connectOptions}.
4746
*
4847
* @param vertx the vertx instance
4948
* @param connectOptions the options for the connection
50-
* @param handler the handler called with the connection or the failure
51-
*/
52-
@Deprecated
53-
static void connect(Vertx vertx, MySQLConnectOptions connectOptions, Handler<AsyncResult<MySQLConnection>> handler) {
54-
Future<MySQLConnection> fut = connect(vertx, connectOptions);
55-
if (handler != null) {
56-
fut.onComplete(handler);
57-
}
58-
}
59-
60-
/**
61-
* Like {@link #connect(Vertx, MySQLConnectOptions, Handler)} but returns a {@code Future} of the asynchronous result
49+
* @return a future notified with the connection or the failure
6250
*/
6351
static Future<MySQLConnection> connect(Vertx vertx, MySQLConnectOptions connectOptions) {
6452
return MySQLConnectionImpl.connect((ContextInternal) vertx.getOrCreateContext(), connectOptions);
6553
}
6654

6755
/**
68-
* Like {@link #connect(Vertx, MySQLConnectOptions, Handler)} with options built from {@code connectionUri}.
69-
*/
70-
@Deprecated
71-
static void connect(Vertx vertx, String connectionUri, Handler<AsyncResult<MySQLConnection>> handler) {
72-
connect(vertx, fromUri(connectionUri), handler);
73-
}
74-
75-
/**
76-
* Like {@link #connect(Vertx, String, Handler)} but returns a {@code Future} of the asynchronous result
56+
* Like {@link #connect(Vertx, MySQLConnectOptions)} with options built from {@code connectionUri}.
7757
*/
7858
static Future<MySQLConnection> connect(Vertx vertx, String connectionUri) {
7959
return connect(vertx, fromUri(connectionUri));
8060
}
8161

82-
/**
83-
* {@inheritDoc}
84-
*/
85-
@Fluent
86-
@Override
87-
@Deprecated
88-
MySQLConnection prepare(String sql, Handler<AsyncResult<PreparedStatement>> handler);
89-
9062
/**
9163
* {@inheritDoc}
9264
*/
@@ -104,46 +76,22 @@ static Future<MySQLConnection> connect(Vertx vertx, String connectionUri) {
10476
/**
10577
* Send a PING command to check if the server is alive.
10678
*
107-
* @param handler the handler notified when the server responses to client
108-
* @return a reference to this, so the API can be used fluently
109-
*/
110-
@Fluent
111-
@Deprecated
112-
MySQLConnection ping(Handler<AsyncResult<Void>> handler);
113-
114-
/**
115-
* Like {@link #ping(Handler)} but returns a {@code Future} of the asynchronous result
79+
* @return a future notified with the server response
11680
*/
11781
Future<Void> ping();
11882

11983
/**
12084
* Send a INIT_DB command to change the default schema of the connection.
12185
*
12286
* @param schemaName name of the schema to change to
123-
* @param handler the handler notified with the execution result
124-
* @return a reference to this, so the API can be used fluently
125-
*/
126-
@Fluent
127-
@Deprecated
128-
MySQLConnection specifySchema(String schemaName, Handler<AsyncResult<Void>> handler);
129-
130-
/**
131-
* Like {@link #specifySchema(String, Handler)} but returns a {@code Future} of the asynchronous result
87+
* @return a future notified with the execution result
13288
*/
13389
Future<Void> specifySchema(String schemaName);
13490

13591
/**
13692
* Send a STATISTICS command to get a human readable string of the server internal status.
13793
*
138-
* @param handler the handler notified with the execution result
139-
* @return a reference to this, so the API can be used fluently
140-
*/
141-
@Fluent
142-
@Deprecated
143-
MySQLConnection getInternalStatistics(Handler<AsyncResult<String>> handler);
144-
145-
/**
146-
* Like {@link #getInternalStatistics(Handler)} but returns a {@code Future} of the asynchronous result
94+
* @return a future notified with the execution result
14795
*/
14896
Future<String> getInternalStatistics();
14997

@@ -152,61 +100,28 @@ static Future<MySQLConnection> connect(Vertx vertx, String connectionUri) {
152100
* Send a SET_OPTION command to set options for the current connection.
153101
*
154102
* @param option the options to set
155-
* @param handler the handler notified with the execution result
156-
* @return a reference to this, so the API can be used fluently
157-
*/
158-
@Fluent
159-
@Deprecated
160-
MySQLConnection setOption(MySQLSetOption option, Handler<AsyncResult<Void>> handler);
161-
162-
/**
163-
* Like {@link #setOption(MySQLSetOption, Handler)} but returns a {@code Future} of the asynchronous result
103+
* @return a future notified with the execution result
164104
*/
165105
Future<Void> setOption(MySQLSetOption option);
166106

167107
/**
168108
* Send a RESET_CONNECTION command to reset the session state.
169109
*
170-
* @param handler the handler notified with the execution result
171-
* @return a reference to this, so the API can be used fluently
172-
*/
173-
@Fluent
174-
@Deprecated
175-
MySQLConnection resetConnection(Handler<AsyncResult<Void>> handler);
176-
177-
/**
178-
* Like {@link #resetConnection(Handler)} but returns a {@code Future} of the asynchronous result
110+
* @return a future notified with the execution result
179111
*/
180112
Future<Void> resetConnection();
181113

182114
/**
183115
* Send a DEBUG command to dump debug information to the server's stdout.
184116
*
185-
* @param handler the handler notified with the execution result
186-
* @return a reference to this, so the API can be used fluently
187-
*/
188-
@Fluent
189-
@Deprecated
190-
MySQLConnection debug(Handler<AsyncResult<Void>> handler);
191-
192-
/**
193-
* Like {@link #debug(Handler)} but returns a {@code Future} of the asynchronous result
117+
* @return a future notified with the execution result
194118
*/
195119
Future<Void> debug();
196120

197121
/**
198122
* Send a CHANGE_USER command to change the user of the current connection, this operation will also reset connection state.
199123
*
200-
* @param options authentication options
201-
* @param handler the handler
202-
* @return a reference to this, so the API can be used fluently
203-
*/
204-
@Fluent
205-
@Deprecated
206-
MySQLConnection changeUser(MySQLAuthOptions options, Handler<AsyncResult<Void>> handler);
207-
208-
/**
209-
* Like {@link #changeUser(MySQLAuthOptions, Handler)} but returns a {@code Future} of the asynchronous result
124+
* @return a future notified with the execution result
210125
*/
211126
Future<Void> changeUser(MySQLAuthOptions options);
212127

0 commit comments

Comments
 (0)