Skip to content

Conversation

@konrad-kaminski
Copy link
Contributor

Prior to this commit there was no support for converting Kotlin
coroutines to/from ListenableFuture. Following that change a number of
functions will be available for such conversion.

Specifically these functions are introduced:

  • // for converting suspending lambda to ListenableFuture
    fun <T> listenableFuture(context: CoroutineContext = CommonPool, block: suspend () -> T): ListenableFuture<T>

  • // for converting Deffered into ListenableFuture
    fun <T> Deferred<T>.asListenableFuture(): ListenableFuture<T>

  • // for converting ListenableFuture into suspending function
    suspend fun <T> ListenableFuture<T>.await(): T

The code in this PR draws heavily on the code from https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-jdk8/src/main/kotlin/kotlinx/coroutines/experimental/future/Future.kt. This is why Roman Elizarov is also an author.

Prior to this commit there was no support for converting Kotlin
coroutines to/from ListenableFuture. Following that change a number of
functions will be available for such conversion.

Specifically these functions are introduced:

 - // for converting suspending lambda to ListenableFuture
   fun <T> listenableFuture(context: CoroutineContext = CommonPool,
       block: suspend () -> T): ListenableFuture<T>

 - // for converting Deffered into ListenableFuture
   fun <T> Deferred<T>.asListenableFuture(): ListenableFuture<T>

 - // for converting ListenableFuture into suspending function
   suspend fun <T> ListenableFuture<T>.await(): T

Issue: SPR-15413
@enleur
Copy link

enleur commented Mar 13, 2018

Just to have a reference to the issue https://jira.spring.io/browse/SPR-15413

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jan 24, 2019
@rstoyanchev rstoyanchev added the in: core Issues in core modules (aop, beans, core, context, expression) label Nov 11, 2021
@snicoll
Copy link
Member

snicoll commented Nov 24, 2021

@sdeleuze can you please check if this is still applicable?

@snicoll snicoll added the status: waiting-for-feedback We need additional information before we can continue label Nov 26, 2021
@poutsma poutsma self-assigned this Dec 2, 2021
@poutsma poutsma removed status: waiting-for-feedback We need additional information before we can continue status: waiting-for-triage An issue we've not yet triaged or decided on labels Dec 7, 2021
@poutsma
Copy link
Contributor

poutsma commented Dec 7, 2021

After team discussion, we have decided not to invest in ListenableFuture. It can easily be converted into a CompletableFuture, which has Kotlin support through kotlinx-coroutines-jdk8.

Thank you for submitting a PR, though.

@poutsma poutsma closed this Dec 7, 2021
@poutsma poutsma added the status: declined A suggestion or change that we don't feel we should currently apply label Dec 7, 2021
@rstoyanchev
Copy link
Contributor

Also see #27780.

@sdeleuze
Copy link
Contributor

+1 for that decision.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in: core Issues in core modules (aop, beans, core, context, expression) status: declined A suggestion or change that we don't feel we should currently apply

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants