Uploaded image for project: 'RAML Module Builder'
  1. RAML Module Builder
  2. RMB-491

migrate deprecated/removed Future calls in preparation for vert.x4 migration

    XMLWordPrintable

Details

    • CP: sprint 79, CP: sprint 87
    • 3
    • Core: Platform

    Description

      In newer RMB release the Vert.x version has been incremented. Since Vert.x update some Future methods became deprecated.
      In data-import modules most business-logic is written in composed manner using Future methods. The code is tightly coupled with Future class, that obviously requires a huge rework of existing code base.

      These Future methods haven been deprecated and will be removed in Vertx 4.

      Quote from https://github.com/vert-x3/wiki/wiki/3.8.0-Deprecations-and-breaking-changes#future-creation-and-completion :

      // Deprecated
      Future<String> fut = Future.future();
      vertx.setTimer(1000, id -> fut.complete("hello");
      return fut;
      
      // Now you should do this
      Promise<String> promise = Promise.promise();
      vertx.setTimer(1000, id -> promise.complete("hello");
      return promise.future();
      

      Creating and completing futures is deprecated in Vert.x 3.8 in favor of promises.

      Quote from https://github.com/vert-x3/wiki/wiki/4.0.0-Deprecations-and-breaking-changes#%EF%B8%8F-future-sethandler-method-pruning :

      ☑️ Future setHandler method pruning

      https://github.com/eclipse-vertx/vert.x/issues/3329

      Vert.x supports multiple handler per future in 4.0. The setHandler method does convey the meaning that a single handler per future can be set and unset and the onComplete, onSuccess, onFailure methods shall be used instead.

      The setHandler method usage must be replaced by the onComplete method, e.g

      // Before
      Future<String> fut = getSomeFuture();
      fut.setHandler(ar -> ...);
      
      // After
      Future<String> fut = getSomeFuture();
      fut.onComplete(ar -> ...);
      

      Vert.x 3.9 deprecates setHandler.

      ☑️ Future completer method pruning

      https://github.com/eclipse-vertx/vert.x/issues/2869

      The Future#completer() method is deprecated since Future<T> extends Handler<AsyncResult<T>> for some time now (and the default implementation actually returns this).

      TestRail: Results

        Attachments

          Issue Links

            Activity

              People

                mikhail.fokanov Mikhail Fokanov
                Igor_Gorchakov Igor Gorchakov
                Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:

                  TestRail: Runs

                    TestRail: Cases