Skip to content

Commit

Permalink
Deprecate callbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
vietj committed Mar 3, 2023
1 parent 9ad5c3d commit 1e3f2ae
Show file tree
Hide file tree
Showing 33 changed files with 230 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/main/java/io/vertx/core/Context.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ static boolean isOnVertxThread() {
* guarantees
* @param <T> the type of the result
*/
@Deprecated
<T> void executeBlocking(Handler<Promise<T>> blockingCodeHandler, boolean ordered, Handler<AsyncResult<@Nullable T>> resultHandler);

/**
Expand All @@ -136,6 +137,7 @@ static boolean isOnVertxThread() {
* @param resultHandler handler that will be called when the blocking code is complete
* @param <T> the type of the result
*/
@Deprecated
default <T> void executeBlocking(Handler<Promise<T>> blockingCodeHandler, Handler<AsyncResult<@Nullable T>> resultHandler) {
executeBlocking(blockingCodeHandler, true, resultHandler);
}
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/io/vertx/core/Vertx.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ static Vertx vertx(VertxOptions options) {
* @param options the options to use
* @param resultHandler the result handler that will receive the result
*/
@Deprecated
static void clusteredVertx(VertxOptions options, Handler<AsyncResult<Vertx>> resultHandler) {
new VertxBuilder(options).init().clusteredVertx(resultHandler);
}
Expand Down Expand Up @@ -355,6 +356,7 @@ default TimeoutStream periodicStream(long delay) {
*
* @param completionHandler The handler will be notified when the close is complete.
*/
@Deprecated
void close(Handler<AsyncResult<Void>> completionHandler);

/**
Expand Down Expand Up @@ -384,6 +386,7 @@ default Future<String> deployVerticle(Verticle verticle) {
* @param completionHandler a handler which will be notified when the deployment is complete
*/
@GenIgnore(GenIgnore.PERMITTED_TYPE)
@Deprecated
void deployVerticle(Verticle verticle, Handler<AsyncResult<String>> completionHandler);

/**
Expand Down Expand Up @@ -428,6 +431,7 @@ default Future<String> deployVerticle(Verticle verticle) {
* @param completionHandler a handler which will be notified when the deployment is complete
*/
@GenIgnore(GenIgnore.PERMITTED_TYPE)
@Deprecated
void deployVerticle(Verticle verticle, DeploymentOptions options, Handler<AsyncResult<String>> completionHandler);

/**
Expand All @@ -447,6 +451,7 @@ default Future<String> deployVerticle(Verticle verticle) {
* Note that the supplier will be invoked on the caller thread.
*/
@GenIgnore(GenIgnore.PERMITTED_TYPE)
@Deprecated
void deployVerticle(Supplier<Verticle> verticleSupplier, DeploymentOptions options, Handler<AsyncResult<String>> completionHandler);

/**
Expand Down Expand Up @@ -474,6 +479,7 @@ default Future<String> deployVerticle(String name) {
* @param name The identifier
* @param completionHandler a handler which will be notified when the deployment is complete
*/
@Deprecated
default void deployVerticle(String name, Handler<AsyncResult<String>> completionHandler) {
deployVerticle(name, new DeploymentOptions(), completionHandler);
}
Expand All @@ -497,6 +503,7 @@ default void deployVerticle(String name, Handler<AsyncResult<String>> completion
* @param options the deployment options.
* @param completionHandler a handler which will be notified when the deployment is complete
*/
@Deprecated
void deployVerticle(String name, DeploymentOptions options, Handler<AsyncResult<String>> completionHandler);

/**
Expand All @@ -515,6 +522,7 @@ default void deployVerticle(String name, Handler<AsyncResult<String>> completion
* @param deploymentID the deployment ID
* @param completionHandler a handler which will be notified when the undeployment is complete
*/
@Deprecated
void undeploy(String deploymentID, Handler<AsyncResult<Void>> completionHandler);

/**
Expand Down Expand Up @@ -586,6 +594,7 @@ default void deployVerticle(String name, Handler<AsyncResult<String>> completion
* guarantees
* @param <T> the type of the result
*/
@Deprecated
default <T> void executeBlocking(Handler<Promise<T>> blockingCodeHandler, boolean ordered, Handler<AsyncResult<@Nullable T>> resultHandler) {
Context context = getOrCreateContext();
context.executeBlocking(blockingCodeHandler, ordered, resultHandler);
Expand All @@ -594,6 +603,7 @@ default <T> void executeBlocking(Handler<Promise<T>> blockingCodeHandler, boolea
/**
* Like {@link #executeBlocking(Handler, boolean, Handler)} called with ordered = true.
*/
@Deprecated
default <T> void executeBlocking(Handler<Promise<T>> blockingCodeHandler, Handler<AsyncResult<@Nullable T>> resultHandler) {
executeBlocking(blockingCodeHandler, true, resultHandler);
}
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/io/vertx/core/WorkerExecutor.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,13 @@ public interface WorkerExecutor extends Measured {
* guarantees
* @param <T> the type of the result
*/
@Deprecated
<T> void executeBlocking(Handler<Promise<T>> blockingCodeHandler, boolean ordered, Handler<AsyncResult<@Nullable T>> resultHandler);

/**
* Like {@link #executeBlocking(Handler, boolean, Handler)} called with ordered = true.
*/
@Deprecated
default <T> void executeBlocking(Handler<Promise<T>> blockingCodeHandler, Handler<AsyncResult<@Nullable T>> resultHandler) {
executeBlocking(blockingCodeHandler, true, resultHandler);
}
Expand All @@ -74,6 +76,7 @@ default <T> Future<T> executeBlocking(Handler<Promise<T>> blockingCodeHandler) {
*
* @param handler the completion handler
*/
@Deprecated
void close(Handler<AsyncResult<Void>> handler);

/**
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/io/vertx/core/datagram/DatagramSocket.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public interface DatagramSocket extends ReadStream<DatagramPacket>, Measured {
* @return a reference to this, so the API can be used fluently
*/
@Fluent
@Deprecated
DatagramSocket send(Buffer packet, int port, String host, Handler<AsyncResult<Void>> handler);

/**
Expand Down Expand Up @@ -80,6 +81,7 @@ public interface DatagramSocket extends ReadStream<DatagramPacket>, Measured {
* @return a reference to this, so the API can be used fluently
*/
@Fluent
@Deprecated
DatagramSocket send(String str, int port, String host, Handler<AsyncResult<Void>> handler);

/**
Expand All @@ -99,6 +101,7 @@ public interface DatagramSocket extends ReadStream<DatagramPacket>, Measured {
* @return a reference to this, so the API can be used fluently
*/
@Fluent
@Deprecated
DatagramSocket send(String str, String enc, int port, String host, Handler<AsyncResult<Void>> handler);

/**
Expand All @@ -112,6 +115,7 @@ public interface DatagramSocket extends ReadStream<DatagramPacket>, Measured {
*
* @param handler the handler to notify once complete
*/
@Deprecated
void close(Handler<AsyncResult<Void>> handler);

/**
Expand All @@ -137,6 +141,7 @@ public interface DatagramSocket extends ReadStream<DatagramPacket>, Measured {
* @return a reference to this, so the API can be used fluently
*/
@Fluent
@Deprecated
DatagramSocket listenMulticastGroup(String multicastAddress, Handler<AsyncResult<Void>> handler);

/**
Expand All @@ -155,6 +160,7 @@ public interface DatagramSocket extends ReadStream<DatagramPacket>, Measured {
* @return a reference to this, so the API can be used fluently
*/
@Fluent
@Deprecated
DatagramSocket listenMulticastGroup(String multicastAddress, String networkInterface, @Nullable String source,
Handler<AsyncResult<Void>> handler);

Expand All @@ -172,6 +178,7 @@ DatagramSocket listenMulticastGroup(String multicastAddress, String networkInter
* @return a reference to this, so the API can be used fluently
*/
@Fluent
@Deprecated
DatagramSocket unlistenMulticastGroup(String multicastAddress, Handler<AsyncResult<Void>> handler);

/**
Expand All @@ -190,6 +197,7 @@ DatagramSocket listenMulticastGroup(String multicastAddress, String networkInter
* @return a reference to this, so the API can be used fluently
*/
@Fluent
@Deprecated
DatagramSocket unlistenMulticastGroup(String multicastAddress, String networkInterface, @Nullable String source,
Handler<AsyncResult<Void>> handler);

Expand All @@ -209,6 +217,7 @@ DatagramSocket unlistenMulticastGroup(String multicastAddress, String networkInt
* @return a reference to this, so the API can be used fluently
*/
@Fluent
@Deprecated
DatagramSocket blockMulticastGroup(String multicastAddress, String sourceToBlock,
Handler<AsyncResult<Void>> handler);

Expand All @@ -229,6 +238,7 @@ DatagramSocket blockMulticastGroup(String multicastAddress, String sourceToBlock
* @return a reference to this, so the API can be used fluently
*/
@Fluent
@Deprecated
DatagramSocket blockMulticastGroup(String multicastAddress, String networkInterface, String sourceToBlock,
Handler<AsyncResult<Void>> handler);

Expand All @@ -246,6 +256,7 @@ DatagramSocket blockMulticastGroup(String multicastAddress, String networkInterf
* @return a reference to this, so the API can be used fluently
*/
@Fluent
@Deprecated
DatagramSocket listen(int port, String host, Handler<AsyncResult<DatagramSocket>> handler);

/**
Expand Down
12 changes: 12 additions & 0 deletions src/main/java/io/vertx/core/dns/DnsClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public interface DnsClient {
* @return a reference to this, so the API can be used fluently
*/
@Fluent
@Deprecated
DnsClient lookup(String name, Handler<AsyncResult<@Nullable String>> handler);

/**
Expand All @@ -57,6 +58,7 @@ public interface DnsClient {
* @return a reference to this, so the API can be used fluently
*/
@Fluent
@Deprecated
DnsClient lookup4(String name, Handler<AsyncResult<@Nullable String>> handler);

/**
Expand All @@ -74,6 +76,7 @@ public interface DnsClient {
* @return a reference to this, so the API can be used fluently
*/
@Fluent
@Deprecated
DnsClient lookup6(String name, Handler<AsyncResult<@Nullable String>> handler);

/**
Expand All @@ -92,6 +95,7 @@ public interface DnsClient {
* @return a reference to this, so the API can be used fluently
*/
@Fluent
@Deprecated
DnsClient resolveA(String name, Handler<AsyncResult<List<String>>> handler);

/**
Expand All @@ -110,6 +114,7 @@ public interface DnsClient {
* @return a reference to this, so the API can be used fluently
*/
@Fluent
@Deprecated
DnsClient resolveAAAA(String name, Handler<AsyncResult<List<String>>> handler);

/**
Expand All @@ -127,6 +132,7 @@ public interface DnsClient {
* @return a reference to this, so the API can be used fluently.
*/
@Fluent
@Deprecated
DnsClient resolveCNAME(String name, Handler<AsyncResult<List<String>>> handler);

/**
Expand All @@ -145,6 +151,7 @@ public interface DnsClient {
* @return a reference to this, so the API can be used fluently.
*/
@Fluent
@Deprecated
DnsClient resolveMX(String name, Handler<AsyncResult<List<MxRecord>>> handler);

/**
Expand All @@ -162,6 +169,7 @@ public interface DnsClient {
* @return a reference to this, so the API can be used fluently.
*/
@Fluent
@Deprecated
DnsClient resolveTXT(String name, Handler<AsyncResult<List<String>>> handler);

/**
Expand All @@ -179,6 +187,7 @@ public interface DnsClient {
* @return a reference to this, so the API can be used fluently.
*/
@Fluent
@Deprecated
DnsClient resolvePTR(String name, Handler<AsyncResult<@Nullable String>> handler);

/**
Expand All @@ -196,6 +205,7 @@ public interface DnsClient {
* @return a reference to this, so the API can be used fluently.
*/
@Fluent
@Deprecated
DnsClient resolveNS(String name, Handler<AsyncResult<List<String>>> handler);

/**
Expand All @@ -213,6 +223,7 @@ public interface DnsClient {
* @return a reference to this, so the API can be used fluently.
*/
@Fluent
@Deprecated
DnsClient resolveSRV(String name, Handler<AsyncResult<List<SrvRecord>>> handler);

/**
Expand All @@ -231,6 +242,7 @@ public interface DnsClient {
* @return a reference to this, so the API can be used fluently.
*/
@Fluent
@Deprecated
DnsClient reverseLookup(String ipaddress, Handler<AsyncResult<@Nullable String>> handler);

/**
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/io/vertx/core/eventbus/EventBus.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public interface EventBus extends Measured {
* @return a reference to this, so the API can be used fluently
*/
@Fluent
@Deprecated
default <T> EventBus request(String address, @Nullable Object message, Handler<AsyncResult<Message<T>>> replyHandler) {
return request(address, message, new DeliveryOptions(), replyHandler);
}
Expand All @@ -102,6 +103,7 @@ default <T> Future<Message<T>> request(String address, @Nullable Object message)
* @return a reference to this, so the API can be used fluently
*/
@Fluent
@Deprecated
default <T> EventBus request(String address, @Nullable Object message, DeliveryOptions options, Handler<AsyncResult<Message<T>>> replyHandler) {
Future<Message<T>> reply = request(address, message, options);
reply.onComplete(replyHandler);
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/io/vertx/core/eventbus/Message.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ default void reply(@Nullable Object message) {
* @param message the message to reply with.
* @param replyHandler the reply handler for the reply.
*/
@Deprecated
default <R> void replyAndRequest(@Nullable Object message, Handler<AsyncResult<Message<R>>> replyHandler) {
replyAndRequest(message, new DeliveryOptions(), replyHandler);
}
Expand All @@ -119,6 +120,7 @@ default <R> Future<Message<R>> replyAndRequest(@Nullable Object message) {
* @param options delivery options
* @param replyHandler reply handler will be called when any reply from the recipient is received
*/
@Deprecated
default <R> void replyAndRequest(@Nullable Object message, DeliveryOptions options, Handler<AsyncResult<Message<R>>> replyHandler) {
this.<R>replyAndRequest(message, options).onComplete(replyHandler);
}
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/io/vertx/core/eventbus/MessageConsumer.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public interface MessageConsumer<T> extends ReadStream<Message<T>> {
*
* @param completionHandler the completion handler
*/
@Deprecated
void completionHandler(Handler<AsyncResult<Void>> completionHandler);

/**
Expand All @@ -101,5 +102,6 @@ public interface MessageConsumer<T> extends ReadStream<Message<T>> {
* @param completionHandler the handler called when the unregister is done. For example in a cluster when all nodes of the
* event bus have been unregistered.
*/
@Deprecated
void unregister(Handler<AsyncResult<Void>> completionHandler);
}
2 changes: 2 additions & 0 deletions src/main/java/io/vertx/core/eventbus/MessageProducer.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public interface MessageProducer<T> {
* @param handler the handler called when the message has been successfully or failed to be written, this is not a delivery
* guarantee
*/
@Deprecated
void write(T body, Handler<AsyncResult<Void>> handler);

/**
Expand All @@ -66,5 +67,6 @@ public interface MessageProducer<T> {
/**
* Same as {@link #close()} but with an {@code handler} called when the operation completes
*/
@Deprecated
void close(Handler<AsyncResult<Void>> handler);
}
Loading

0 comments on commit 1e3f2ae

Please sign in to comment.