Skip to content
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

Replace synchronization by Lock in FutureImpl #2912

Conversation

Koziolek
Copy link

@Koziolek Koziolek commented Oct 18, 2024

I replaced synchronized blocks with Lock for the sake of Virtual Threads support. More details: https://docs.oracle.com/en/java/javase/21/core/virtual-threads.html#GUID-04C03FFC-066D-4857-85B9-E5A27A875AF9


Similar to #2845

@pivovarit
Copy link
Member

It's ok for now, but I'd definitely revisit the design of Vavr's Future. That locking in constructor feels excessive - I believe that immutable objects can be actually mutable inside as long as this this doesn't leak. It also feels that the current implementation tries to be overly smart by inducing happens-before using synchronized instead of plain volatile

@pivovarit pivovarit merged commit 82f26e1 into vavr-io:version/0.x Oct 18, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants