-
Notifications
You must be signed in to change notification settings - Fork 53
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
UnmodifiableFuture? #65
Comments
Couldn't you just return |
It doesn't prevent a user from completing the returned future anyway. If it's passed to some other component, then we have the same problem, and I'd like to avoid using |
Also, we can create a singleton |
What about https://docs.oracle.com/en/java/javase/12/docs/api/java.base/java/util/concurrent/CompletableFuture.html#minimalCompletionStage() ? Can't that be used instead? |
Not in Java 8, because it's added in 9. 😭 (It's also less verbose to call |
I like the idea 👍 |
Gentle ping 😉 |
When returning a
CompletableFuture
to a caller, I sometimes need to make sure it is never completed by the caller. I could return aCompletionStage
but it is still possible for a user to misuse it by converting it withtoCompletableFuture()
.So, I wrote a new class called
UnmodifiableFuture
:Are you interested in making this a part of
completable-futures
? Then, I'd be happy to polish it a little bit and send a pull request.The text was updated successfully, but these errors were encountered: