-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Checkpoint awaitability #24
Comments
Should we recommend that over I see the point of your proposal, but I'm wondering if we should mix concerns or not. |
are you thinking of CountDownLatch ? |
It can also be seen as a CompletionStage as well |
imho just await is fine, CompletionStage has other purpose and CountDownLatch is a read/write interface (i.e if you have it you can count() and (which is what flag() does more or less) |
Yeah I was thinking about a latch |
we could think of Checkpoint to be a class an extend the latch, I'm not sure it would buy anything as it's quite a minimalistic API. |
I'd rather compose than extend 😉 |
So yeah let's think about |
it was not clear if you meant about API reuse or code reuse it would be great also to clarify that await should throw an exception when the context fails so basically under the hood it would rather be a CompletableFuture that is completed when the checkpoint is completed and completed exceptionally when its context fails. |
you can call it awaitSuccess :-) |
@jponge , there was any progress on this? Btw, is there any alternative in order to prevent the test method in main thread, other than Thread.sleep(), to finish while an async procedure are being executed? |
@cvgaviao The test method will always execute from the main thread. |
It's often convenient to use a checkpoint as latch to yield the main thread when a condition is met:
The text was updated successfully, but these errors were encountered: