Vertx: Future result availability and coding patternsVertx event bus can not send message to different verticleUsing Spring transaction management in a Vertx applicationcompose with vertx for sequential codeVertx Future Object returns nullvertx failed future but treated as succeeded()vertx timeout if async result is failedSharing objects with all verticles instancesPattern for using properly MongoClient in Vert.xVertx Rx-Java: reasons for eventBus subscriber being unsubscribedHow to be notified when all futures in Future.compose chain succeeded?

What is the `some` keyword in SwiftUI

Frame failure sudden death?

Trapping Rain Water

How to return a security deposit to a tenant

When conversion from Integer to Single may lose precision

How to generate all commutative pairings of list elements?

How to officially communicate to a non-responsive colleague?

Is using haveibeenpwned to validate password strength rational?

How do I write "Show, Don't Tell" as a person with Asperger Syndrome?

Where does "0 packages can be updated." come from?

How did they achieve the Gunslinger's shining eye effect in Westworld?

What should the arbiter and what should have I done in this case?

Should an arbiter claim draw at a K+R vs K+R endgame?

How would a aircraft visually signal "in distress"?

Compiling c files on ubuntu and using the executable on Windows

What makes an item an artifact?

Taxi Services at Didcot

Passing multiple files through stdin (over ssh)

What's the largest optical telescope mirror ever put in space?

What's up with this leaf?

Winning Strategy for the Magician and his Apprentice

How Can I Tell The Difference Between Unmarked Sugar and Stevia?

PhD - Well known professor or well known school?

Which comes first? Multiple Imputation, Splitting into train/test, or Standardization/Normalization



Vertx: Future result availability and coding patterns


Vertx event bus can not send message to different verticleUsing Spring transaction management in a Vertx applicationcompose with vertx for sequential codeVertx Future Object returns nullvertx failed future but treated as succeeded()vertx timeout if async result is failedSharing objects with all verticles instancesPattern for using properly MongoClient in Vert.xVertx Rx-Java: reasons for eventBus subscriber being unsubscribedHow to be notified when all futures in Future.compose chain succeeded?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I have some issues with understanding Vertx asynchronous model and how Future behave...



In the startup code of my application, I check some conditions, like db access and other credentials, then I start several management verticles (config verticle, http admin verticle, etc) before starting the core of the application. The code has the following structure:



Vertx vertx = null;
Vertx.clusteredVertx(opts, ar -> {
if(ar.failed())
System.exit(-1);

else
vertx = ar.result();
Future<Void> f1 = asyncStartupFunction_1(...);
if(f1.failed())
System.exit(-1);

else // f1 succeeded
Future<Void> f2 = asyncStartupFunction_2(...);
if(f2.failed())
System.exit(-1);

else // f2 succeeded
...
// f2 succeeded
// f1 succeeded
// vertx creation OK


asyncStartupFunction_x do some asynchronous work (query a db or deploy a verticle) and then they return the Future that represents the result of this work.



I would have thought that once I'm in a else block, the corresponding future has succeeded. Is it possible that the work has not finished yet and that the corresponding future has not yet completed ? And thus, because fx.failed() == false I get to the else block while (in my understanding) I shouldn't?



What would be the right pattern ?










share|improve this question




























    0















    I have some issues with understanding Vertx asynchronous model and how Future behave...



    In the startup code of my application, I check some conditions, like db access and other credentials, then I start several management verticles (config verticle, http admin verticle, etc) before starting the core of the application. The code has the following structure:



    Vertx vertx = null;
    Vertx.clusteredVertx(opts, ar -> {
    if(ar.failed())
    System.exit(-1);

    else
    vertx = ar.result();
    Future<Void> f1 = asyncStartupFunction_1(...);
    if(f1.failed())
    System.exit(-1);

    else // f1 succeeded
    Future<Void> f2 = asyncStartupFunction_2(...);
    if(f2.failed())
    System.exit(-1);

    else // f2 succeeded
    ...
    // f2 succeeded
    // f1 succeeded
    // vertx creation OK


    asyncStartupFunction_x do some asynchronous work (query a db or deploy a verticle) and then they return the Future that represents the result of this work.



    I would have thought that once I'm in a else block, the corresponding future has succeeded. Is it possible that the work has not finished yet and that the corresponding future has not yet completed ? And thus, because fx.failed() == false I get to the else block while (in my understanding) I shouldn't?



    What would be the right pattern ?










    share|improve this question
























      0












      0








      0








      I have some issues with understanding Vertx asynchronous model and how Future behave...



      In the startup code of my application, I check some conditions, like db access and other credentials, then I start several management verticles (config verticle, http admin verticle, etc) before starting the core of the application. The code has the following structure:



      Vertx vertx = null;
      Vertx.clusteredVertx(opts, ar -> {
      if(ar.failed())
      System.exit(-1);

      else
      vertx = ar.result();
      Future<Void> f1 = asyncStartupFunction_1(...);
      if(f1.failed())
      System.exit(-1);

      else // f1 succeeded
      Future<Void> f2 = asyncStartupFunction_2(...);
      if(f2.failed())
      System.exit(-1);

      else // f2 succeeded
      ...
      // f2 succeeded
      // f1 succeeded
      // vertx creation OK


      asyncStartupFunction_x do some asynchronous work (query a db or deploy a verticle) and then they return the Future that represents the result of this work.



      I would have thought that once I'm in a else block, the corresponding future has succeeded. Is it possible that the work has not finished yet and that the corresponding future has not yet completed ? And thus, because fx.failed() == false I get to the else block while (in my understanding) I shouldn't?



      What would be the right pattern ?










      share|improve this question














      I have some issues with understanding Vertx asynchronous model and how Future behave...



      In the startup code of my application, I check some conditions, like db access and other credentials, then I start several management verticles (config verticle, http admin verticle, etc) before starting the core of the application. The code has the following structure:



      Vertx vertx = null;
      Vertx.clusteredVertx(opts, ar -> {
      if(ar.failed())
      System.exit(-1);

      else
      vertx = ar.result();
      Future<Void> f1 = asyncStartupFunction_1(...);
      if(f1.failed())
      System.exit(-1);

      else // f1 succeeded
      Future<Void> f2 = asyncStartupFunction_2(...);
      if(f2.failed())
      System.exit(-1);

      else // f2 succeeded
      ...
      // f2 succeeded
      // f1 succeeded
      // vertx creation OK


      asyncStartupFunction_x do some asynchronous work (query a db or deploy a verticle) and then they return the Future that represents the result of this work.



      I would have thought that once I'm in a else block, the corresponding future has succeeded. Is it possible that the work has not finished yet and that the corresponding future has not yet completed ? And thus, because fx.failed() == false I get to the else block while (in my understanding) I shouldn't?



      What would be the right pattern ?







      vert.x






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 24 at 16:21









      mszmurlomszmurlo

      591615




      591615






















          1 Answer
          1






          active

          oldest

          votes


















          3














          asyncStartupFunction_1 returns a Future and there is no guarantee the future is completed at this point.



          Consequently f1.failed() has good chances not to give your a proper result. It's not a blocking call, and it may return false simply because the future is not completed yet.



          What you need is async coordination. Depending on your needs, you can either execute the async jobs in parallel or sequentially.






          share|improve this answer























          • I remember I already read that some time ago but just could remember where when I asked the question... Thanks for your time.

            – mszmurlo
            Mar 25 at 10:23











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55325895%2fvertx-future-result-availability-and-coding-patterns%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          3














          asyncStartupFunction_1 returns a Future and there is no guarantee the future is completed at this point.



          Consequently f1.failed() has good chances not to give your a proper result. It's not a blocking call, and it may return false simply because the future is not completed yet.



          What you need is async coordination. Depending on your needs, you can either execute the async jobs in parallel or sequentially.






          share|improve this answer























          • I remember I already read that some time ago but just could remember where when I asked the question... Thanks for your time.

            – mszmurlo
            Mar 25 at 10:23















          3














          asyncStartupFunction_1 returns a Future and there is no guarantee the future is completed at this point.



          Consequently f1.failed() has good chances not to give your a proper result. It's not a blocking call, and it may return false simply because the future is not completed yet.



          What you need is async coordination. Depending on your needs, you can either execute the async jobs in parallel or sequentially.






          share|improve this answer























          • I remember I already read that some time ago but just could remember where when I asked the question... Thanks for your time.

            – mszmurlo
            Mar 25 at 10:23













          3












          3








          3







          asyncStartupFunction_1 returns a Future and there is no guarantee the future is completed at this point.



          Consequently f1.failed() has good chances not to give your a proper result. It's not a blocking call, and it may return false simply because the future is not completed yet.



          What you need is async coordination. Depending on your needs, you can either execute the async jobs in parallel or sequentially.






          share|improve this answer













          asyncStartupFunction_1 returns a Future and there is no guarantee the future is completed at this point.



          Consequently f1.failed() has good chances not to give your a proper result. It's not a blocking call, and it may return false simply because the future is not completed yet.



          What you need is async coordination. Depending on your needs, you can either execute the async jobs in parallel or sequentially.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 25 at 8:52









          tsegismonttsegismont

          3,4651819




          3,4651819












          • I remember I already read that some time ago but just could remember where when I asked the question... Thanks for your time.

            – mszmurlo
            Mar 25 at 10:23

















          • I remember I already read that some time ago but just could remember where when I asked the question... Thanks for your time.

            – mszmurlo
            Mar 25 at 10:23
















          I remember I already read that some time ago but just could remember where when I asked the question... Thanks for your time.

          – mszmurlo
          Mar 25 at 10:23





          I remember I already read that some time ago but just could remember where when I asked the question... Thanks for your time.

          – mszmurlo
          Mar 25 at 10:23



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55325895%2fvertx-future-result-availability-and-coding-patterns%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

          Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript