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;
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
add a comment |
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
add a comment |
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
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
vert.x
asked Mar 24 at 16:21
mszmurlomszmurlo
591615
591615
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
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.
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
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
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
add a comment |
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.
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
add a comment |
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.
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.
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
add a comment |
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
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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